Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Daqmx Events - PCIe-6251

Hi,

 

I'm trying to use a signal event to trigger a loop.  The idea is that the program (attached) triggers my device which has a "trigger output" which goes high while the triggered operation is in progress and low when it finishes.  I want to detect the falling edge on PFI0 (which is the same line used for the pause trigger) and have the program send the next command and trigger via GPIB to the device.  Using the "Sample Clock" parameter when registering for Signal events clearly doesn't wait for PFI0 -> low and using "Change Detection Event" produces the error which says "Measurements: DAQmx Signal Event type requested is not supported by the channel types or the devices in your task.  DAQmx Signal events include the Counter Output event, the Sample Complete Event, the Sample Clock Event, and the Digital Change Detection event. Refer to product documentation for more details on which DAQmx Signal Events are supported by the channel types and devices in your task."

 

Can anyone tell me what I'm doing wrong?  The DAQ card is a PCIe-6251 which, as far as I can tell, should support the Change Detection Event type.  I have also thought of using a timed loop to implement this function but have no experience using timed loops and am not sure which solution is more appropriate.

 

Cheers,
Glen

Message Edited by GlenS on 05-25-2009 02:07 AM
0 Kudos
Message 1 of 6
(4,001 Views)

Hi Glen,

 

From your program, it looks like you are attemtping to use change detection on an analog input channel.  For the M Series devices like the PCIe-6259, change detection is only supported on Port 0, which is a digital line.  If you want to trigger from an analog event, I would suggest analog triggering.  There is an analog trigger example in the NI Example Finder, located at Help » Find Examples.  Once you are in the example finder, you can click on the Browse tab in the top left, then click Hardware Input and Output » DAQmx » Analog Measurements » Voltage » Acq&Graph Voltage-Int Clk-HW Trig Restarts.vi.

Regards,
Jim Schwartz
0 Kudos
Message 2 of 6
(3,982 Views)

Hi Jim,

 

Thanks for the help.  I've implemented your suggestion (see attached) using PFI0 as the trigger channel.   Everything seems to work fine except that an error is produced by whichever DAQmx task gets to the 'start' stage last.  The error is -50103, which is "this resource is already reserved".  I'm assuming the reserved resource is PFI0 and that LabVIEW doesn't like me trying to use the same trigger channel for two different tasks.  Is there a way around this?

 

Cheers,
Glen

0 Kudos
Message 3 of 6
(3,972 Views)

Hi Glen,

 

You are seeing Error -50103 because you have two AI tasks running at the same time. For causes of the -50103 error, please read the Knowledgebase linked here.  The reason you can't run two AI tasks at the same time is because your M Series DAQ cards only have one AI timing engine.  You must stop and clear your first AI task before you can start your next AI task. You can add multiple channels to a single AI task by selecting Browse from the drop-down menu of your channel selector control then holding shift while you select multiple channels as seen below.

 

multiple_ch_select.JPG

Regards,
Jim Schwartz
0 Kudos
Message 4 of 6
(3,958 Views)

Hi Jim,

 

Okay, I'm getting nowhere with this.  I think the method to use is the event registration system with the pause trigger.  I have stripped the program back to to only what works (attached) and put the event registration function in.  What I need now is a way for an event to be generated every time the pause trigger stops the AI task.  It appears that there is no way to do this using the common LabVIEW functions (though I hope I'm wrong).  Can you suggest a method by which I might generate this event?  Is there a website or forum or something where I can find out more about how I much achieve this aim (i.e. do I need to extend LabVIEW somehow)?

0 Kudos
Message 5 of 6
(3,949 Views)

Hi Glen,

 

You can have digital and analog tasks together in the same VI. This will allow you to perform an action within a case structure if your line goes high. Basically, you will poll your digital line and only perform a task when the line goes high.  I have attached an example that I hope will illustrate this concept.

 

 

Regards,
Jim Schwartz
0 Kudos
Message 6 of 6
(3,934 Views)