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 timed while loop inside which I have the stop function for the other while loop?

Please feel free to suggest alternative methods (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 8
(3,676 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?opendocument

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?opendocument

Good luck with those event structures,

Andrew A
Applications Engineer
National Instruments
0 Kudos
Message 2 of 8
(3,679 Views)
Hi Andrew,

I think, LabVIEW doesn't support External I/O events. I am attaching the Screenshot found in the User Manual.

Ref: LabVIEW User Manual.

Thanks,
Ramkumar. D
Engineer,
QuEST, INDIA.
Thanks,
Ramkumar.D
QuEST, INDIA.
0 Kudos
Message 3 of 8
(3,591 Views)
Hi Ramkumar,

While LabVIEW itself may not be able to use external events to trigger code, external events can be use with data acquisition to trigger the start or end of a DAQ event. Here's a link to an application note that talks about how external triggering is used with DAQ and LabVIEW. I hope this information helps.

Thank you,
0 Kudos
Message 4 of 8
(3,571 Views)
Hi Michael,

Thanks for your response but don't find any link for the application note that you have talked about. It will be useful for me if you send that link.

Thanks,
Ramkumar. D
QuEST, INDIA.
Thanks,
Ramkumar.D
QuEST, INDIA.
0 Kudos
Message 5 of 8
(3,565 Views)
Hi Ramkumar,

Sorry about the omission. Here's the link:

http://zone.ni.com/devzone/conceptd.nsf/webmain/2a03115556fb233386256870005bb522

Have a great day,
0 Kudos
Message 6 of 8
(3,556 Views)
Hi Michael,

Thanks. I agree with you.

Previous Mr. Andrew had mentioned about using event structures to trigger events based on External DIO. But according to the Screenshot of the User manual I previously attached, LabVIEW Event Structures donot support External Input output events.

Thanks,
Ramkumar. D
QuEST, INDIA.
Thanks,
Ramkumar.D
QuEST, INDIA.
0 Kudos
Message 7 of 8
(3,545 Views)
Hi Ramkumar,

External DIO can control a boolean control, which then can control an event structure through a value change. I have attached a screenshot of this to illustrate this.
0 Kudos
Message 8 of 8
(3,533 Views)