Question

Assume that XTAL = 4MHz, We are generating a square wave with a period of 4msec...

Assume that XTAL = 4MHz, We are generating a square wave with a period of 4msec on bit 0 of PORTC. Find the TMR0L, TMR0H value needed to generate this period. Using Timer0 in 16-bit mode, no prescaler mode

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer :- The period of wave is 4 ms. Thus for 50% duty cycle, the high time and low time are 2 ms. So timer must be programmed to give interrupt after 2 ms.

The value of timer frequency is-

4000000 H= 4000000 Hz ftimer

The time period value is-

Ttimer 4000000

Delay value needed is 2 ms. Thus the count value for the timer is-

2x10-3 n = - 8000 1 4000000

Thus the 16-bit representation of 8000 is-

8000=0001\_1111\_0100\_0000=0x1F40

Since timer over flows when reaches 0xFFFF, hence the timer value will be-

OXFFFF-Ox-20 = 0XF0BF

Hence the timer values are-

TMROH 0XEO, TMROL = 0XBF

Add a comment
Know the answer?
Add Answer to:
Assume that XTAL = 4MHz, We are generating a square wave with a period of 4msec...
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