Ngo Trong Nghia
Newbie level 4
Hi everyone, I am doing the UART receive with 8051 microcontroller but I met some problems. Although my UART transmission worked well, the receive mechanism did not. I tried every basic thing as SCON #50H,.. but it looks like the RI flag did not even work ?? One more problem is that even I copied the code of some one who did the receive successful in his/her video but when I ran it on my Proteus file it did not work anymore. Is that because the version of my Keil C is not compatible to my Proteus ? I am hopeless these days and hope for your helps !
The code (asm) below is what I tried to run. When the data is received through UART then it will clear the port P3.5. ( I typed the data in virtual terminal )
ORG 00H;
LJMP MAIN;
TEST EQU P3.5;
MAIN:
MOV TMOD,#20H;
MOV TH1,#-3;
MOV SCON, #50H;
SETB TR1;
RECEIVE:
JNB RI,RECEIVE;
CLR RI;
CLR TEST;
RET
END
The code (asm) below is what I tried to run. When the data is received through UART then it will clear the port P3.5. ( I typed the data in virtual terminal )
ORG 00H;
LJMP MAIN;
TEST EQU P3.5;
MAIN:
MOV TMOD,#20H;
MOV TH1,#-3;
MOV SCON, #50H;
SETB TR1;
RECEIVE:
JNB RI,RECEIVE;
CLR RI;
CLR TEST;
RET
END