Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Using counter output as AO Start Trigger

Solved!
Go to solution

Good morning everyone,

 

I am currently using a PCI-6120 with a BNC-2120. In the VI I attached to this post, I have one Analog Output channel that generates a predefined signal stored in the board memory. The regeneration is enabled so that the signal is generated continuously.

The generation can be stopped and (re-)started at any time using a switch on the front panel.

 

Aside from this AO Channel, there is a counter. I would like to use this counter as the Start Trigger for the AO so that, when the switch on the front panel is set to ON, the AO task waits for the next rising edge of the counter output to start the generation.

 

Here is my problem.

When I run the VI, the very first start of the AO is indeed triggered by the counter. The two signals being generated are perfectly synchronized (AO and Ctr). BUT! After turning the switch to OFF and then back to ON, the signals are not synchronized anymore. The AO task begins generating samples right after starting the task, without waiting for the next rising edge of the counter output.

 

Could anyone help me to understand what is going on, please?

Why is it working right after running the VI, but not after using the switch on the front panel?

 

Thanks a lot.

 

P.S.: when the switch is set to OFF, the AO task is not completely stopped. The AO starts generating a constant value of 0Volt. That is normal. I want to control the value generated by the board at any time to avoid damaging the device I send the signal to. So I force the generation to 0Volt rather than just stopping the task.

0 Kudos
Message 1 of 9
(4,329 Views)

Hello Luc,

 

I tried your VI with a PCI-6221 and a BNC-2120. I get an error because too much samples were written in the buffer so I reduced the amount of samples without modifying the pattern. I also reduced the timing of the analog output task because I had another error relative to the DAC when I was stopping the VI. I put in attachment the VI with my modifications.

 

On the BNC-2120, I used BNC cables to connect AO0 to AI1 and CTR-OUT0 to AI1 in order to see if the two signals were synchronized. (The BNC was cut on one of the ends in order to connect the counter's output to AI1)

 

I ran your VI and an example VI which allows to read continuously two analog inputs. (I also put it in attachment)

 

I see the AO which sends 0V when the switch on the Front Panel is put to false. Then, when I put it back to true, I see the pattern as before, meaning synchronized with the counter.

 

Please let me know if you have the same behavior with the VIs I attached to this post.

 

Regards,

 

 

Jérémy C.
NI France

0 Kudos
Message 2 of 9
(4,312 Views)

Hello Jérémy,

 

Thank you for your answer.

 

I tried your VIs but the signals are still NOT synchronized... Do you have any other idea...?

Could there be something misconfigured somewhere, ralated to the 6120 board, and somewhere else than in the VI itself...?

 

Regards,

Luc

0 Kudos
Message 3 of 9
(4,298 Views)

Luc,

 

Before looking more deeply, do we agree on the fact that the following screenshots show that the signals are synchronized?

 

Switch OFF.jpg

 

Switch ON.jpg

 

Regards,

Jérémy C.
NI France

0 Kudos
Message 4 of 9
(4,294 Views)

Yes Jérémy.

We agree on the fact that what you just showed in your message are synchronized signals.

You will find below what I get after turning the switch to FALSE and then back to TRUE.

Please note that the phase shift between the two signals changes everytime you change the state of the switch. It is not always the phase shift shown on the picture...

 

And by the way, what you showed in your message is exactly what I would like to have every time I put the switch to TRUE.

 

 

SwitchOFF.png

 

SwitchON.png

0 Kudos
Message 5 of 9
(4,287 Views)

Hello again,

 

I did the test with a PXI-6120 and indeed, the signals are not synchronized anymore when puting back the switch to ON.

 

In fact, your card is a S Series card. Mine (6221) is a M Series card. 6120 cards don't allow analog outputs to be retriggered. This kind of cards is older than the M Series.

 

I found two possible solutions for you :

 

1) You can buy a M Series card (or X Series)

 

2) You can stop and restart your pulse train like in the VI I put in attachment.

 

Regards,

Jérémy C.
NI France

0 Kudos
Message 6 of 9
(4,272 Views)

Thank you for your help Jeremy.

 

I guess the only real solution is buying another board.

The second solution you gave does not work actually... You can see it if you run the VI step by step. Just put a break point in front of the Write VI in the loop. When you execute the VI step by step, you see that the AO channel starts right away, without waiting for the counter to be restarted. So the AO is not triggered.

If you run the VI normally (and not in step by step) there is still a short delay between the two signals. You can see it by zooming on an edge. You get the picture shown below.

I guess this delay is the time needed by the computer to run the VI between the moment it starts the AO and the moment it starts the Counter. So I don't want to be picky but the signals are not synchronized...

 

Let me know if you find another solution.

Thank you again.

 

ZoomStopStart.png

0 Kudos
Message 7 of 9
(4,264 Views)
Solution
Accepted by topic author LucG

LucG,

 

According to the S Series User Manual, the delay will be two pulses of your sample clock timebase. So it is expected.

 

The 2 tick delay should only occur for an internal sample clock. There should be no delay if you are using an external sample clock.

 

You can check if this delay appear when the sample clock is also used as the start trigger. I didn't realize this test.

 

If it doesn't work, I think your solution will be to buy another board because I already spent time yesterday to try something else like using the second counter for example but it really seems there is no workaround excepted buying a board with a more recent technology.

 

Regards,

Jérémy C.
NI France

0 Kudos
Message 8 of 9
(4,253 Views)

OK. I'll try that. But I'm afraid the solution would still be buying another board...

 

Thank you very much for your help.

 

Have a good day.

Luc

0 Kudos
Message 9 of 9
(4,246 Views)