Test and Measurement Forum

2206A Trigger Problems

Post general discussions on using our drivers to write your own software here

2206A Trigger Problems

Postby Cwebster » Sun Aug 31, 2014 11:02 pm

Hi,

I am setting up my Pico 2206A Oscilloscope using C++ and It seems to all compile. Throughout I assign the result of the function calls to a variable and ensure the returned PICO_STATUS is PICO_OK.

I have set up my trigger as follows:

Code: Select all
iStatus = ps2000aSetSimpleTrigger( iPicoHandle, 1, PS2000A_CHANNEL_B, PS2000A_2V, PS2000A_RISING, TRIGGER_DELAY, AUTO_TRIGGER_MS);

//Both TRIGGER_DELAY and AUTO_TRIGGER_MS = 0


I am using Block Mode and I have configured both channels A and B previously in the code and they both also return PICO_OK.

The data I am trying to capture is transmitted to the oscilloscope when I flip a switch, hence the use of block mode as the data is a pulse rather than continuous. Although when the switch is in the off position, the data capture ends instantly as if the trigger has been set off (although I haven't flipped the switch so the data is not transmitted). When the switch starts in the on position, the data capture does not end until I flip the switch off, which does not allow the data to be captured as the data is sent instantaneously as I flip the switch from off to on.

I have ensured I have the switch in the correct position by checking the results in Picoscope 6, using the same trigger.

Any ideas as to why this is not working would be greatly appreciated,

Thanks.
Cwebster
Newbie
 
Posts: 0
Joined: Fri Aug 29, 2014 1:21 pm

Re: 2206A Trigger Problems

Postby Martyn » Mon Sep 01, 2014 6:37 pm

What is PS2000A_2V ?
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2287
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: 2206A Trigger Problems

Postby Cwebster » Tue Sep 02, 2014 10:32 am

Martyn wrote:What is PS2000A_2V ?


Hi, thanks for the reply.

PS2000A_2V is what I put in for the threshold, although the signature of the method asks for a short, I looked through the API enumerated types and thought that the ±2V would work for this value, is this not the case?

Thanks again,
Cwebster
Newbie
 
Posts: 0
Joined: Fri Aug 29, 2014 1:21 pm

Re: 2206A Trigger Problems

Postby Cwebster » Tue Sep 02, 2014 12:38 pm

Thanks you for bringing this to my attention, I have changed the value to 2000 and the program now waits until I set off the trigger.

I now have the problem that it still does not return any values, I'll explain in more detail;

Call Order:
Code: Select all
ps2000aRunBlock( iPicoHandle, ( iSegmentSamples / 10 ), ( iSegmentSamples - ( iSegmentSamples / 10 ) ), TIMEBASE, OVER_SAMPLE, &iTimeIndisposed, SEGMENT_INDEX, NULL, NULL );


iSegmentSamples is gathered from ps2000aMemorySegments( iPicoHandle, NO_OF_SEGMENTS, &iSegmentSamples );
NO_OF_SEGMENTS = 1.
Return Value (iSegmentSamples) = 32682.
TIMEBASE = 1.
OVER_SAMPLE = 0.
iTimeIndisposed = un-initialised as it is a return value.
SEGMENT_INDEX = 0.

Code: Select all
ps2000aIsReady( iPicoHandle, &iStillCollecting );


iStillCollecting = 0 initially.
ps2000aIsReady is called within a while loop:

Code: Select all
while ( iStillCollecting == 0 )

Once the while loop finishes (now when the trigger is fired), I set up my two data buffers (one for channel A and one for channel B), using:
Code: Select all
ps2000aSetDataBuffer( iPicoHandle, PS2000A_CHANNEL_A, &iBuffer[0][0], BUFFER_SIZE, SEGMENT_INDEX, PS2000A_RATIO_MODE_AVERAGE );
ps2000aSetDataBuffer( iPicoHandle, PS2000A_CHANNEL_B, &iBuffer[1][0], BUFFER_SIZE, SEGMENT_INDEX, PS2000A_RATIO_MODE_AVERAGE );


iBuffer is defined as short int iBuffer[2][BUFFER_SIZE].
BUFFER_SIZE = 10000.
SEGMENT_INDEX = 0.

I then call:
Code: Select all
ps2000aGetValues( iPicoHandle, 0, &iWantedSamples, DOWNSAMPLE_RATIO, PS2000A_RATIO_MODE_AVERAGE, SEGMENT_INDEX, &iOverflow );


Second Parameter = Start Index.
iWantedSamples = iSegmentSamples (32682).
DOWNSAMPLE_RATIO = 1.
SEGMENT_INDEX = 0.
iOverflow = un-initialised as it is a return value.

After this I loop through the two buffers:

iBuffer[0][i] and iBuffer[1][i]

and copy and values that != 0 to a memo, but both memos stay blank after the transfer.

Any ideas?

Thanks again.
Cwebster
Newbie
 
Posts: 0
Joined: Fri Aug 29, 2014 1:21 pm

Re: 2206A Trigger Problems

Postby Martyn » Tue Sep 02, 2014 12:39 pm

If you are using the enumerated type value this will be less than 10 so will is very close to zero which is why you are triggering immediately

The value needs to be an ADC count, and can be up to 32765 (from memory) for full scale on a chosen range.


X-post
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2287
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: 2206A Trigger Problems

Postby Martyn » Tue Sep 02, 2014 12:54 pm

Where are you allocating the memory for your buffers, before passing their location to the driver?
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2287
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: 2206A Trigger Problems

Postby Cwebster » Tue Sep 02, 2014 12:57 pm

Martyn wrote:Where are you allocating the memory for your buffers, before passing their location to the driver?

As far as I am aware I am not doing this manually.
At the moment I am just defining the array in my .cpp file.

How would I go about doing this?

Thanks,
Cwebster
Newbie
 
Posts: 0
Joined: Fri Aug 29, 2014 1:21 pm

Re: 2206A Trigger Problems

Postby Martyn » Tue Sep 02, 2014 3:55 pm

Can you send me your code to support@picotech.com and I can take a look.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2287
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: 2206A Trigger Problems

Postby Cwebster » Tue Sep 02, 2014 4:45 pm

Martyn wrote:Can you send me your code to support@picotech.com and I can take a look.


Thanks, I've sent an email with the code I am currently using.

I get values for Channel A but not Channel B, although I have set up both data buffers with memory allocation now.
Cwebster
Newbie
 
Posts: 0
Joined: Fri Aug 29, 2014 1:21 pm

Re: 2206A Trigger Problems

Postby Karunen » Tue Sep 09, 2014 10:57 am

Hi Cwebster,

I have answered your email and look forward to helping you resolve this issue.

Kind Regards,
Karunen

Technical Specialist
Pico Technology
Karunen
Zen Master
Zen Master
 
Posts: 194
Joined: Thu Nov 21, 2013 9:22 am


Return to General Software Discussions

Who is online

Users browsing this forum: No registered users and 0 guests