We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I m using MSC1210. It receives data on UART0. SCON=0x50--> Serial mode 1(Asynchronous full-duplex). However, in simulation, only RI(receive interrupt) happens, TI never gets set. As per the code TI should get set:
SBUF='@'; //These 3 lines are not setting TI bit SBUF=0x0D; SBUF=0x0A; //copying the string into array for(z=1;z<=4;z++) { while(SCON0==0x50){} init_arr[z]=SBUF; SCON0=0x50; } P0=0x00; //comparing the string if (init_arr[1]=='I' && init_arr[2]=='4' && init_arr[3]==' ' && init_arr[4]=='A') P0=0x0F9; else P0=0x0C0;
Please tell me if i m wrong and why it wouldnt work as intended.
"TI never gets set"
How do you know? You don't specifically test the TI bit anywhere in the code shown.
Can't you test the TI and RI bits directly?
Does this chip require you to specify both receive and transmit UART clocks? If so, have you done it?
"SCON=0x50--> Serial mode 1(Asynchronous full-duplex)."
But in the code, you are reading & writing SCON0 Are you sure that they are the same on this chip?