Quiz3Sec1Keys (2)
Quiz3Sec1Keys (2)
1. (70 pts) Write an Atmel AT89S52 main program that will generate a binary waveform at
P1.0 with frequency f = 2 kHz and duty cycle = 60%. Use timer 0 in Mode 2. Assume clock
frequency CF = 12 MHz and use a polling system (do not use interrupts)
Period=500 microsec
ON Time=500*0.6=300 microsec=2 x 150 microsec
OFF time = 200 microsec
Modd,#
t
MAIN: MOV TMOD,#02h
SETB TR0
BACK: JNB TF0,$
SETB P1.0
CLR TF0
MOV TH0,#106
JNB TF0,$
CLR TF0
MOV TH0,#56
JNB TF0,$
CLR P1.0
MOV TH0,#106
CLR TF0
SJMP BACK
END
2. (30 pts) Assume CF = 12 MHz , SCON configured in Mode 3 with TH1 set to 246 and
SMOD=0. What is the transmission time (back to back) of 100 characters using the serial
port? Show your calculations clearly.