LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx start trigger synchronization using a relay as the digital trigger.

Solved!
Go to solution

Hello I am having troubles synchronizing two DAQ cards. I am using a relay which triggers the ignition of a spark plug by connecting two wires when the relay is switched on. I want the relay (Digital output block) to be the master and trigger the analog input block to read signals as soon as the digital output task is started. Right now it seems to not be sending the trigger signal as the code runs till the analog read block and then waits there indefinitely. The code works without the trigger blocks (but not synchronized perfectly) thus I know it is not a problem with the rest of the setup just that the trigger signal isn't being read by the analog read block. Any suggestions on what approach I can take to synchronize these two sections? They need to be as perfectly synchronized as possible since the entire experiment runs very fast once ignition is started. I have attached my code below. 

0 Kudos
Message 1 of 9
(422 Views)

Most of the community members don't use the latest version of LabVIEW. Please post your code in an earlier version next time.

I have LabVIEW 2024 on another computer so I can answer you this time.

 

ZYOng_0-1718067440718.png

You specified /cDAQ1/do/StartTrigger as the source of Start Trigger. It is defined as A terminal within a device where the digital output sample clock can be found but you didn't use any Sample Clock timing in your DO task hence this StartTrigger signal will never be generated. You would need to configure Sample Clock timing for DO task as well.

 

 

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 2 of 9
(372 Views)

Hello ZYOng,

Thank you for letting me know I will post in earlier version next time. I tried configuring a clock for digital output but it is now giving me error 200462. Saying the generation cannot be started because the output buffer is empty. I tried configuring the clock in different ways and I continually getting this error. Not sure what that means exactly.

0 Kudos
Message 3 of 9
(352 Views)

Hello,

I am having troubles configuring a sample clock and trigger to synchronize my digital output and analog input tasks.

GOAL:

The goal is to send a 1line 1point true Boolean digital output to my relay module in order to connect two wires connected in slots zero and one on my relay module. I know this connection works as I tried it on itself without the sample clock included and the relay is triggered from writing the digital bool 1line 1point block and setting it to true.

PROBLEM:

However when I add the clock in front it requires me to write data before the start task for the digital output because if I do not I get the error the buffer is empty (error -200462). However when I try to write the digital bool 1line 1point block, which is what worked for me when testing this section on its own without the sample clock, I get an error saying not enough samples were written. Saying only one was written and the minimum of two is required. (error -200294). 

CURRENT SITUATION:

In the diagram I show below I get no errors but there is some issue when trying to write the data after the start task as the wires are not connecting and the relay is not triggering. I am not sure if this is to do with the timing of the clock or trigger, or if is an issue with sending the other data before the start task and then the Boolean after? 

WHAT I HAVE TRIED: 

- Configuring the clock in different ways

- Using property nodes to change the buffer size (didn't work) 

- Using property nodes to connect the sources of the clocks together(not sure if I'm doing this right) 

-Using rendezvous instead for synchronization (This works and the diagram of it is shown below. I would rather have it synchronized with the trigger though since I will be getting another DAQ module NI-9401 for triggering a camera and a light source and I would like it all synchronized perfectly with that)

CHASSIS AND MODULES USED: 

Chassis: cDAQ: 9174

Digital Output Relay Module: NI-9481

Analog Input Module: NI-9222

 

CONCLUSION:

I am very stuck and not sure where to go from here. Any help would be very appreciated! Thanks!

 

0 Kudos
Message 4 of 9
(355 Views)

Please refrain from starting a new post for the same question.

 

Duplicated with Re: DAQmx start trigger synchronization using a relay as the digital trigger.

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 5 of 9
(328 Views)
Solution
Accepted by topic author jordan56

As suggested by the error code, you need to write data before starting a task.

Your code is pretty messy. I am not going to spend time fixing it.

Please refer to the attached code instead. It was modified from shipping examples.

You might want to read NI-DAQmx Syntax for Specifying Physical Channel Strings as well.

-------------------------------------------------------
Control Lead | Intelline Inc
Message 6 of 9
(317 Views)

Hi ZYOng,

The question is not the same as the previous one but is part of the same topic so next time I will put on same thread. I wanted to lay out my question in more detail with a more clear title. I already tried to write data before the start task which fixed the generation error but I ran into new problems as I outlined in the question on this thread. I am new to LabVIEW and not really sure where to look for the issue I am having as I can't find any examples similar to it. I am not asking for you to fix my code just some guidance on where to look. 

0 Kudos
Message 7 of 9
(316 Views)

I attached a modified example in my previous post. You can start by running that VI and go from there.

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 8 of 9
(289 Views)

Ok I will look into that thank you 

0 Kudos
Message 9 of 9
(284 Views)