From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger line usage on the cDAQ-9181 with a cRIO-9401 module

Solved!
Go to solution

 I'm trying to accomplish something very simple with cDAQ-9181 and the cRIO-9401 hardware: when a trigger occurs, wait 20 ms and then set some digital output lines. Reading through the documentation for the cDAQ-9181 and the cRIO-9401, I see that there is a PFI0 trigger; I don't see a physical input for that, so I assume it is implemented internally in some way. I tried using a digital input as a trigger, but I get error -200524 with my code. I have looked though the examples, but I don't see how to do it with my hardware. Please help. Thank you. See attached png for the block diagram.

0 Kudos
Message 1 of 14
(3,993 Views)

I believe you selected DAQmx Write (Digital 1D Bool NChan 1Samp 1Line). You have more than 1 line and just one channel so you need to pick DAQmx Write (Digital 1D Bool 1Chan 1Samp).vi

0 Kudos
Message 2 of 14
(3,985 Views)

Thank you for the response. It sounds like a single digital line input can trigger only a single digital line output. I have re-written the code to have individual references for each digital output (see attached). Does this look like a reasonable approach? Do I need to configure the triggering line as a digital input?

Your assistance is much appreciated.

0 Kudos
Message 3 of 14
(3,954 Views)

I'm not sure that will work. If you run into trouble it might be because, if you put a physical resource (line) in multiple tasks as you are doing below, the second "create task" will fail because the physical resource is already in use.

 

Did you try DAQmx Write (Digital 1D Bool 1Chan 1Samp).vi that sort of sounds like what you are looking for. You might need a little application logic to software time the delays.

0 Kudos
Message 4 of 14
(3,933 Views)

Using just 1 sample/1 channel gives me Error -200262.

 

DAQmx Start Task.vi

Property:

Start.Trig type 

Corresponding Value:

Digital Edge

Property:

SampTimingType

Corresponding Value:

On Demand

 

Looks like maybe I can't just wire a digital line to the trigger input. Any ideas on how to implement the trigger input?

Thank you for any assistance you can offer.

0 Kudos
Message 5 of 14
(3,923 Views)

Just saw your posting at 12:44 pm. I will try this. Thank you.

0 Kudos
Message 6 of 14
(3,921 Views)

I tried using DAQmx Write (Digital 1D Bool 1Chan 1Samp).vi utility, but I get the following error:

 

Error code: -200524

 

Number of channels in task: 1

Number of channels in data: 4

 

See attachment for code. Sorry this is turning into such an issue, I thought it would be fairly straightforward.

 

0 Kudos
Message 7 of 14
(3,893 Views)

Hi Chris_12345,

 

DAQmx Create Channel has an input called 'line grouping', which you can use to specify how you'd like your data to be written with respect to lines; right click that and select Create -> Constant. On the constant that appears on your block diagram, make sure 'one channel for all lines' is selected. This should ensure that LabVIEW associates each boolean value in your 1D array with the proper line.

Tom D.
Staff Software Engineer
NI
0 Kudos
Message 8 of 14
(3,854 Views)

Tom,

Thank you for your response. I wired the constant 'one channel for all lines' to DAQmx Create Channel. This was the default value, so I think this would not have any effect. Do you have any other suggestions?

Chris

 

Download All
0 Kudos
Message 9 of 14
(3,823 Views)

Hi Chris,

 

Just for clarification--you are also receiving error -200254 for when using DAQmx Write (Digital 1D Bool NChan 1Samp).vi? Is the error the same in that case (i.e. does it still indicate 1 channel in the task and 4 channels in the data)?

Tom D.
Staff Software Engineer
NI
0 Kudos
Message 10 of 14
(3,783 Views)