Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

generating a trigg on a periodic analog output siganl

Solved!
Go to solution

hi,

I am using a NI usb 6251 to generat a periodic analog signal,  and I want to generat a trigg for each period , so I am using a counter for that.

I am using an external timing source for the  Sample Clock of the analog output and I am using this same source as ticks source for the counter output.

with this solution I have a trigg which is generated at a fixed moment for each period, so fare so good.

My problem is that there is a variable delay between the starting of the analog output and the counter ouput. I mean each time I run my program the triggs are generated at a different moment.

to be more clear, let suppose that for each period of my signal I have 1000 Sample, if I run my VI the trigg is generated on the 10th sample, of each period. if i stop the VI and run it again the trigg is generated on the 12th sample, and so on, each time I stop the VI and run it again the trigg will be on a different moment of my period.

for my application I need the trigg to be  fixed for the same moment of my period.

you will find attached to this message an example of my VI.

so my question is who to make this delay fixed?

amine.

 

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

Hi chagalah,

 

Thanks for the post and I hope your well today!

 

I think the issue here is still to do with synchronisation - even though you've wired your error clusters around the code correctly. The issue is there is no 'forced' time in which your code produces a pulse just when the counter output task starts. I would suggest trying to use a trigger on the counter task to output a signal pulse everytime a condition is met.

 

However, you could also reverse the situation. Use a normal Counter output task and then having triggering on the AI task to output one cycle of the signal upon every tick.

 

Please let me know what you think,

 

Kind Regards,

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 2 of 16
(4,253 Views)

hi hillman,

thank you for your answer.

the problem is on the trigg of the counter task, I could not trigg on analog output. for the counter I could only trigg on digital signal, and I don't have digital signal.

in my application I generate a periodic analog signal and the resaon for using the counter is to generat a trigg for a camera si it could take images for each period of the analog signal.

so if you could suggest a solution to trigg the counter, I would be very grateful.

p.s. what is kudos?

amine

0 Kudos
Message 3 of 16
(4,245 Views)

Hi,

 

Please look into the code. This should similtanously start counter and your AO and should synchronize. Can you please explain further what you mean by trigering.

 

Best Regards, 

Fawad Nisar
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 4 of 16
(4,242 Views)

Hi Amine,


Thanks for the reply. 

 

Im still not 100% sure on what your trying to do - you mention trigger but your code doesn't have any. 

 

Please see the attached code - it should be a good starting point. (LabVIEW 8.6).

 

Basically, the counter task is retriggable, and upon an external pulse (PFI etc) it will generate X (example = 5) number of pulses which is then used as the sample clock for the analog output task. Sharing the sample clock ensures synchronisation. 

 

You will need to make sure enough pulses are generated to output a complete cycle in the AO task. Could you please try this out,

 

If you could re-explain your aim and maybe post your up-to-date code that would help everyone understand your application.

 

Kind Regards,

 

ps. Kudos is the new method to rate support you receive for the online community. It appears along the right-hand side of every post, and its used to say thanks to the people who helped you and also helps to indicate good posts. 

Message Edited by Hillman on 11-04-2008 03:48 PM
Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 5 of 16
(4,235 Views)

hi Fawad Nisar, hillman,

thanks for your answers and your codes, since i have labview 8.5 i could not open them, could please save them so I could open them or post a images of the code.

i think i was not clear at all.

in fact the code i've posted is a simplified version of mine, i've post this simplified version for clarity reason.

i'll explain my code, i am generating a periodic analog signal, this signal is used to generate some phenomenen, and i use a camera to measur this phenomenen, so what i am trying to do, is to synchronise the acquisition of images with this analog signal, I wish to acquire a sequence of images for each period, for that reason I am trying to generate with the counter a pulse for each periode, and i will use this pulses to trigg the acquisition, for the acquisition i am using pcie 1429.

i've removed for the code i've posted before the aquisition part.

so i am not trigging neither the analog signal nor the counter, but use the signal from the counter to trigg my framgrabber.

please tell me if you need more explanations.

 

p.s. for kudos shall I use them for each answer, or just at the end of the post when a solution is found?

anyway thanks a lot for helping me.

 

amine

 

 

0 Kudos
Message 6 of 16
(4,219 Views)

Hi Amine,

 

Here it is.

 

Let me know what you think - and then if no joys, we shall continue tomorrow, as NI UK Office closes at 5:30pm.

 

Regarding kudos, its completely up to you. Most users will just rate a reply if they feel it was helpful and good.

 

Kind Regards,

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 7 of 16
(4,215 Views)

Hi,

 

Here it is. We can look into more detail tomorrow.

 

Best regards

Fawad Nisar
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 8 of 16
(4,211 Views)

hi Hillman, Nisar,

thanks a lot for your answers.

I've took a look to your codes.

 

for Hillman, actually the solution you suggest is not realy what I am looking for. Using the counter for the sample clock is not something I want, in fact I use an external clock for that.

 

for Nisar, I think you've understand my problem, but I still have the same problem with your code as with mine, there is still a variable delay between the pulse of the counter and the analog signal.

 

to summary my probleme, let's suppose that when I run my code, the beginning of my analog signal is t=0 in time axes, the rising edge of my pulse occure at t1. if I stop my code and run it again I will have a new t1 different from the previous one. and I need this t1 to be the same each time I run the code.

 

please let me know if you need more explanations.

 

amine.
0 Kudos
Message 9 of 16
(4,190 Views)

Hi Amine,

 

Thanks for the reply.

 

It was just a suggestion.

 

Nisar works in the UK office with myself - and I have been talking with him regarding this post.

 

We have decided to let him work on this with you. 

 

Kind Regards

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
Message 10 of 16
(4,184 Views)