Post your .Net discussions here
- Advanced User
- Posts: 0
- Joined: Tue May 17, 2016 6:45 pm
So I've pretty much finished building a nice little app for myself. I run neuroscience experiments, and all we are doing with the app that I've built is capturing some simple waveforms when a stimulation is delivered from an A-M Systems neural stimulator, and then we save the waveforms to disk. Not complicated stuff.
Anyway, when initializing the app, the SetTrigger and RunBlock functions will just randomly fail sometimes. Here is my code for each:
In the above context, the variable Messages simply holds a string of messages to be displayed to the user. Anyway, as you can see, we always set the trigger and run the block with the same parameters. This is done upon initialization of the program. About 50% of the time one of the two will fail when the program is first initialized. I should also stress that if they succeed the first time, they continue to succeed. Is there any reason why the first call to each of these has a 50% failure rate?
Code: Select all
//Set up a trigger
short trigger_successful = Imports.SetTrigger(scopeHandle, (short)Imports.Channel.ChannelA, 0, (short)Imports.ThresholdDirection.Rising, -50, 0);
if (trigger_successful == 0)
Messages = Messages + "Unable to set trigger! You may need to restart the program!\n";
//Set up a new triggered block to run
int time_indisposed_ms = 0;
short block_successful = Imports.RunBlock(scopeHandle, 1024, 7, 1, out time_indisposed_ms);
if (block_successful == 0)
Messages = Messages + "Unable to setup block! You may need to restart the program!\n";
Also, another question: does the Imports.Stop() function have any functionality when in block mode?
- Site Admin
- Posts: 3376
- Joined: Fri Jun 10, 2011 8:15 am
- Location: St. Neots
What are the actual values returned by ps2000_get_unit_info using PS2000_ERROR_CODE after a function fails ?
Technical Support Manager