Sets AO scan trigger
mdaqAOScanTrigger(triggerType, p1,...,pn); mdaqAOScanTrigger(linkID, triggerType, p1,...,pn);
This function configures and sets a trigger for analog output scan session. If a trigger is used, after starting analog output scan with mdaqAOScanStart() scan operation is blocked until certain condition defined by trigger occurs. In this state, signal is not generated on analog outputs. Blocked scan session can be interrupted by calling mdaqAOScanStop(). The mdaqAOScanTrigger() function can be called only after scan initialization function mdaqAOScanInit() call and before scan start function mdaqAOScanStart() call. When scan session uses a trigger, function mdaqAOScanIsDone() or mdaqAOScanWait() can be use to check if signal generation is done or wait until signal generation operation is done. When trigger is used it is recommended to use mdaqAOScanWait() with timeout different than -1 (infinity) this will prevent from freezing Scilab in the case when the trigger will not occur. Only one trigger type can be used for analog outputs scan session. When a function is called more then one time it will overwrite previous trigger configuration. Function mdaqAOScanInit() disables trigger.
The function allows configuring different trigger types which are defined by trigger type string.
Supported triggers types:
"none": disables trigger for analog output scan
"dio": trigger when state (0|1) is present on one of DIO1...8 digital input channel. /para>
Function parameters: p1 - DIO channel number in range 1...8, p2 - DIO state which which triggers AI scan start
"dioPattern": trigger when defined digital pattern matches DIO1...8 digital input channels state
Function parameters: p1 - DIO pattern string containing eight characters (x|1|0) defining desired DIO1...8 state. The 'x' character indicates that DIO is state is ignored, while 0 and 1 indicated low and high state respectively. DIO pattern defines DIO state in the following order DIO1, DIO2, DIO3, DIO4, DIO5, DIO6, DIO7, DIO8 e.g pattern '11xxxxxx' is related to DIO1 and DIO2 state.
"encoder": trigger when value of selected encoder module is greater or lower then provided value
Function parameters: p1 - encoder module number (1|2), p2 - encoder value, p3 - defines if trigger shall occur for value greater(1) or lower(0) then p2 argument
"dsp": trigger when DSP application is started on MicroDAQ DSP
"ai": trigger when AI scan session is started
linkID: Valid connection link id (optional)
triggerType: Trigger type string
p1,...,pn: Trigger parameters
dio trigger type - start to generate signal on AO1 analog output when DIO7 state is high
mdaqAOScanInit(1, [1 2 3 4 5]', [0, 5], %F, 10, 1) mdaqAOScanTrigger("dio", 7, 1); mdaqAOScanStart(); | ![]() | ![]() |
dioPattern trigger type - start to generate signal on AO1 analog output when DIO7 state is high
mdaqAOScanInit(1, [1 2 3 4 5]', [0, 5], %F, 10, 1) mdaqAOScanTrigger("dioPattern", "xxxxxx1x"); mdaqAOScanStart(); | ![]() | ![]() |
dioPattern trigger type - start to generate signal on AO1 analog output when DIO7 state is high and DIO6 is low
mdaqAOScanInit(1, [1 2 3 4 5]', [0, 5], %F, 10, 1) mdaqAOScanTrigger("dioPattern", "xxxxx01x"); mdaqAOScanStart(); | ![]() | ![]() |
encoder trigger type - start to generate signal on AO1 analog output when encoder value is greater then 1000
mdaqEncoderInit(1, 0, "quadrature"); mdaqAOScanInit(1, [1 2 3 4 5]', [0, 5], %F, 10, 1) mdaqAOScanTrigger("encoder", 1, 1000, 1); mdaqAOScanStart(); disp("Waiting until signal generation is finished") isTimeout = %f; try mdaqAOScanWait(10); catch isTimeout = %T; end if isTimeout then disp("Timeout") else disp("Success") end | ![]() | ![]() |
dspStart trigger type - synchronize AO scan start with DSP application start
aoStart trigger type - synchronize AO scan start with AI scan start