LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to create a latch

I am trying to create a latch for an LED, I want this LED to light on the first pulse and stay on from that point on.
A second thing I'm attemting is to write the date and time to a file, I only want the date/time to be written when a fault has occured how can I do this? I already have the date and time ready to be sent to a file.

I have been using LabView for about 24 hours now so please forgive me if these are simple questions.

Thanks
Ron
0 Kudos
Message 1 of 5
(4,832 Views)
(1) Use a shift register and a logical OR between the pulse and the previous output of the OR from a shift register.

(2) Place the "write to file" code inside a case structure, triggered by the fault state.

See very simpified code image.
Message 2 of 5
(4,832 Views)
Your code works except on each execution of the loop the shift register is still False, if I remove the initializing constant then it works but I have no way to reset it to false to simulate again, everytime I run the simulation it is True.

Not sure if I'm making any sense.
I'm attaching my code.

Ron
0 Kudos
Message 3 of 5
(4,832 Views)
Your indicator MUST be inside the while loop or it won't get updated until the while loop finishes. Check my sample again.
0 Kudos
Message 4 of 5
(4,832 Views)
OK, I understand what you are trying to do. Yes, you must leave the shift register uninitialized if you call the while loop multiple times and exit it immediately.

My code was meant to contain the shift register in the outermost loop of your program. To reduce clutter, you could also replace it with a feedback node.

With your coding style (This loop is inside the main loop, always exits immediately, and is only used to remember the fault state), you need to add a bit more logic, including a button to reset the state. (See image)
0 Kudos
Message 5 of 5
(4,832 Views)