"While " loop

Started by ramtec73 March 5, 2004
I am currently using PicBasic Pro.
Does anyone know how to do a WHILE statement using a time as a

For example,

I am using a COUNT PORTA.4,1000,counts

Now this should read pulses that are coming into that PORT and stores
it to counts for 1 sec period.

So, what should I actually do if I want to
1. Read the pulse that is coming in
2. Increament a counter when for each "high" signal is presented
3. Keep doing 1 and 2 for 1 second
4. Store that counter value to different location say "pulse"
5. Clear the counter
6. Start from 1 again
I understand that COUNT PORTA.4,1000,counts looks like it is doing
the same thing but this instruction is keeping count of how many
pulse have been generated on that pin. But I want to increament a
counter every high the pin sees rather than storing each pulse
in 'counts'.

I guess I should clear 'counts' every loop it does for 1 second?
Because I want to sent a 1 count to the location "pulse"

Here is rest of the program. I am using *877A.

loop: counts=0
Count PORTA.4,1000,counts
LCDout $fe,1
LCDout rpm
goto loop