LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to update numeric indicator with digital input

Solved!
Go to solution

It is Point by Point.  The subVI has the abbreviations pt by pt in its title.

 

Use the search function on the block diagram palette to find it.

0 Kudos
Message 11 of 25
(1,581 Views)

You can try the following code.  It is reading from the array of booleans and incrementing the counter, if rising edge was detected.

 

Switch counter.png

 

Thanks,

Arev

 

CTO | RAFA Solutions

 

Certified-LabVIEW-Embedded-Systems-Developer_rgb.jpgCertified-LabVIEW-Architect_rgb.jpg

0 Kudos
Message 12 of 25
(1,549 Views)

Hi arev,

 

why use two boolean function when only one is needed?

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 13 of 25
(1,531 Views)

Hi GerdW

 

No any special logic. Just to better represent the idea of rising edge detection. The XOR logic detects the change, and AND logic makes sure to take only changes from False to True state (Rising edge).

 

Thanks,

Arev

 

CTO | RAFA Solutions

 

Certified-LabVIEW-Embedded-Systems-Developer_rgb.jpgCertified-LabVIEW-Architect_rgb.jpg

0 Kudos
Message 14 of 25
(1,519 Views)

Hi arev,

 

rising edge := current value==TRUE, previous value==FALSE.

So just use "current AND NOT(previous)"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 15 of 25
(1,509 Views)

Instead of a complicated compound node, it is easier to just place a simple comparison.

 

Here is code that counts false->true transitions.

 

 

 

(if the program starts while the signal is already true it will not count that because the transition occurred before the program start. If you want to treat that as a first transition, initialize the feedback node with a FALSE diagram constant instead. Modify as needed)

Download All
0 Kudos
Message 16 of 25
(1,481 Views)

One of the nice things in LabVIEW is the fact that you can easily make the code scalable to count several channels by using arrays.

 

Here's basically the same code that keeps count of 8 boolean transitions.

 

 

Download All
0 Kudos
Message 17 of 25
(1,460 Views)

Hi Altenbach,

 

Thanks for the sample code. It shows and works the way way I need it, however, I try to connect my USB-6501 to it and as you can see in the picture, the data does not match.

I had tried multiple ways to corrected. I am a bit slow learning this things. I appreciate your assistance.

 

 

Download All
0 Kudos
Message 18 of 25
(1,430 Views)

You have an array of booleans, so use "index array" to get one one specific element.

0 Kudos
Message 19 of 25
(1,415 Views)

Hi Altenbach, your sugestion worked, thanks a lot.

 

I have one last question before closing this discussion. I attempted to add a secondary switch, however, both signals (LEDs) and counter behave in the exact same way.

How can I have the counters be independant from each other? I also tried to add a png to this message, however, for some reason I am not able to, so I attached the code.

0 Kudos
Message 20 of 25
(1,386 Views)