|
|
View previous topic :: View next topic |
Author |
Message |
Flaviofrc
Joined: 04 Mar 2008 Posts: 7
|
Timer0 - PIC16F505 |
Posted: Tue Mar 04, 2008 11:07 am |
|
|
Hi people,
We have a problem using timer0 of this PIC, how can i use this timer?
For example, use to control port_b2 to send level hi and low ( led blink).
I think this PIC16F505 not have interrupt.
Thanks all. _________________ Flavio R. Caruso
www.stareletronics.com.br |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Mar 04, 2008 12:09 pm |
|
|
Quote: | I think this PIC16F505 not have interrupt. |
You have to poll it. You can read the value of the Timer register and
test it against some other value, with an if() statement. However, the
Timer clock runs from the instruction clock (if you don't use a prescaler).
Because your polling loop will take several instructions, the timer could
easily increment past the value that you are checking, while the PIC
is executing the loop code. Therefore, you should use a prescaler
of at least 16, and it's safer to use 32. Then the ASM code in your
polling loop can take up to 32 instructions, and you will still be able
to read and test the timer register every time it increments. You won't
miss any of the timer count values. You can look at the .LST file and
count the number of instruction cycles in your polling loop, to be certain
that it will work. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|