大虾们再帮看看我的8251发送接收程序P0口怎么一点反应都没有啊! 我现在是用89c52经过8251并行转串口后,与max232相连最后与电脑通信,大虾们帮看看啊! #define _TEST_C_ #include "reg52.h" #include "stdlib.h" #include "absacc.h" #include "intrins.h" #include "test.h"
#define uchar unsigned char #define uint unsigned int #define COM8251 XBYTE[0x8601] #define DAT8251 XBYTE[0x8600] sbit flag1_8251 = ACC^0; sbit flag2_8251 = ACC^1; uchar data_temp[10]={0x55,3a,22,32,0,0};
void initmcu(void); void Trans8251(void);
void main(void) { initmcu(); Trans8251(); } void initmcu(void) { TMOD = 0x22; //9600波特11.0592MHz,方式2 TL1 = 0XFD; TH1 = 0XFD;SCON = 0X50; TR1 = 1; TR0=1; ES = 1; EA = 1; }
void Trans8251(void) { uchar i; COM8251 = 0x00; COM8251 = 0x00; COM8251 = 0x00; COM8251 = 0x6d; COM8251 = 0x37; for(;;) { for(i=0;i<4;i++) { do ACC = COM8251; while(flag1_8251==0); DAT8251 = data_temp; } for(i=0;i<4;i++) { do { ACC = COM8251; }while(flag2_8251 == 1); } data_temp = DAT8251; } }
|