Anyway, when initializing the app, the SetTrigger and RunBlock functions will just randomly fail sometimes. Here is my code for each:
- 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";
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?
Also, another question: does the Imports.Stop() function have any functionality when in block mode?