Page 1 of 1

Counter

Posted: Sat Oct 26, 2013 3:56 am
by JFinlayson
I am looking to set up inputs from sensors producing pulses between 3 and 3000/sec.
However I cant seem to find an easy way in Flowcode to set timer 0 and timer 3 as counters usingT0CKI and T13CKI and a 1second interupt. read values and reset.
Is there a Counter function in Flowcode 6? If not does it mean I have to make my own component?

Re: Counter

Posted: Sun Oct 27, 2013 10:02 pm
by JonnyW
Hello. Maybe it is my lack of knowledge in this area, but can you give more details of what you are after?

If you require interrupts to be set up to sample a sensor on a timeslice, there is no direct facility to do this, but it should be easy enough to do in Flowcode. You could write a component to do this, true, but this would only be much use if you were to re-use the code in multiple projects.

The more info the more we can help - how does the program decide what gap between the samples, etc?

Jonny

Re: Counter

Posted: Thu Oct 31, 2013 3:48 am
by JFinlayson
Sorry for delay,

I require pulses from two sensors to be counted, 2 16bit counters would do the job, As I require can output I have chosen the 18F2680 which has four timers. 2 of the timers can be set as 16 bit counters on pins T0CKI and T3CKI, and use timer 2 for 1 second interupts to read both counters.I am not sure wether to put an RTC chip for the one second interupt or set timer2.

But a counter component would be handy for a lot of applications.

:?:

Re: Counter

Posted: Thu Oct 31, 2013 11:35 am
by Benj
Hello,

This example program might be useful.
http://www.matrixmultimedia.com/mmforum ... 974#p37282

We could potentially make a counter component or something along these lines in v6 as your right it would be handy. I'll add it to the list.