Jogisant
Newbie level 3
HI
MCU 89c51, baud rate same 19200
I am facing a problem while serial interfacing of two MCU or one MCU with virtual terminal .
Actually whenever one bit gets transmitted, the receive ISR of MCU gets triggered automatically, but there is no request from other mcu.
Then it never come out also, I am unable to understand why the ISR gets triggered, when RI is also not getting 1.
Now when I write an if command to check If(RI==1), then answer is false and program does not enter inside .
Please help me with detailed steps in serial communication.
AS I was assuming that whenever a data(bit) gets transmitted , the MCU checks if there is any bit on reception or not.
or otherwise if this not true then when is the protocol being followed by MCU for serial communication.
PLease find enclosed the code as well.
Plz also tell me what is the function of REN in SCON.
Thanks in anticipation.
Rahul Mittal.
(rahul.kcsl@gmail.com)
MCU 89c51, baud rate same 19200
I am facing a problem while serial interfacing of two MCU or one MCU with virtual terminal .
Actually whenever one bit gets transmitted, the receive ISR of MCU gets triggered automatically, but there is no request from other mcu.
Then it never come out also, I am unable to understand why the ISR gets triggered, when RI is also not getting 1.
Now when I write an if command to check If(RI==1), then answer is false and program does not enter inside .
Please help me with detailed steps in serial communication.
AS I was assuming that whenever a data(bit) gets transmitted , the MCU checks if there is any bit on reception or not.
or otherwise if this not true then when is the protocol being followed by MCU for serial communication.
PLease find enclosed the code as well.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 void transmit_data(unsigned char *tx) // Function to transmit data through serial port { int i =0; lcd_cmd(0x01);lcd_cmd(0x80); lcd_string("txn begins"); while(tx[i]!='\0') { SBUF=tx[i]; // Store data in SBUF lcd_char(tx[i]); txn_arr[i]=tx[i]; while(TI==0); // Wait till data transmits delay(10); TI=0; i++; } //SCON=0x50; } void receive_data() interrupt 4 // Function to transmit data through serial port { //char arr[10]; int i =0; if (RI==1) { lcd_cmd(0x80); lcd_string("recv"); RI=0; rx[i]=SBUF; // Store data in SBUF lcd_char(rx[i]); delay(10); } }
Plz also tell me what is the function of REN in SCON.
Thanks in anticipation.
Rahul Mittal.
(rahul.kcsl@gmail.com)
Last edited by a moderator: