Showing results for 
Search instead for 
Did you mean: 

DAQmx count and generate triggers

Hello all,
I use a PCI 1426 card and i want to
1. "count" the number of pulse on a trigger input
2. generate 1 trigger output every 10 (or 20 or 30) trigger inputs ; this is to trigger a camera (basler a202k)
Can somebody help on this in DAQmx please ?
Example code would help me a lot since it is the first time i use DAQmx.
Thanks in advance
0 Kudos
Message 1 of 7
Hey Lara,
I see that you have a PCI 1426 board already, but I was wondering if you have any kind of DAQ board yet? If you don't have a daq board yet, I would recommend either an M-Series board, or if you need a more specific counter board you could go with the 6600 series boards.
The 1426 cannot count the trigger inputs as well as a daq board can, and also the daq board will be able to easily output a trigger as well for every 10, 20, or 30 pulses. Also you can use RTSI to route some signals. You can either use RTSI or you can physically connect the signal to a daq board. If you use RTSI, you can route the trigger inputs to the daq board, have the daq board "count" the number of pulses on a trigger input, have the daq board either output a trigger on the digital lines on the board, or route that trigger output back over RTSI to the IMAQ card and have the 1426 output the trigger on one of its trigger lines.
As far as examples go, there are IMAQ examples that demonstrate how to route signals to DAQ via RTSI. These come with the driver software. As far as DAQmx goes, there are counter examples that can read counter inputs, and there are also examples that do basic pulse train generation (outputs) on the counters.
If you have more specific DAQmx questions, please reply back on this discussion forum thread and we'll answer any other questions you might have. Also, if you need more specific examples, please let us know. Thanks, and have a great day.
Message 2 of 7

Hello DJ,


First, thank you very much, that is a great reply ! Smiley Happy


Indeed, I made a mistake, I already have a DAQ board (PCI 6221) and what I need to do should not be very complicated, it is just that I am not used to DAQmx and I can’t get the philosophy it emplies… Smiley Indifferent


My application is quite basic, I have a basler camera (a202k) link via camera link to the 1426 baord and an AB encoder linked on the 6221 board. For every 100/200 pulses I received from the encoder I want to trig the camera to get a frame (not just a line, but a full 1004*1004 picture).


I’ve already managed to “count” the pulse from my encoder with DAQmx VIs, I’ve also managed to send trigger and to visualize them on an oscilloscope so I thought I was pretty close of the solution.

BUT I don’t know how to use RTSI, but if, as you said, I can route the counter input from the 6221 directly to the 1426 board to trig my camera with a 100 or 200 divisor, that sound to be the best solution.

I’ll check the example with RTSI and try to put this into DAQmx+IMAQ code, if I don’t come up with something that works, I’ll get back to you for more help Smiley Wink


Thanks again

0 Kudos
Message 3 of 7
So... I saw your other thread on DAQ board it seems like you'v found the right soft solution, I assume you now have the choice on the output type :

via RTSI directly from the 6221 to the 1426
via counter output from the 6221 to the sub 15 of the 1426

I am interested to know why one could be better than the other and why, do you have info about that DJ ?

Message Edité par TiTou le 03-10-2006 09:45 AM

We have two ears and one mouth so that we can listen twice as much as we speak.


Antoine Chalons

Message 4 of 7
Hey Lara,
It sounds like you are the right path, and you are close to getting your system up and running. Like TiTou said in his post, you can use the RTSI bus or you can use an external connection from your 6221 to the 1426. If you choose to use RTSI, you will have to have a RTSI cable that connects the two boards in the machine. If you use an external connection, then you will have to wire the output from the daq board to the input on the 1426 Trigger input pin. So all you would have to do for either choice you make, is change in software where the trigger output is to be routed, and in software for the IMAQ board where it is expecting to receive a trigger (for example: either on external Trig_0 or on RTSI 0). Also, you mentioned routing the counter input from the 6221 to the 1426, but you want to make sure that you only send a signal when you want, not every pulse that comes in from the counter, as this would cause the 1426 to acquire 100 or 200 images instead of one that you want for every 100 or 200. I'm sure you'll be able to get that to work as you want though.
For TiTou,
You asked why one way of triggering would be better than the other. Well, there is not a huge difference in how the signals actually get sent from one board to the other, and there is no real advantage over the other. It kind of depends on what you prefer and maybe some other circumstances that require you to use one over the other. For example, let's say that the two boards are not in the same computer, or that you have to route the signal that you want to output to some other source. In this case you would want to use the external triggering. Also, if you don't have a RTSI cable, you'd want to use the external triggering. On the other hand, let's say you want to reduce the amount of external wiring, then RTSI is a lot cleaner and internal to your PC. Also, RTSI is useful if you have multiple communications between the two boards that you might want to pass back and forth signals. Last, with RTSI you would not have to worry about a lot of noise or any external variables, like the length of a wire, that could cause any latency in the signal. So there are positives to each way to route the trigger signal, but personally, I would choose to use RTSI.
I hope this answers both of your questions. Please let me know if you have any other questions or concerns. Thanks, and have a great day.
Message 5 of 7
Hi DJ,

Thanks alot for these informations Smiley Happy That is quite clear.

We have two ears and one mouth so that we can listen twice as much as we speak.


Antoine Chalons

0 Kudos
Message 6 of 7
BTW, I am stuck with a similar issue... could you please check that thread ?

Thanks alot.

We have two ears and one mouth so that we can listen twice as much as we speak.


Antoine Chalons

0 Kudos
Message 7 of 7