Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

synchronize fgen with a scope

Hello there,

 

I am using Measurement Studio for C++.

 

I am trying to synchronize the output of a function generator(PXI-5412) with the input of a scope(PXI-5122).

I just have some ideas for this, but I can't bring them to sourcecode.

 

The whole thing shoud do a kind of compensation.

 

I already wrote functions for each device.

 

Scope:

The function acquires a signal from the scope and stores the pattern.

This pattern is been normalized and manipulated in my way.

 

Fgen:

This function takes the previously stored pattern and output it on the fgen.

 

Problem:

The original signal and the compensation signal are not 100% synchronous.

The two signals run (very slow) out of synchronisation, over time.

 

My Idea:

I want to use the niTClk to synchronize the trigger signal of the scope with the trigger of the fgen.

I have some Problems to find example code for niTClk.

 

Can please someone help me with this.

Other solutions are welcome, too.

 

thank you guys

B

 

 

0 Kudos
Message 1 of 4
(6,669 Views)

no idea, .... anybody?

 

i worked on this problem and i didn't find a satisfying solution.

 

what i have is this

errS =	niScope_init					( ScopeName.GetBuffer(), VI_NULL, VI_FALSE, &ScopeSession);
if(!errS) errS = niScope_ConfigureHorizontalTiming	( ScopeSession, SampleRate, 1, 25.0, 1, VI_TRUE );
if(!errS) errS = niScope_ConfigureVertical		( ScopeSession, ScopeChannel, 20.0, 0.0, NISCOPE_VAL_AC, 1.0, 								  VI_TRUE);
if(!errS) errS = niScope_ConfigureTriggerEdge		( ScopeSession, ScopeChannel, 0.0, NISCOPE_VAL_POSITIVE,
							  NISCOPE_VAL_HF_REJECT, 0.0, 0.0 );
if(!errS) errS = niScope_ConfigureTriggerSoftware	( ScopeSession, 0.0, 0.0);
if(!errS) errS = niScope_ExportSignal			( ScopeSession, NISCOPE_VAL_REF_TRIGGER, NULL,
							  NISCOPE_VAL_RTSI_0 );
	
errF =		 niFgen_init				( FgenName.GetBuffer(),  VI_NULL, VI_FALSE, &FgenSession  );
if(!errF) errF = niFgen_ConfigureOutputMode		( FgenSession, NIFGEN_VAL_OUTPUT_ARB );
if(!errF) errF = niFgen_CreateWaveformF64		( FgenSession, "0", SampleCount, wfm, &wfmHandle );
if(!errF) errF = niFgen_ConfigureArbWaveform		( FgenSession, "0", wfmHandle, MaxAmplitude/2, 0 );
if(!errF) errF = niFgen_ConfigureSampleRate		( FgenSession, SampleRate );
if(!errF) errF = niFgen_ConfigureClockMode		( FgenSession, 1 ); //HiRes
if(!errF) errF = niFgen_ConfigureTriggerMode		( FgenSession, "0", NIFGEN_VAL_CONTINUOUS);
if(!errF) errF = niFgen_ConfigureOutputMode		( FgenSession, NIFGEN_VAL_OUTPUT_ARB );
	
	
if(!errF) errF = niFgen_ConfigureTriggerSource		( FgenSession, "0", NIFGEN_VAL_RTSI_0 );//(141)
//if(!errF) errF = niFgen_ConfigureDigitalEdgeStartTrigger( FgenSession, "PXI_Trig0", NIFGEN_VAL_RISING_EDGE );
if(!errF) errF = niFgen_ConfigureOutputEnabled		( FgenSession, "0", VI_TRUE );

if(!errF) errF = niFgen_InitiateGeneration		( FgenSession );
if(!errS) errS = niScope_InitiateAcquisition		( ScopeSession );

 but the fgen do not start.

what i'm doing wrong?

 

please help

 

B

0 Kudos
Message 2 of 4
(6,630 Views)

I found a solution for the problem with the start of the fgen.

It was a hardware related problem. The Fgen was installed in a different Segment of the PXI-Chassis as the Scope.

In the same Segment the Fgen starts.

 

But the synchronisation problem stays. I managed to produce an output with a defined phase at start of generation.

But over time the generated signal runs out of synchronisation very slowly.

I just want to output an arbitrary waveform at the trigger event of the scope.

There must be a way to do this.

Please help.

 

B

0 Kudos
Message 3 of 4
(6,597 Views)

Hello, it's me again.

 

we searched for solutions for the compensation problem very strongly. We made use of a specialist support of ni dirctly for System. Many ni developers took a look of our problem, but found no solution, which is practical.

They advised us to use a FPGA to handle our compensation. The hardware we bought isn't usable for this issue.

 

Explanation:

The NI idea of synchronity is the clock-synchronity. This is only possible, if the signal source is under your control.

The synchronity we need is signal synchronity. That means, that the signal source isn't under our control and we need to synchrinize to it.

 

Result:

A compensation of a given signal with a PXI-5122 Scope and a PXI-5412 Fgen isn't possible.

 

best wiches

Boris

0 Kudos
Message 4 of 4
(6,404 Views)