0
6.9kviews
Write a program to generate a rectangular wave of 1 Khz, having a 25% duty cycle from the TxD pin of 8051, using timer1. Assume XTAL of 12Mhz.
1 Answer
0
769views
                   MOV TMOD, #10H               ; timer1 set in mode1
     UP:           MOV TL1,  #06H               ; load lower byte of count 
                   MOV TH1,  #0FFH              ; load upper byte of count 
                   SETB      P3.1               ; Display 1 at Txd pin 
                   MOV TCON, #40H               ; Program TCON
     ON:           JNB TCON.7, ON               
                   CLR       P3.1               ; Clear Txd pin 
                   MOV TCON, #00H               ; Stop timer 1
                   MOV TL1,  # 12H 
                   MOV TH1,  # 0FDH
                   MOV TCON, #40H
     OFF:          JNB TCON.7, OFF
                   MOV TCON, #00H
                   SJMP      UP
Please log in to add an answer.