LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timing out a port read

I am using a PCI-DIO-32HS to control a Fixture that in turn is controlled by a motor and a worm gear. The fixture is used in the 4 cardinal positions ( Up, Down, Left, Right ). Each position has an Optical Detector that detects a tiny gap in the motor end plate so that when the fixture is in the correct position, that specific output line goes high and I can read it using the port read function. Okay....After commanding the fixture to move, the VI drops into a while loop and scans the DIO port for the proper Optical detector outputs until it reads the correct pattern and immediately turns the drive off and locks the brake. That all works perfectly and is absolutely repeatable. My problem is that I also need to take into account that the motor fuse
might blow, or an obstruction of some type might stop the table from reaching position. I have tried to use timers and other things to no avail. What I need is basically something that will run concurrently with the while loop that will report an error or timeout if the fixture does not reach position within a certain amount of time. Otherwise, the VI will just sit there reading continuously forever. Any ideas ?? help?? comments??? I tried to use everything I could think of to do this to no avail.
0 Kudos
Message 1 of 3
(2,626 Views)
Find attached example and see if it fits your application details.

Hope I understood the problem
0 Kudos
Message 2 of 3
(2,626 Views)
Franco wrote:
> I am using a PCI-DIO-32HS to control a Fixture that in turn is
> controlled by a motor and a worm gear. The fixture is used in the 4
> cardinal positions ( Up, Down, Left, Right ). Each position has an
> Optical Detector that detects a tiny gap in the motor end plate so
> that when the fixture is in the correct position, that specific output
> line goes high and I can read it using the port read function.
> Okay....After commanding the fixture to move, the VI drops into a
> while loop and scans the DIO port for the proper Optical detector
> outputs until it reads the correct pattern and immediately turns the
> drive off and locks the brake. That all works perfectly and is
> absolutely repeatable. My problem is that I also need to take into
> account that the motor fuse might blow, or an obstruction of some type
> might stop the table from reaching position. I have tried to use
> timers and other things to no avail. What I need is basically
> something that will run concurrently with the while loop that will
> report an error or timeout if the fixture does not reach position
> within a certain amount of time. Otherwise, the VI will just sit there
> reading continuously forever. Any ideas ?? help?? comments??? I tried
> to use everything I could think of to do this to no avail.

You could read the current time outside the while loop; wire this into
the while loop so it acts as a reference time (maybe the "Tick Count
(ms)" or the "Get Date/Time In Seconds". Then Read the current time on
each iteration of the loop and compare, get the difference and if > than
a threshold time end the loop (combine with your existing end of loop
with some boolean logic logic. You could wire out a boolean signal from
the loop to warn of a timeout.

Or put a short delay in the loop and check the number of iterations on
the [i] terminal as he loop executes. The delay might have to be short
in case the motor goes past it's position before it is polled. Since it
is advisable to have some delay in most loops to stop them executing "to
the max" this would be my prefeered choice depending on the speed of the
motor.

There are probably many other solutions involving parallel loops etc. I
suppose you could even have some kind of watchdog sub vi; it all depends
how far you want to go.

Hope this helps you,

Regards,
Dave R.
0 Kudos
Message 3 of 3
(2,626 Views)