Triggered streaming and arbitrary function gen

Post your .Net discussions here
Post Reply
ARC
Newbie
Posts: 0
Joined: Wed Aug 08, 2012 8:38 am

Triggered streaming and arbitrary function gen

Post by ARC »

Hello,

I have found out that instead of triggering the waveform then recording data using the oscilloscope i actualy need to record during the waveform.

so during the triggered streaming sleep cycle i cam checking for a waveform request then calling SetSignalGenerator and passing it all the usual information and when it calls ps2000aSetSigGenArbitrary it never returns. and the picoscope becomes unresponsive and requires unplugging and reconnecting to use it again.

My code is attached can you see any reason why this would happen or how to prevent this.

The c code runs in a thread from another program so functions are selected by "function" just above "main". this change in global variables causes the streaming triggered function to go and use the sig gen.

Many thanks for looking :)
Attachments
PS2000Acon.c
(60.24 KiB) Downloaded 727 times

Hitesh

Re: Triggered streaming and arbitrary function gen

Post by Hitesh »

Hi ARC,

Looking at your code, how do you tell the application to call the CollectStreamingTriggered() function in the main function? If 'ch' is set to call this function, where is 'ch' then set to indicate to set the signal generator?

Also where is channelbtrig set? Are you looking to use the software trigger for the AWG and trigger on channel A or B when the signal is fed back in?

If you are looking to trigger on a channel to capture the data, it is not possible to use a scope channel to trigger the signal generator.

PicoScope 6 Beta shows that it is possible to trigger the signal generator while capturing data in streaming mode.

Thanks,

ARC
Newbie
Posts: 0
Joined: Wed Aug 08, 2012 8:38 am

Re: Triggered streaming and arbitrary function gen

Post by ARC »

Hi thanks for the reply,
I change frequency,waveform,filename,offset,pktopk,channelbtrig,ch and AC just above main in the following function:

Code: Select all

_declspec(dllexport) int function (char operation, double hz, short name, char location[128], long move, unsigned long size, int settings, BOOL acdc)
{
	complete = FALSE;
	frequency = hz;
	waveform = name;
	strcpy(filename, location);
	offset = move;
	pktopk = size;
	channelbtrig = settings;
	ch = operation;
	AC = acdc;

	while (complete == FALSE)
	{
		Sleep(1);
	}
	return (exitstatus);
}
I am only using the software trigger for the AWG i am relying on channels A/B and EXT for triggering any oscilloscope function.

The AWG waveform is controlling a power supply for an audio device, channels A & B (currently just A im not printing channel B's buffer to the file) are recording the audio output of the audio device. So the waveform output from the AWG is not fed back into the oscilloscope.

The timing of oscilloscope and AWG function calls is controlled by another C# program and the functions that C# program calls all have "_declspec(dllexport)" infront of them.

Thanks,

Rob

Hitesh

Re: Triggered streaming and arbitrary function gen

Post by Hitesh »

Hi Rob,

What is the status code of the call to ps2000aRunStreaming()?

What are the values of sampleCount, downsampleRatio, timeUnits and ratioMode if you set a breakpoint in the dll code?

Thanks,

ARC
Newbie
Posts: 0
Joined: Wed Aug 08, 2012 8:38 am

Re: Triggered streaming and arbitrary function gen

Post by ARC »

Hi Hitesh,

The status code before and after calling ps2000aRunStreaming = 0.
Sample count = 10240
Downsample ratio = 1000
Time unit = PS2000A_US
Ratio mode = PS2000A_RATIO_MODE_AGGREGATE

Thanks,

Hitesh

Re: Triggered streaming and arbitrary function gen

Post by Hitesh »

Hi Rob,

You will need to call the ps2000aSetSigGenArbitrary() function prior to calling the ps2000aRunStreaming() function as it is not possible to change the settings inside the loop where you capture the data values.

You can call the ps2000aSigGenSoftwareControl function inside the loop and this will then output the waveform.

If you need to change settings, you will need to stop streaming, set the AWG and then run streaming again.

I hope this helps.

ARC
Newbie
Posts: 0
Joined: Wed Aug 08, 2012 8:38 am

Re: Triggered streaming and arbitrary function gen

Post by ARC »

Just got it working, Thank you very much :)

Post Reply