|
|
View previous topic :: View next topic |
Author |
Message |
John Guest
|
Newbie timer problem... |
Posted: Tue Dec 03, 2002 12:59 pm |
|
|
Hello experts!
I'm trying to get a 16F84 to count external pulses but it doesn't work even though it compiles ok with my PCM 2.686.
The idea was to start the timer, set it to 0 and wait for some ms as is counts and get the readout to a LCD. Then resetting it again and so on. The LCD routine is ok but I the timer doesn't seem to react?
I've connected the pulse source to Rb0 and set it as:
set_tris_b ( 0xF9 ); // 0b11111001
The main code looks something like this:
void main( void )
{
int count;
setup_counters(RTCC_EXT_L_TO_H, WDT_2304MS);
enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);
while(1)
{
set_rtcc(0);
delay_ms(100);
count=get_rtcc();
printf(LCD_PutChar,"\%3U",count);
delay_ms(500);
}
}
What am I doing wrong? I've looked for answers everywhere but to no avail. I don't use an ISR, is that necessary?
Thanks in advance!
/John
___________________________
This message was ported from CCS's old forum
Original Post ID: 9734 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: Newbie timer problem... |
Posted: Tue Dec 03, 2002 2:24 pm |
|
|
:=Hello experts!
:=I'm trying to get a 16F84 to count external pulses but it doesn't work even though it compiles ok with my PCM 2.686.
:=The idea was to start the timer, set it to 0 and wait for some ms as is counts and get the readout to a LCD. Then resetting it again and so on. The LCD routine is ok but I the timer doesn't seem to react?
---------------------------------------------------------
For an example of how to use the RTCC, see the CCS example
file, "EX_PULSE.C". This is in your C:\PICC\Examples folder.
Here is an example of how to use INT_EXT to count inputs on RB0.
<a href="http://www.pic-c.com/forum/general/posts/2138.html" TARGET="_blank">http://www.pic-c.com/forum/general/posts/2138.html</a>
___________________________
This message was ported from CCS's old forum
Original Post ID: 9740 |
|
|
John Guest
|
Re: Newbie timer problem... |
Posted: Wed Dec 04, 2002 3:22 pm |
|
|
:=:=Hello experts!
:=:=I'm trying to get a 16F84 to count external pulses but it doesn't work even though it compiles ok with my PCM 2.686.
:=:=The idea was to start the timer, set it to 0 and wait for some ms as is counts and get the readout to a LCD. Then resetting it again and so on. The LCD routine is ok but I the timer doesn't seem to react?
:=---------------------------------------------------------
:=
:=For an example of how to use the RTCC, see the CCS example
:=file, "EX_PULSE.C". This is in your C:\PICC\Examples folder.
:=
:=Here is an example of how to use INT_EXT to count inputs on RB0.
:= <a href="http://www.pic-c.com/forum/general/posts/2138.html" TARGET="_blank"> <a href="http://www.pic-c.com/forum/general/posts/2138.html" TARGET="_blank">http://www.pic-c.com/forum/general/posts/2138.html</a></a>
Thanks for the links even though I was hoping for a more "direct answer" of what I did wrong ;-) But finally I got it up and running!
Thanks again,
/John
___________________________
This message was ported from CCS's old forum
Original Post ID: 9780 |
|
|
|
|
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
|