LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time of generation

Hello! 

I have are two channels: one for signal generation, another for signal analyze. There is an external device to generate signals TTL with frequency 50Hz (frequency is defined precisely, does not float and it is very stable). 

The analyze channel is written by example Multi-Function-Ctr Retrigg Pulse Train Generation for AI Sample Clock.vi to start-restart data analyse on a trigger signal - external signal TTL 50Hz. The counter for retriggering is ctr0. 

The channel of generation of the data is written by a parallel cycle according to example Cont Gen Voltage Wfm-Int Clk-Non Regeneration.vi, and a source of clock for the generation and analyze channels the same. Inputs Source for both Daqmx Timing value - Ctr0InternalOutput. 

The problem: I set signal generation and signal analyse 100ms. It mean that I write in analog output channel 100ms array and read analog input channel the same array. Generation and collection start on the trigger  - signal 50Hz on external device. But when I have fifth impulse on the external device (100ms=20ms*5), signal generation an signal analyze not started again, and started on the sixth impulse. Thus, if I install generation signal and collection signal 99ms - is all right and the next start occurs on the fifth impulse.

0 Kudos
Message 1 of 8
(3,092 Views)

Hi Pavel,

 

What you are seeing sounds like you are wanting to do continuous 100 ms analog generation and analyzations, but you are seeing 20 ms gaps in your sequence.  It sounds like having exactly 100ms in your array will put the end of your sequence just past the fifth rising edge on your clock, and thus it waits until the next rising edge happens to start the process again.  That is why you are seeing correct behavior at 99ms.  The extra 1 ms buffer allows your sequence to end and reset so that the next rising edge it will start over again just fine.  

Kyle A.
National Instruments
Senior Applications Engineer
0 Kudos
Message 2 of 8
(3,056 Views)

Hi (Kyle),

 

Is there in a situation described above by Pavel any chance just to count number of 50 Hz trigger pulses and to run signal generation (and analysis) every 5th trigger pulse (to obtain required 100 ms). Then, we can synchronize system for 20, 40, 60 ms etc periods without 1 ms buffering, using 1st, second, third trigger pulse... If it is possible, how it can be realized?

 

The idea of this is to eliminate noise produce by 50 or 60 Hz supply by synchronizing measurements with phase of supply voltage.

 

Regards,

Leo 

0 Kudos
Message 3 of 8
(3,034 Views)

Hi Leo,

 

So if I understand correctly, you have a 50Hz signal that you are triggering off of the rising edge of this signal.  You want to start generation/analysis every fifth trigger seen.  How long are you executing your sequence?

 

If you are looking to trigger on every fifth trigger, you can use a counter to count the rising edges, and then do a division by 5 on the current count using the Quotient and Remainder vi.  Then have a case structure that executes your sequence everytime the remainder equals 0, and all other cases do nothing.

 

I think I'm a little confused as to what you are trying to achieve, as in your sequence timing.  Do you want to do 20 ms bursts or do you want to do 100ms at a time?  I think the issue here is that you cannot start another cycle of your sequence without completing the first one.  If you plan to do consecutive 100ms sequences, you might consider just having a start trigger and then a continuous sequence that has a particular stop condition.  

Message Edited by Kyle A. on 04-21-2010 10:44 AM
Kyle A.
National Instruments
Senior Applications Engineer
0 Kudos
Message 4 of 8
(3,013 Views)

Thank you, Kyle. This is, I think, the answer for the question how to synchronize measurement/signal generation with line frequency.

 

I am executing 1-20 ms burst (if I understand term burst the same as you are) with period (sequence) multiple to line frequency. So, when there is multiple to line frequency  (50 Hz in Europe) period of measurement (20, 100 or 200 ms) the answer seems simple.

 

However, the next task is to measure/generate 2 ms signal  with 5 ms period (4 times in 20 ms period of supply voltage frequency), so that every 5th measurement/generation will start triggered by the rising edge of the next 50 Hz synchro pulse. Is it the same simple answer as above and what kind/size of buffer I need to let 5th measurement start again by 50 Hz line trigger?

 

Actually, I am trying to replace hardware PLL (phase lock loop) or similar instrumental approaches  of synchronization (as in TV-set) programatically. Probably, some known approach permits to do it flawless?

 

Redgards,

Leo 

0 Kudos
Message 5 of 8
(3,001 Views)

Leo,

 

So you are making a 2 ms signal into a 5 ms signal, stretching it out to fit that period, is that correct?  I'm not sure what you mean by the buffer, but as stated before you need to have your sequence (analysis/generation) finished and waiting for a trigger by the time the trigger comes around.  Otherwise, the trigger will happen and be ignored because the task is still executing.

 

There seems to be a lot of different considerations as to how you are handling the signal and how you are implementing the PLL.  If you generate too slow, then there will be gaps in your signal, and if you generate too fast, you either miss the trigger or stop your generation short of completion.  I can think of no easy way of doing this, so hopefully I have provided some information for you to continue working with your particular application.  The only way I can think of to achieve this is to not continously generate and allow for some time to resync your signal period.

Kyle A.
National Instruments
Senior Applications Engineer
0 Kudos
Message 6 of 8
(2,977 Views)

Yes, you right. A lot of different considerations make the system very time and processor dependent. Unfortunately, experiments with slow resync (as for example every 5 s) showed that it does not work because 50 Hz (and probably 60 Hz in US) line is not as stable as one may think.

 

Thank you again,

Leo

0 Kudos
Message 7 of 8
(2,972 Views)

Leo Pribram wrote:

Yes, you right. A lot of different considerations make the system very time and processor dependent. Unfortunately, experiments with slow resync (as for example every 5 s) showed that it does not work because 50 Hz (and probably 60 Hz in US) line is not as stable as one may think.

 

Thank you again,

Leo


 

It looks like you are talking about mains power here...

 

If you are talking about triggering off the mains power lines then this is beacuse the power companies have a duty (under law in the UK at least) to ensure that over a full 24hour cycle the average rate is 50Hz, the rate during any given minute may be higher or lower due to the use of other users on the grid, but over a 24hour period it will sort itself out. This is to ensure people can use didgital clocks and other devices that get their timing from the mains frequency.

 

Hope this helps. 

 

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 8 of 8
(2,961 Views)