; simple serial transmission
ORG 0H
SJMP 30H
ORG 30H
MOV TMOD,#20H ;timer 1; mode 2
MOV TH1,#-3 ;-3=FD loaded into TH1 for 9600 baud, 11.0592MHz
MOV SCON,#50H ;8-bit, 1 stop bit, REN enabled
SETB TR1 ;Start timer 1
AGAIN: MOV A,#'Y' ;transfer “Y”
ACALL TRANS
MOV A,#'E' ;transfer “E”
ACALL TRANS
MOV A,#'S' ;transfer “S”
ACALL TRANS
SJMP AGAIN
TRANS: MOV SBUF,A ;load SBUF
HERE: JNB TI,HERE ;Wait for last bit to transfer
CLR TI ;get ready for next byte
RET
END
Related topics:
8051 Program - logical operation | 8051 Program - parity generation | 8051 Program - polling an io pin | 8051 Program - port loopback | 8051 Program - send ascii to port | 8051 Program - serializing data | 8051 Program - memory subroutines | 8051 Program - math subroutines | 8051 Program - conversion subroutines
List of topics: 8051
No comments:
Post a Comment