pic counting
pic counting
Can anyone tell me how to count input pulses with a pic 16F84 using pic basic and read the number of pulses on the output?
Re: pic counting
Which Pic basic? There are many of them out there.<p>In general, you could use the RTCC input (RA3) everytime this input receives either a high or a low (you choose) you can then increment a variable.<p>Colin
On a clear disk you can seek forever.
Re: pic counting
Hello Colin,
The PicBasic Compiler I am using is from Micro Engineering Labs, Inc. There is no version number. I am just curious as to where the count is stored when using RA4 and how you would you move the count to the output. Lets keep it simple by counting pulses between 1 and 10.
I know that you have to preset the "itcon" and "option" registers. How do you accumulate the count?<p>Ray
The PicBasic Compiler I am using is from Micro Engineering Labs, Inc. There is no version number. I am just curious as to where the count is stored when using RA4 and how you would you move the count to the output. Lets keep it simple by counting pulses between 1 and 10.
I know that you have to preset the "itcon" and "option" registers. How do you accumulate the count?<p>Ray
Re: pic counting
You have to store the count in a variable you define. wait for the pin to transition high, then wait for it transition low (one full cycle) and add one to your count variable.<p>[ March 02, 2005: Message edited by: philba ]</p>
Re: pic counting
would this statement work?<p>If Tock=1 then count=count+1<p>Ray
Re: pic counting
It depends. is it in a loop? You need to see the transition from 1 to 0 (or 0 to 1) to get an accurate count. That's why I suggested wait for a 0, then wait for a 1 and then increment count (and start over for the next pulse).<p>Draw a waveform on a piece of paper and look at it. Think about at what points you want increment your count. Think sequentially.
Who is online
Users browsing this forum: No registered users and 1 guest