LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Check Digital Inputs over specified period

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.

0 Kudos
Message 1 of 10
(3,582 Views)

Hey bassinbc,

did you thought about an Event-Structure with Timeout set to your specified period?

 

Greets,

Brandizzl

0 Kudos
Message 2 of 10
(3,574 Views)

I am trying to get this by itself inside a timed loop.

0 Kudos
Message 3 of 10
(3,560 Views)

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

0 Kudos
Message 4 of 10
(3,553 Views)

@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).


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 5 of 10
(3,523 Views)

See other discussion about timers . Forum

0 Kudos
Message 6 of 10
(3,516 Views)

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.  

0 Kudos
Message 7 of 10
(3,507 Views)

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.

0 Kudos
Message 8 of 10
(3,439 Views)

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.

 

0 Kudos
Message 9 of 10
(3,399 Views)

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 

0 Kudos
Message 10 of 10
(3,359 Views)