Counting the amount of pulses

1 visualizzazione (ultimi 30 giorni)
Hans Vertongen
Hans Vertongen il 6 Apr 2016
Risposto: Debarati Banerjee il 11 Apr 2016
Hello,
I'm using a GUI to monitor a system. In this system there is an encoder that generates pulses if an engine (crankshaft) is turning. Now I need something that counts the amount of pulses that have been generated until another pulse (from another device) is given. So to be clear, there are two different channels of pulses.
Has anyone an idea of how I can do this?
With Regards Hans Vertongen

Risposte (1)

Debarati Banerjee
Debarati Banerjee il 11 Apr 2016
You can use the block 'Detect Rise Positive' to detect the rising edge of each pulse. You may set the output of this block to 'uint8' and use a 'Memory' blck to add and count the total number of pulses. This way you can count number of pulses in one channel (say A channel)
Next, you mentioned that you need to count the number of pulses in one channel (say,A) until one pulse in the other channel (say, B)is generated. To develop this system, you may put the former model in a 'Enabled Subsystem'/'Triggered Subsystem' depending on your use case and as the triggering signal you should use the channel B.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by