LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I use an Event Structure to process an input signal from a DIO (6534). Without having to Poll the 6534?

I see that the Event Structure has a feature" Event Dynamic Registration/ <task out>:Signal"   which (I think) can take a Signal as an  input.
Am I understanding this correctly?
Anyway I'm not quite sure how to use it. The LV examples don't cover this.
Basically I'm trying to figure out if I can have a DIO card (6534) receive an input signal (trigger) and start a process in my
software. The usual way to do this is to put the DIO Read vi in a while loop and poll the card input.
Can I accomplish the same thing without polling by using the Event Structure?

Thanks for any insights


0 Kudos
Message 1 of 13
(5,299 Views)

Hi JPLEng

There are a couple of example programs in our Developer Zone that I think may be beneficial in helping you get started with your application.  One in particular incorporates digital input operations with the event structure in LabVIEW, much like you are trying to do.   The example is located here:   Digital Change Notification using NI-DAQmx and LabVIEW 8.0.  Here is a screenshot of the block diagram for this VI, just as a quick reference:

There is also another example that you may find useful for performing change detection, and it is located here:  NI-DAQmx: Digital Change Detection Using the 653x.

Hopefully these can get you started, but if you have any further questions please feel free to post back!

 

Message Edited by Jaime F on 10-12-2007 04:46 PM

Jaime Hoffiz
National Instruments
Product Expert
Download All
0 Kudos
Message 2 of 13
(5,280 Views)
Thanks Jaime:

Those were good suggestions. I got the Interupt one to work. But it seems very jittery.
The Event Structure though does not seem run properly. The code goes into the Event structure <task out> pane but does not move to the next pane even though it seems to do a proper Read/ change notification.
The way I figured it would work is the Read vi. would wait for a change, read it in and then be complete thus satisfying the Event Structure for this pane, until the next go around of the while loop. Then the
next pane of the structure should be exercised?
Did you get this work? What constitues a change condition? If I have pulse come in lets say 500us is that too short to trigger the change condition?


Thanks

Alex



0 Kudos
Message 3 of 13
(5,261 Views)

Hi Alex,

IRQ will probably be “jittery” just by the nature of interrupts.

Are you asking if when the <task out> pane finishes it then loops around to the timeout pane? The code will only execute either the <task out> or timeout event each time through the while loop. So you want to include whatever code you desire to execute inside the <task out> event pane.

It may not matter, but for completeness, please list what operating system (Windows 2000, XP, etc.) and what versions of LabVIEW, NI-DAQmx, Traditional NI-DAQ, and any other driver you are using. This can be done by opening Measurement & Automation Explorer (MAX), clicking on the Software tab, then each piece of software individually. The version is in the window on the right side.

P.S. A pulse of 500us is fine. I believe the minimum pulse width is ~10us.

Mark E.
Precision DC Product Support Engineer
National Instruments

0 Kudos
Message 4 of 13
(5,250 Views)
Hi Mark:

I'm asking if the DAQ Read.vi reads an input  (change condition) then that pane<task out> of the event structure(e.s.)  is satified/met and the e.s. moves to the next pane and waits for its event. Of coures assuming its not the timeout pane.
Make sense.
Seems my code just sits and waits at the Read.vi pane of the e.s.

I'm using LV 8.5, NI PXI-6534, Windows 2000.

Thanks

Alex
0 Kudos
Message 5 of 13
(5,219 Views)

All of your code inside the while loop continues to execute regardless of what happens inside the event structure. When the Event Registration Refnum detects a change, it sends a signal to the Event Dynamic Registration on the Event Structure, which fires the event "<task out>: Signal". Otherwise, you'll see the data sitting at the edge of the event structure without the event structure executing the code inside.

Mark E.
Precision DC Product Support Engineer
National Instruments

0 Kudos
Message 6 of 13
(5,196 Views)
Hi Mark:

Still not sure you understand my  problem.
I realize the While loop runs continously and the Event Structure is being executed. But for the E.S. to  move from one pane to the next. It must first satisy the condition for that pane.
For instance a boolean changes from one value to another and the E.S. then moves on to the next pane. If the boolean never changes the code would just sit there in that pane.
How do I satisfy this for a DAQ Read.vi/Change value.
Make sense???

Thanks for the support


Alex
0 Kudos
Message 7 of 13
(5,189 Views)

Hi JPLEng

First I would like to clarify when you say “move from one pane to the next” you refer to the event structure cases? Second the while loop is not going to run continuously the point of doing change detection is to avoid looping, the way it is going o work is that the “Even Structure” is going to sit and wait for the change in the line. I certainly was able to get to work but in a much simpler way, I did not try it with a 500 us clock I just did my self. 

A change conditions is a raising edge or a falling edge in the lines specified in “DAQmx Timing VI” (change detection).  The “Event Structure” has a time out set to 5 ms “blue constant” on the top left corner of the event structure change that to a larger value like 500ms, (play with the number).  The ways you can satisfy this is by setting the change detection to one line and make it generate an event only in the rising edge. Check the context help for the (DAQmx Timing VI with the change detection set.

Regards

Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 8 of 13
(5,163 Views)
I am also learning use of DER in digital channels for change detection and I have downlaoded the example mentioned and tried out with the Mseries PXI6225 card simulation but the problem is that the not dynamic event is getting registered. Does Dynamic event registration work with simulation by MAX also????????
0 Kudos
Message 9 of 13
(4,750 Views)

Hi Roni,


I would suggest taking a look at this article: Considerations for UsingI-DAQmx Simulated Devices. Simulated devices created in NI-DAQmx 7.4 - 8.1 do not simulate timing. Task reads and writes will be return immediately, in later version of the driver simulated devices do simulate timing.  Read and write operations will imulate the actual time they would take to complete as if they were being run in a physical device.  Simulated devices in all driver versions do not simulate triggering.  Triggers will return immediately.


I hope this helps, If you have any question please let me know.

Message Edited by Jaime F on 12-08-2008 11:28 AM
Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 10 of 13
(4,712 Views)