a) Assume that XTAL = 11.0592 MHz for the following program,
state (a) what this program does, (b) compute the frequency
used by timer 1 to set the baud rate, and (c) find the baud rate of
the data transfer.
MOV A, PCON
MOV ACC.7
MOV PCON, A
MOV TMOD, #20H
MOV TH1,-3
MOV SCON, #50H
;A=PCON
;make D7=1
;SMOD=1, double baud rate
;with same XTAL freq.
;timer 1, mode 2
;19200 (57600/3 =19200)
;8-bit data, 1 stop bit, RI
;enabled
SETB TR1
;start timer 1
MOV A, #"B"
;transfer letter B
A_1: CLR TI
;make sure TI=0
MOV SBUF,A
;transfer it
H_1: JNB TI, H_1
;stay here until the last
;bit is gone
SJMP A_1
;keep sending "B" again
b) Write a program using interrupts to do the following:
1) Receive data serially and sent it to P0,
2) Have P1 port read and transmitted serially, and a copy given
to P2.
3) Make timer 0 generate a square wave of 5kHz frequency on
P0.1. Assume that XTAL=11,0592. Set the baud rate at 4800.