0
72kviews
Program timer 1 of 8051 to generate 1 KHz square wave on P2.1 using mode 1. Assume crystal frequency to 12 MHz.
1 Answer
2
6.9kviews

frequency = 1KHz

1 pulse = 1/1KHz = 1 msec

500 μsec ON time and 500 μsec OFF line.

Crystal Frequency = 12MHz

1 clock pulse = 1μsec.

Count = 500μsec/1μsec = 500

Counter initial value = 65536 - 500 = 65036 = FE0C

TMOD

Gate C/T M1 M0 Gate C/T M1 M0
0 0 0 0 0 0 0 1

IE

EA - - ES ET1 EX1 ET0 EX0
1 0 0 0 0 00 1 0

PROGRAM :

enter image description here

Please log in to add an answer.