Question

8. Program Timer O in C to generate a square wave of 0.5 KHz. Assume that XTAL 11.0592 MHz #include sbit mybit P1A5; void delay (void); void main (void) while (1) ( mybit - delay(0): void delay (void) TMOD TLO = THO TRO = 1; while (ITFO); TFO = 0;
0 0
Add a comment Improve this question Transcribed image text
Answer #1

XTAL = 11.0592 MHz ; the counter counts up for each 1.085 us.So,in order to make a square wave of 0.5 Khz i.e 2 ms flipping period.

We need 2 ms/1.085 us = 1843 clocks.To acheive this many clocks; we need to load values into TL and TH :-

65536 - 1843 = F8CDH .So, TH = F8 and TL = CD

Program :-

#include<reg51.h>

sbit mybit = P1^5;

void delay(void);

void main(void){

while(1){

mybit=~mybit;

delay();

}

}

void delay(void){

TMOD = 01;

TL0 = 205;

TH0 = 248;

TR0 = 1;

while(!TF0);

TR0=0;

TF0=0;

}

Add a comment
Know the answer?
Add Answer to:
8. Program Timer O in C to generate a square wave of 0.5 KHz. Assume that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT