LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a transition-on for discrete i/o

Hi.  I am reading discrete I/O and holding registers from a PLC.  Each time a bit turns on, I want to take the readings from the registers only once.  So I only grab the values of the holding registers when the discrete I/O turns on.  Even though this bit might stay on for a few seconds, I want the values only once.  Is there an easy way to do this?
 
Thanks in advance!
Ron Deavers, CLD
0 Kudos
Message 1 of 4
(2,756 Views)
Sounds like a case for the Boolean crossing ptbypt.vi and case structure or an event structure and the Value signaling property.
0 Kudos
Message 2 of 4
(2,741 Views)
Boolean Crossing ptbypt.vi would be a great solution, but is not in the base package of LabVIEW.  It is in the Full Development and Professional Development packages.

One option for us might be to have a loop that reads all the bits, and a boolean for each bit value.  When the bit is turned on, we check the associated boolean.  The associated boolean tells us if we just read from the bit.  So on the first iteration, if we have any bits on, we'll read from that bit once, then turn the boolean to true.

Then when the second iteration happens, if the bit is still on, we skip the read.  If the bit is off, then set the associated boolean to false.

Any more information about your application would surely help if these directions are unclear!  Hope it helps!
TheDillo
0 Kudos
Message 3 of 4
(2,726 Views)
Thank you for your help.  I was able to do something close to TheDillo suggested.  Everytime I read the incoming bit and it is true, I increase an iteration number.  I only do my calculations on the first iteration.  When the bit becomes false, I reset the iteration.
Ron Deavers, CLD
0 Kudos
Message 4 of 4
(2,720 Views)