hello,everyone! I wrote a program about serial communication and when I run it on simulator,it is no problem, but when I upload it to the Phytec KitCon167's flash,something wrong occur. The program is below:
unsigned char temp,temp1; void main() { serial_init (); temp = 0x45; while(1) { transmit_data(temp); while (! S0TBIR) { ; } S0TBIR = 0; temp1 = 0x23; transmit_data(temp1); while (! S0TBIR) { ; } S0TBIR = 0; temp1 ++; transmit_data(temp1); while (! S0TBIR) { ; } S0TBIR = 0; }
Some random stuff to try: 1] Instead of using S0TBIR, try S0TIR. Also set S0TIR to 0 before putting anything into S0TBUF for the first time. Also remove the space between temp1 and the ++ operator. 2] Use
S0CON=0x0011;
S0R = 1;
SOTBUF=0x43;