Tuesday, November 22, 2011

WAP in 8051 to send "HI" serially at 4800 baud rate

; USING TIMER 1 MODE 2 AUTO RELOAD MODE
MOV TMOD, #0010 0000B    ; TIMER 1 MODE 2 FOR TIMER OPERATION
MOV TH1, #-6        ; 4800 BAUD RATE
MOV SCON, #0101 0000B    ; SMODE 2 ,8 BIT ,1 STOP BIT, READ ENABLED
SETB TR1        ; START TIMER 1

BACK :
MOV SBUF, #"H"        ;

HERE :
JNB T1, HERE        ; WAIT FOR TRANSMISSION TO BE OVER
CLR T1            ;

MOV SBUF,#"I"        ;

HERE1 :
JNB T1, HERE1        ; WAIT FOR TRANSMISSION TO BE OVER
CLR T1            ;

SJMP BACK        ;
END

No comments:

Post a Comment