three separate counters

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
h1313
Posts: 3
Joined: Sat Jun 04, 2011 2:15 am

three separate counters

Post by h1313 »

Is it possible to make a three separate counters using a pic (16fxxx) ?

h1313
Posts: 3
Joined: Sat Jun 04, 2011 2:15 am

Re: three separate counters

Post 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.

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times

Re: three separate counters

Post 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.

h1313
Posts: 3
Joined: Sat Jun 04, 2011 2:15 am

Re: three separate counters

Post 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).

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times

Re: three separate counters

Post 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).

Post Reply