在学MC51的串口通讯,编的个小程序,如下,但在串行窗口始终只有'a',为何啊? #include<reg52.h> unsigned char h[10]={'a','b','c','d','e','f','g','h','i','o'}; void senddate(unsigned char date) { SBUF=date; while(TI==0) TI=0; } void main() { unsigned int i; unsigned char *p; p=&h[0]; TMOD=0X20; TH1=0XFD; TL1=0XFD; PCON&=0X80; SCON=0X40; TR1=1; REN=1; EA=1; while(1) { for(i=0;i<10;i++) { senddate(*p); p++; } } }
|