Write an 8051 program to generate a 50 KHz square wave of 50

Write an 8051 program to generate a 50 KHz square wave of 50% duty cycle on P0.2. Assume the operating frequency for the microcontroller is 12 MHz. Verify your program by running it on the lab-center simulator tool. For this question, submit the following: The design file The assembly file

Solution

MOV P1,#00000000B

MOV TMOD,#00000001B

MAIN:SETB P.0

ACALL DELAY

CLR P1.0

ACALL DELAY

SJMP MAIN

DELAY:MOV TH0,#0FFH

MOV TL0,#0CEH

SETB TR0

HERE:JNB TF0,HERE

CLR TR0

CLR TF0

SETB P1.0

RET

END

 Write an 8051 program to generate a 50 KHz square wave of 50% duty cycle on P0.2. Assume the operating frequency for the microcontroller is 12 MHz. Verify your

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site