Question 4
a. An 8051 microcontroller is equipped with an on-chip serial port for communication with external devices using UART.
i. Draw a block diagram to describe the hardware connection to make the RS232 compatible with the 8051 microcontroller. Briefly explain your block diagram. [2 marks]
ii. Complete an instruction sequence in Figure Q4(a) to initialize the on-chip serial port to Mode 1 with a baud rate of 19200 (with SMOD = 1) to transmit a character "H" serially and continuously. Use Timer 1 in Mode 2 with an oscillator frequency of 11.0592 MHz. [5 marks]
; Mode of serial port: ; 19200 Baud Rate, TH1
(show calculation)
ORG 0000H
ORL PCON,
MOV SCON,
MOV TMOD,
MOV SETB
AGAIN:
MOV #H
HERE:
JNB TI
CLR TI
SJMP AGAIN
; SMOD = 1 DOUBLE BAUD RATE ; ; ; 19200 BAUD
Figure Q4(a)
MSI/HAK
4/11
ECE2216
MICROCONTROLLER AND MICROPROCESSOR SYSTEMS
23 OCTOBER 2020
iii. Write a subroutine called Msg_sent to transmit the string "Yes" serially via UART. [5 marks]