
564 EMBEDDED SYSTEMS
BACK: JNB RI,BACK ;check for RI fl ag
MOV A,SBUF ;RI = 1, copy SBUF to A
MOV P1,A ;copy A to P1
CLR RI ;clear RI for next reception
SJMP BACK ;jump to BACK
END
Example 14.24b
ORG 0 ;reset location
LJMP STRT ;jump to STRT
ORG 0023H ;serial interrupt vector
SJMP REX ;jump to REX for ISR
ORG 0040H ;origin of main program
STRT: MOV TMOD,#20H ;Timer 1, mode 2
MOV IE,#90H ;enable serial interrupt
MOV TH1,#0FDH ;count for baud = 9600
MOV SCON,#50H ;serial commn. setup
SETB TR1 ;start Timer 1
HERE: SJMP HERE ;wait for receive interrupt
REX: JNB RI,EXIT ;go to EXIT if RI is not set
MOV A,SBUF ...