02-01-2016 08:49 AM
I would like to check two digital inputs over a specified period and if both don't go true in this time frame then stop the loop. This would be inside a while loop that would stop if both inputs don't change states within that specified period. This should reset the time check and continue to run as long as both inputs change states within the specified time. I am using LabVIEW 2015.
02-01-2016 08:58 AM
Hey bassinbc,
did you thought about an Event-Structure with Timeout set to your specified period?
Greets,
Brandizzl
02-01-2016 09:21 AM
I am trying to get this by itself inside a timed loop.
02-01-2016 09:28 AM - last edited on 10-04-2024 05:31 PM by Content Cleaner
Ah sorry dude, I didn't know you are programming LV Realtime, where Event-Structures do not work!
Have you tried the Elapsed Time Express VI and check for time elapsed?
Elapsed Time Express VI - LabVIEW Help - National Instruments
https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/vi-lib/express/express-execution-control/e...
Greets
Brandizzl
02-01-2016 11:24 AM
@Brandizzl wrote:Ah sorry dude, I didn't know you are programming LV Realtime, where Event-Structures do not work!
Event structures do work on RT - you just can't use any events based on front panel elements - which pretty much limits you to user events and/or the timeout case.
I would probably store a timestamp / tick count on a shift register - when the inputs change states, reset the timer to the current timestamp/tick count. If, during any iteration of the loop, the current timestamp/tick count minus the value on the shift register is greater than your specified period - stop the loop (but if you're on RT, do you really want to stop the loop? Most RT applications are designed to run headlessly without a user interface).
02-01-2016 11:25 AM
See other discussion about timers . Forum
02-01-2016 11:36 AM
Thanks, I will try this. I am on realtime and don't have much experience with headless operation. I do want to run headless. This will be a safety monitor system that will need to issue an Digital Output (stop to a motor drive) in the event of an error. There are several digital inputs being checked in a Control loop. This input I am working on here is for the Air/Oil misting sytem for the electric motor. It needs to pulse the Air and Oil pressure switches every 15 or so seconds to verify I have oil and air pressure. So I thought I would have it in it's on timed loop. I thought that any error would cause an digital output (drive stop) to go true and would stop the loop. I would then cycle the power to reset the program. I would be able to see which digital input had the led lit and tell what the problem was before restarting.
02-03-2016 11:10 AM
I used the Reset_Iteration_Terminal in a timed loop and check that the Digital Input changed. That works well.
On another problem, I can't get the Digital Inputs to remain lit after the digital input is cleared. I thought putting the values into a cluster when an fault occured an then not updating the cluser when the fault is cleared would work but it isn't. I attached the code and in the false case I am not connected to the cluster. I attached a picture.
02-04-2016 04:52 PM
Hey bassinbc,
I created a mini VI to attempt to recreate what you're talking about. In mine the digital inputs remain lit (unless I change them manually, of course). Could you clarify further what exactly you're expecting from these inputs both when they are cleared and when a fault occurs?
-Will
P.S.- I attached a screenshot of the mini VI that I created to mimic yours. Let me know if it's not quite what you're getting at.
02-06-2016 05:44 AM - edited 02-06-2016 05:47 AM
sum your boolean with shift register method then if you want to check in regular loop number , use Quotient & Remainder Function that attached to i in loop with one case structure
if you want check with time use time tick count your result of shifregister should be 1 for stop and zero for continue