LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger a digital TTL output

Solved!
Go to solution

I am simply trying to output a TTL from DIO4 in my 9401 which will happen after a trigger is detected in DIO0 in the same module. It is not working and I don't know why. I get this error: 

 

Possible reason(s):

Specified read or write operation failed, because the number of lines in the data for a channel does not match the number of lines in the channel.
If you are using the Digital Waveform datatype, make sure the number of lines in the digital waveform matches the number of lines in the channel. If you are using boolean data, make sure the array dimension for lines in the data matches the number of lines in the channel.

Number of Lines in Channel: 1
Number of Lines in Data: 0

Task Name: _unnamedTask<0>

 

The 9401 module is connected to a cDAQ-9189 chassis. Any help would be appreciated, thank you.

0 Kudos
Message 1 of 16
(1,185 Views)

Please post your code so that we can understand what's going wrong.

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 2 of 16
(1,173 Views)

Woops I thought I did, here it is now.

0 Kudos
Message 3 of 16
(1,165 Views)

I would also like to note that I have gotten this to work within the DAQ assist's UI so I am having trouble translating it to DAQmx tasks. I have tried converting my DAQ assist to code and I was still confused.

0 Kudos
Message 4 of 16
(1,115 Views)

Update on this, I have managed to almost get it working how I would like. The issue right now is that the digital signal comes out too late after the trigger is set off. Can anyone provide any insight on how to make sure this doesn't happen? I expect to see my "Digital out" signal to look like a square pulse but instead it comes out like the image I attached. I believe this is because when the trigger happens, the digital task takes too long to start. Any help would be appreciated.

Download All
0 Kudos
Message 5 of 16
(1,098 Views)

So does no one have any insight?

0 Kudos
Message 6 of 16
(1,068 Views)

Your Digital out signal just looks like noise at the moment.  Can you save your VI for LabVIEW 2019 or earlier and repost? (File - Save for Previous Version, 19.0)

0 Kudos
Message 7 of 16
(1,062 Views)

Hope I did that right. Here it is. Thanks for responding.

0 Kudos
Message 8 of 16
(1,058 Views)

Yes, that's fine thanks.

 

Can we just be clear what you are trying to achieve here?  It looks to me like your VI does the following things:

  1. Set up an Analog Input task to acquire a fixed length of data on 5 channels (Finite Samples mode, samples per channel = sample rate * time)
  2. Apply a reference trigger to the Analog Input task so the task stops when a digital pulse is received on PFI0 and all posttrigger samples are acquired (pretrigger samples = total samples * pretrigger %)
  3. Set up a Digital Output task using a single line
  4. [Sequence frame 1] Start the AI task.
  5. [Sequence frame 2] Start the DO task. Read AI data: because this is a finite task and number of samples is not wired, this will wait for the task to acquire all requested samples, then read those samples.
  6. Graph the AI data and clear the AI task.
  7. Write TRUE to the DO line, wait 1 second, write FALSE to the DO line, clear the DO task.

 

You say that you have almost got it working - do you get any error messages?  What are you using to generate the trigger to PFI0 - an external signal or something routed internally?

 

Also, is your screenshot of the waveform graph representative of an actual test?  (I assume from this that you have the PFI0 and DO signals connected to two of your analog inputs).  Neither Trig1 nor Trig2 appears to include a rising edge which would provide the reference point.

 

Can provide some more information and comment on the above?

 

Andy

0 Kudos
Message 9 of 16
(1,040 Views)

To trigger my PFI0, I have a laser sensor that sends a 5V signal when activated, so an external signal. We can ignore trig 2 for my situation as the whole system kicks off trig 1/the first laser sensor. I don't have it wired to the channel displayed on the plot but it is still wired to my PFI0 so I can test. The screenshot is representative of an actual test, the signal is supposed to be my DO which I expect to appear as a square TTL but I think it is coming out too slow, I get no error messages. I did another test with the laser 1 wired and I have included a screenshot of what happened, the DO still comes out as noise and I think it is a timing issue.

Download All
0 Kudos
Message 10 of 16
(1,025 Views)