Test and Measurement Forum

Multiple Trigger (examples?)

Post your C and C++ discussions here

Multiple Trigger (examples?)

Postby Jay H » Thu Apr 01, 2010 3:23 pm

Trying to digest the setting up of Triggers with the PS5000con.c sample provided with the software. From reading the API function descriptions, I'm trying to see if I understand the use of multiple structs for the two functions (ps5000SetTriggerChannelConditions and ps5000SetTriggerChannelProperties)

Saying that you can pass an array of structs and the function will do some logical voodoo on it to setup the trigger.

Correct me if I'm wrong, if I understand this correctly (I am not an expert on using an o-scope! Pico or otherwise), I have the ability to trigger the scope based on the following scenario...

I can have the software start a trigger IF either

Rising trace at 75mV on channel A
or
Rising trace at -50mV on channel B

To do this, I can setup two "Structs" as defined by tTriggerChannelProperties and set them to

struct#1 "75mv", Channel A

struct#2 "-50mV", Channel B

Ignoring the other values (hysteresis, threshholdMode...)...

When sent to the function ps5000SetTriggerChannelProperties, it will logically OR the two structs and then define ONE trigger to basically go off when either of the conditions apply?

It doesn't look like one can associate a FALLING direction and a RISING direction in the same trigger? i..e the trigger direction is not a field in this struct... i.e if I wanted to set up a trace with a rising 75mV or a falling -50mV in the above example...

For ps5000SetTriggerChannelConditions,

if I set channel A and channel B to CONDITION_TRUE in the same Struct, this means that the trigger has to exist on both channel inputs (a LOGICAL-AND) but if I send in more than one structs to the above function, this would basically be a LOGICAL-OR.

Are there examples running around somewhere? Just want to make sure I understand the logic and stuff here..

Jay
Jay H
Newbie
 
Posts: 0
Joined: Wed Mar 31, 2010 2:13 pm

Re: Multiple Trigger (examples?)

Postby Jay H » Thu Apr 01, 2010 7:31 pm

I modified the sample console to allow for mulitple Trigger Properties and Conditions and playing around with them.

I keep getting a bad PICO_STATUS returned from ps5000SetTriggerChannelProperties.

the value is set to 73, which I found via a search is "PICO_INVALID_TRIGGER_PROPERTY." my picoStatus.h does not have a constant defined for 0x49 or 73. I tried to download the latest and greatest SDK and was gloriously denied by my company's firewall (how lovely...).

In any case, perhaps you can tell me what am I doing wrong?

I tried to setup 2 triggers, for example a 50mV on Channel A and a 75mv on Channel B.

A properties:

Properties Struct#0

thresholdMajor = 50mv (converted to ADC via mv_to_adc)
thresholdMinor = 50mv (only used with Window threshold...)
Hysteresis = 256 *10
channel = PS5000_CHANNEL_A
thresholdMode = LEVEL

B properties

Properties Struct#1

thresholdMajor = 75
thresholdMinor = 75
Hysteresis = 128*10
channel = PS5000_CHANNEL_B
threshholdMode = LEVEL

they are setup in an array and I pass the pointer of the struct to the API function ps5000SetTriggerChannelProperties.

I have ONE conditions struct, setting CHANNEL_A to CONDITION_TRUE.. Direction is set for CHANNEL A to be "RISING".

I keep getting that 73 status error and don't know why.
Maybe I'm just trying to do something dumb (is this even possible, like I said, I don't use scopes that much).

What am I doing wrong? Are there any examples of using multiple structs to do some more fancy Triggering that the basic which works fine.

Jay
Jay H
Newbie
 
Posts: 0
Joined: Wed Mar 31, 2010 2:13 pm

Re: Multiple Trigger (examples?)

Postby Jay H » Thu Apr 01, 2010 8:01 pm

Eureka, I have gotten past that but I notice that I have to set the voltage on structures to a small amount.

Input sine wave on channel A is set to 200mV Peak to Peak and at a 3khz freq. timebase is set to 240ns

If I set struct 1 voltage to 50mv (converted of course to ADC for thresholdMajor) and struct 2 voltage to like 1mv, runs fine, I get the trigger and output to data.txt.

if I say set struct 1 voltage to 50mv and struct 2 voltage to 25mV, all goes to hell and I get that Status error of 0x49. (PICO_INVALID_TRIGGER_PROPERTY).

What exactly is the ps5000setTriggerChannelProperties doing with the array of Properties?

BTW, I found no detail of error 0x49 in picostatus.h but I did find it in the API guide for the Picoscope 6000 series and the Picoscope 4000 series.. For some reason, that is not listed as a valid code in the Picoscope 5000 API manual that I have..

Jay
Jay H
Newbie
 
Posts: 0
Joined: Wed Mar 31, 2010 2:13 pm

Re: Multiple Trigger (examples?)

Postby Jay H » Fri Apr 02, 2010 11:18 am

OK. I just installed the latest and greatest SDK, and noticed that the header file picostatus.h in the newest SDK includes the status error code for 0x49. So I guess my old version of the SDK just didn't include that one...

I also noticed the only major change is some kind of rapid block mode. I have already ported over all my play code in the original to the new SDK and I have it running.

I am developing on an OLD Visual Studio IDE, MS Visual C++ 6.0 and it doesn't recognize the Int64 nomiker of "long long" so I had to change that to __int64 which is not ANSI I don't think. I notice the new SDK I downloaded give a bunch of warnings about using (short *) in some of the malloc calls... with 6.0

Jay :twisted:
Jay H
Newbie
 
Posts: 0
Joined: Wed Mar 31, 2010 2:13 pm

Re: Multiple Trigger (examples?)

Postby Robin » Tue Apr 13, 2010 10:57 am

Hi

I have added logic triggering (trigger on channel A OR B) to the console example.

I hope it's useful.

Robin
Attachments
PS5000con.c
(35.23 KiB) Downloaded 157 times
Robin
Zen Master
Zen Master
 
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am


Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests