Page 1 of 1

three separate counters

Posted: Sat Jun 04, 2011 2:25 am
by h1313
Is it possible to make a three separate counters using a pic (16fxxx) ?

Re: three separate counters

Posted: Sat Jun 04, 2011 12:22 pm
by h1313
As if i were asking about the possibility to make a vacuum tube based
pic (16fxx) ,16 ? what kind of filament voltage is that?
Hope that some one will answer.
The three counters have the same starting ,but each will stop according to a different
condition,as if you were measuring the time taken by three runners all have the same starting point ,speed but each one will stop according to different condition.

Re: three separate counters

Posted: Sat Jun 04, 2011 12:30 pm
by Spanish_dude
Yes it is possible to make 3 separate counters, which you can stop with an if statement like this:

Code: Select all

if (condition_1)
    counter1 = counter1 + 1;

if (condition_2)
    counter2 = counter2 + 1;

if (condition_3)
    counter3 = counter3 + 1;

//µs or ms delay
The condition1, 2 and 3 variables are defined by those conditions that will stop the counter.

Re: three separate counters

Posted: Sat Jun 04, 2011 1:18 pm
by h1313
Thank you for your reply.
If the codition signals (low =stop,high = keep counting) are introduced to three bits
of say portA should i scan those and if so how can that be made using flowcode.
The actual case is a three pulses all start at the same time but each has its own duration
which i should measure (the counting of each counter will represent pulse duration).

Re: three separate counters

Posted: Sat Jun 04, 2011 1:43 pm
by Spanish_dude
Use the input icon from Flowcode to read each input on PORTA and yes you'll need to scan them (called the "polling" method).