Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Using digital signals to control program flow

Hi!

We have an application wherein signals from limit switches and optoswitches need to be used to control program flow.

As an example, we are doing serial read/write inside a timed while loop. We wish to stop this loop when there is activity from my limit switch. The limit switch gives a TTL signal.

How do I achieve this?

I cannot continuously poll the DI pins because that takes CPU time and might affect my timed loop which needs to run at the speed of a few miliseconds per iteration.

Can I use this digital signal from my limit switch to initiate a second timed while loop inside which I have the stop function for first timed while loop (having serial read/write)?

Please feel free to suggest alternative met
hods (fastest method is best).

We are using LV 7.1 and hardware is PXI chassis with 6025 daq board and 8423 serial board. OS is Win2000

Thanks and looking forward to some quick solution.

- Gurdas
Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 1 of 2
(2,194 Views)
Hi Gurdas,

You are correct that polling is CPU intensive and not an ideal solution.


Instead, look into using event structures to trigger events based on your DIO.


Here's a good starting point:


"Event-Driven Programming in LabVIEW"
http://zone.ni.com/devzone/conceptd.nsf/ webmain/ E5F8474BDA20C97786256B5A0066968B?opendoc ument


There is also a good application note on general programming techniques to optimize performance.


"LabVIEW Performance and Memory Management"
http://zone.ni.com/devzone/conceptd.nsf/ webmain/ 732CEC772AA4FBE586256A37005541D3?opendoc ument


Good luck with those event structures,


Andrew A
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(2,194 Views)