单片机温度监控系统的设计 第3页
if(a!=0xff)
RD1=1;
else RD1=0;
}
else if((temp>=templ)&&(temp<=temph))
{
a=0;
RD0=0;
RD1=0;
}
for(delay=0xFff;delay>0;delay--) asm("nop");
}
#include <pic.h>
//*************************
unsigned char txbuf[5];
unsigned char rxbuf[5];
extern unsigned int delay;
unsigned char s_uart_buf;
unsigned char rx_lo_buf;
extern unsigned char i;
//*************************
void TXPC(unsigned char byte)//9600b/s
{
RC6 = 0;//start bit
www.751com.cn else RC6=0;
for(s_uart_buf=0;s_uart_buf<35;s_uart_buf++)asm("nop");
if(byte&0x08)RC6=1;
else RC6=0;
for(s_uart_buf=0;s_uart_buf<35;s_uart_buf++)asm("nop");
if(byte&0x10)RC6=1;
else RC6=0;
for(s_uart_buf=0;s_uart_buf<35;s_uart_buf++)asm("nop");
if(byte&0x20)RC6=1;
else RC6=0;
for(s_uart_buf=0;s_uart_buf<35;s_uart_buf++)asm("nop");
if(byte&0x40)RC6=1;
else RC6=0;
for(s_uart_buf=0;s_uart_buf<35;s_uart_buf++)asm("nop");
if(byte&0x80)RC6=1;
else RC6=0;
for(s_uart_buf=0;s_uart_buf<35;s_uart_buf++)asm("nop");
RC6=1;//stop bit
for(s_uart_buf=0;s_uart_buf<45;s_uart_buf++)asm("nop");
}
//*************************************************
unsigned char RXPC(void)//9600b/s
{
rx_lo_buf=0;
while(1)
{
if(!RC7) break;
}
//receive start bit
for(s_uart_buf=0;s_uart_buf<46;s_uart_buf++)continue;
//receive bit
for(s_uart_buf=0;s_uart_buf<17;s_uart_buf++)asm("nop");
if(RC7)rx_lo_buf=rx_lo_buf|0x01;
for(s_uart_buf=0;s_uart_buf<35;s_uart_buf++)asm("nop");
if(RC7)rx_lo_buf=rx_lo_buf|0x02;
for(s_uart_buf=0;s_uart_buf<35;s_uart_buf++)asm("nop");
if(RC7)rx_lo_buf=rx_lo_buf|0x04;
for(s_uart_buf=0;s_uart_buf<35;s_uart_buf++)asm("nop");
if(RC7)rx_lo_buf=rx_lo_buf|0x08;
for(s_uart_buf=0;s_uart_buf<35;s_uart_buf++)asm("nop");
if(RC7)rx_lo_buf=rx_lo_buf|0x10;
for(s_uart_buf=0;s_uart_buf<35;s_uart_buf++)asm("nop");
if(RC7)rx_lo_buf=rx_lo_buf|0x20;
for(s_uart_buf=0;s_uart_buf<35;s_uart_buf++)asm("nop");
if(RC7)rx_lo_buf=rx_lo_buf|0x40;
for(s_uart_buf=0;s_uart_buf<35;s_uart_buf++)asm("nop");
if(RC7)rx_lo_buf=rx_lo_buf|0x80;
for(s_uart_buf=0;s_uart_buf<35;s_uart_buf++)asm("nop");上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>
单片机温度监控系统的设计 第3页下载如图片无法显示或论文不完整,请联系qq752018766