PDA

View Full Version : flashing a led with TMR0



ely
- 19th June 2004, 09:29
Hello everybody

I want to flash a led all the seconds I would like to use the TMRO and the prescaler at 256 and a routine of interruption browsed 8 x
With one 16f84 4 Mhz
Can you help me?

TONIGALEA
- 20th June 2004, 14:59
i couldn't really figure out what you want to do.
could you kindly break it down..
do you want to flash an led once a second ?
Not quite sure what you want


Toni

ely
- 21st June 2004, 18:57
Hello Toni

The purpose:
to flash an led once a second--> temporization of 500 ms
By using the TMR0 and the prescaler configured in 256

calculation:
if my PIC run 4 Mhz
An interruption--> all 256 us

prescaler configured in 256
An interruption--> all 256*256=65536 us

I must use a interrupt routine
500000/65536=7.63-->8X


sorry for my poor englich

Melanie
- 21st June 2004, 21:41
Did somebody set this as Homework?

I'm not getting involved in this thread, other than to say would it not be more sensible to consider using TMR1 prescaled by 8 and preloaded with $0BDC? I'll let you figure the maths and the rest from the Datasheet...