Department of Computer Scien
ce and Information Engineering
National Cheng Kung University
HANEL
PROGRAMMING THE SECOND SERIAL PORT
(cont’)
.....NEXT: MOV DPTR,#MESS2;
if SW1=1 display “Goodbye”
LN: CLR A
MOVC A,@A+DPTR
;read value
JZ S1
;check for end of line
ACALL SENDCOM2 ;send to serial portINC DPTR
;move to next value
SJM LN
SENDCOM1:
MOV SBUF,A ;
place value in buffer
HERE: JNB TI,HERE
;wait until transmitted
CLR TI ;clearRET
;------------SENDCOM2:
MOV SBUF1,A ;
place value in buffer
HERE1: JNB TI1,HERE1
;wait until transmitted
CLR TI1 ;clearRET
MESS1: DB “Hello”,0MESS2: DB “Goodbye”,0
END