LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Counting rising edges from digital signal (waveform)

Hello all,

 

I have question about counting rising edges in digital signal (waveform). I use NI VB-8012 hardware (Virtual Bench). Where I have connected the absolute rotary encoder 10 bits with parallel interface (10 wires with digital signals) where I use the function "Logic analyzer" (link for VB-8012 datasheet is here: https://www.ni.com/pdf/manuals/371527d.pdf). I could saw the signals from encoder in digital waveform graph, but I would like to count the RPM with method counting rising edges for 1 digital signal for 1 second and then multiply the number of rising edges to 60 and I got the RPM. I would like use the bit MSB (D9) which has got 2^0 = 1 rising edge for 1 revolution (1 turn). I tried to convert the MSB digital signal to boolean 2D array -> then convert it to digital signal then to analog waveform and use "wavefrom peak detection" but this method does not worked for counting rising edges or (peaks). Here is attached how the signal in digital waveform graph looks like - the bit MSB is D9 signal.

 

Thank you for your help.

 

image.pngimage.png

 

0 Kudos
Message 1 of 2
(1,404 Views)

I don't fiddle with digital waveforms much so I'm unsure how the 2D array gets laid out.  If analogous to AI tasks, each row will be a bunch of samples for 1 specific digital line and each column will represent 1 sample each for all the digital lines in the task.

 

But either way, part of your problem is that you threw away most of your data by calling Index Array twice.  The first call extracts the entire row 0, which I'm supposing will be all the samples of one of your digital lines (not sure offhand if it'll be your LSB or MSB though).

 

The next time you call Index Array, you're extracting 2 individual samples out of that entire row.  Then you build those back up into an array and waveform again?!?

 

Have you tried using debug probes on the various wires to see what's happening to your data at each step in the process?  That should be your first step and a regular habit.

 

Here's what you could do once you get your 1D array of MSB booleans:

 

count boolean edges.png

 

I kept the indices where the MSB rising edges occurred because they (combined with the sample rate of the digital data) can provide further info about rotation speed.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 2
(1,370 Views)