51 IO口模拟串口通讯C源程序 #include sbit BT_SND =P1^0; sbit BT_REC =P1^1; /********************************************** IO 口模拟232通讯程序 使用两种方式的C程序 占用定时器0 **********************************************/ #define MODE_QUICK #define F_TM F0 #define TIMER0_ENABLE TL0=TH0; TR0=1; #define TIMER0_DISABLE TR0=0; sbit ACC0= ACC^0; sbit ACC1= ACC^1; sbit ACC2= ACC^2; sbit ACC3= ACC^3; sbit ACC4= ACC^4; sbit ACC5= ACC^5; sbit ACC6= ACC^6; sbit ACC7= ACC^7; void IntTimer0() interrupt 1 { F_TM=1; } //发送一个字符 void PSendChar(unsigned char inch) { #ifdef MODE_QUICK ACC=inch; F_TM=0; BT_SND=0; //start bit TIMER0_ENABLE; //启动 while(!F_TM); BT_SND=ACC0; //先送出低位 F_TM=0; while(!F_TM); BT_SND=ACC1; F_TM=0; while(!F_TM); BT_SND=ACC2; F_TM=0; while(!F_TM); BT_SND=ACC3; F_TM=0; while(!F_TM); BT_……