Fast pulse counter

Hello everyone,
I am thinking about (relatively) fast pulse counter. I would like to get exact counter value when external pulse occurs. For clarification, i do not need to process the value in short time, i need catch actual value of counter with minimum delay. It is possible? Should I use HW timer/counter for this? What board could be used?
-Max input frequency will be relatively low - 333Hz (3ms).
Thanks!

Is the SignalCapture class what your looking for. Look under Support->documents for more info.

IMHO this is not the solution.

What i need, is count pulses (freq. 0-333Hz) all the time and react on external trigger to store current value of still running counter.

Reaction time should be 2-3ms max. I have read about RLP or DL40 Module… Which way to go? Thaks!

@ Adam - why not use https://www.ghielectronics.com/catalog/product/465

1 Like

Ok and what about trigger reaction speed? :slight_smile: Is there any example code? Should I use RLP?

If you need anything real time then RLP maybe an option but in general NETMF is not real time. You can use interrupts and handle things separately. Sometimes adding a little $1 micro for tight timing is the way to go.

I do not know the details about your project or what experience you have so ti is hard ot give a good answer.

I am newbie here and I am not native speaker, so it is little bit difficult for me to explain my project in depth.
Anyway I am pretty sure that there is solution for me…
Netmf can’t handle interrupt in deterministic way so time critical tasks should be propagated to coprocessor or native code running under the netmf.
My question is:
How to get current counter value on external pulse without negative impact of non deterministic nature of netmf? Can you suggest a solution? I need fast mechanism to retain counter value at time as external pulse occurs. Thats all. Reading that value can be realized on managed side with no rush.
Please kick me to the right direction. :slight_smile:

I apologize for the stupid questions.

@ Adam - It sounds like you’re doing velocity measurement using an encoder? Just a guess. Anyhow, you can probably also use Timer/Counter registers. It will require a lot of digging deep into the datasheet for the processor that you’re using. After you’ve figured out which registers to use, it’s fairly easy to access them from within NETMF.

@ Adam - Use the module that @ Gus mentioned above.

It is a hardware pulse counter that allows for millions of pulses per second to be captured.

When required from the NETMF side you use the supplied driver to query the module via SPI for the current count. Since this is a specialised hardware counter you wont miss any pulses.

1 Like

@ adam - I also recommend using the pulse count module. It is a nice piece of hardware and I have used it for project that needed pulse counting.

Ok let’s say I will use Pulse Count Module.

Now, I am thinking about code:
RLP side:

  1. Listen on GPIO pin where external pulse occurs.
  2. If pulse occurs, interrupt current processing and read current counter value from module via SPI.
  3. Post event with counter value to be able do some stuff on managed side.
    Managed side:
  4. Subscribe to event coming from RLP side.
  5. Process counter value.

Correct reasoning? Thank you

I have used the pulse count module connected to flow rate sensor, where in the managed code I set up timed event to read the count value from the module and then using the elapsed period, pulse count and flow rate sensor constant calculated the flow rate.

The link below helped me get everything working.

https://www.ghielectronics.com/community/forum/topic?id=13859

I did not use RPL code and have no experience using RPL code. Hopefully someone with RPL experience can comment.