c++ trigger setup problem

 
Post new topic   Reply to topic    Pico Technology Forum Index -> General Software Discussions
Author Message
Guest






PostPosted: Thu Dec 20, 2007 2:17 pm    Post subject: c++ trigger setup problem Reply with quote

hello,

ich have a problem with a self written c++ (visual studio) program, that must work with a trigger. without trigger the program works fine.

my triggersetup should work with the ext channel and channel A + signal generator (for testing).

/********/
channelproperty1.upperThreshold = 8000;
channelproperty1.lowerThreshold = 0;
channelproperty1.hysteresis = 0;
channelproperty1.thresholdMode = LEVEL;
channelproperty1.channel = PS5000_EXTERNAL;
status = ps5000SetTriggerChannelProperties(handle,&channelproperty1,1,0,0);

/**********/
conditions.channelA = TriggerConditions::DontCare;
conditions.channelB = TriggerConditions::DontCare;
conditions.channelC = TriggerConditions::DontCare;
conditions.channelD = TriggerConditions::DontCare;
conditions.ext = TriggerConditions::True;
conditions.aux = TriggerConditions::DontCare;
conditions.pwq = TriggerConditions::DontCare;
ps5000SetTriggerChannelConditions(handle,&conditions,1);

/***********/
ps5000SetTriggerChannelDirections(handle,
NONE,
NONE,
NONE,
NONE,
RISING,
NONE);

/***startstreaming**/
ps5000RunStreaming(handle,&sampleInterval,PS5000_NS,0,0,true,1,bufferSize);

/***sampling******/
while (samples < bufferSize)
{
Thread::Sleep(100);
status = ps5000GetStreamingLatestValues(handle, callBack, NULL);
}

/***callBack******/
extern "C" void __stdcall callBack
(short handle,
long noOfSamples,
unsigned long startIndex, //
short overflow,
unsigned long triggerAt,
short triggered,
short autoStop,
void * pParameter)
{
g_autoStop = autoStop;
received = true;
samples += noOfSamples;
}

/***finish**/

one problem is, that the flag triggered is true after the first callback call, although the external trigger is switched off. the second call the triggered flag is flags and will never be true again, although the trigger is switched on.
at the third call the autostop flag is true (dont know why, the max values aren't collected).
and a last failure case: if the triggerchannel is switched on at the beginning of the data collection - the propgram starts correctly (but collect to much data - bufferoverflow)

i hope anybody can help me
Back to top
ziko
Site Admin
Site Admin


Joined: 01 Dec 2006
Posts: 596
Location: St Neots

PostPosted: Mon Feb 11, 2008 12:46 pm    Post subject: Reply with quote

Hi and thank you for your post.

One of the software engineers has kindly had a look at your example and found that

"Yo are not setting the number of preTriggerSamples or postTriggerSamples thus the auto stop will automatically fire.

ps5000RunStreaming(handle,&sampleInterval,PS5000_NS, preSample, postSamples, true,1,bufferSize);

The preSamples or postSamples needs to be above 0, if you want to collect a million samples before the trigger and a million samples after the trigger then the two parameters are set to one million.
"

Hope this helps.

Kind regards
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Pico Technology Forum Index -> General Software Discussions
All times are GMT
Page 1 of 1

 


Pico Technology topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group