01-04-2016 08:08 AM
I am working on a test sequence in LabVIEW. I have a safety relay whose status I am monitoring with a digital input, and I'd like to transition to my fail state I'm in an e-stop condition. (In my case, this happens when a light curtain is broken or e-stop push-button is pressed).
This would be easy to do if I could use a digital input to trigger an event. However, this doesn't seem to be possible. I tried tying my digital input to a control and then monitoring the state of that control as an event, but that didn't seem to work.
My main issue is that I can be in one of the test steps for 5 seconds or so. So far, I haven't figured out a way to break out or interrupt this step if my digital input changes state. I can get it to transition to the fail state after the current step, but I would like it to transition immediately when the safety relay is broken.
I am attaching an image that shows the basic structure of my program. The actual program is much more complicated, so hopefully this is enough information to get started. I have the stops in each loop tied together using a sub-vi that basically outputs a boolean TRUE if the "stop" button is pressed on the operator interface (this is one of the events in my event structure).
This seems like it would be a common enough situation that there must be some answer I'm missing. Can anyone help out? Thanks in advance...
Solved! Go to Solution.
01-04-2016 08:29 AM
You need (somewhere) a loop that monitors the Digital State and can detect the Fail transition. The timing of this "monitoring" loop will govern how fast you can respond to the Failure.
But now you need to raise an Event when this happens. When I started programming in LabVIEW, I learned about Value Signalling Events which could programmatically raise a Value Changed flag. However, a few years later I learned about User Events, a more flexible method for generating "Software Interrupts" that have a number of advantages over Value Signalling.
I'm sure if you look in LabVIEW Help and/or LabVIEW Examples for User Events you will find a good explanation for how to use these (use the Help Index and type User).
Bob Schor
01-04-2016 08:34 AM
I think what I tried before was the value signaling event. I placed an indicator in the same loop as the one where I'm reading digital I/O, the bottom loop in my diagram. This would allow me to respond in 100 ms, which would be sufficient. I tried to use the value change flag as an event. However, I wasn't able to get it to work. Unfortunately, I don't remember the challenges I encountered - it was a while ago that I tried it.
I'll look into user events. Thanks for the tip!
01-04-2016 11:13 AM - edited 01-04-2016 11:17 AM
What are you using for your digital inputs/outputs? DAQmx supports raising events on signal change detection which you could use with your digital input to generate an event without polling. Look in the DAQmx -> Advanced -> DAQmx Events palette. It might be specific to certain DAQmx hardware...
There's an example here: http://www.ni.com/example/25317/en/
I think you can also do something similar with timed loops and triggering.
01-04-2016 01:08 PM
It is a PXI-6528.
Thank you both! Very helpful information.
01-05-2016 09:54 AM
If it is not responding fast enough, then you need to break your steps into shorter chunks. Say you have 1 step right now that you do over and over: [Apply Setting and Take Reading]. Maybe you need to need to break it up into more steps, so that your stop has more chances to interrupt. You can Apply Setting -> Check E-stop -> Take Reading -> Check E-stop. If you cannot do this, you will have to be able to control your test equipment (the one you want shut down) from a different loop that is not locked up doing a test.