Counting the amount of pulses

2 views (last 30 days)
Hans Vertongen
Hans Vertongen on 6 Apr 2016
Answered: Debarati Banerjee on 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

Answers (1)

Debarati Banerjee
Debarati Banerjee on 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!