The analog input sampling logic can work in either asynchronous or synchronous mode.
In asynchronous mode the sampling occurs in the background, so that execution of BEGIN/END/UPDATEIO is not blocked waiting for a new sample. This mode means that a new sample is not always present in each BEGIN/END iteration.
In synchronous mode the sampling occurs at the time of the call to BEGIN/END/UPDATEIO, and means that in each new iteration of a new sample is guaranteed.
With the synchronous mode a higher sampling rate and better control of the sampling can be achieved.
The default mode is asynchronous, which for most applications will work as expected.
Input:
sync : bool (default false)
Selects synchronous or asynchronous mode of analog input sampling.
Returns: INT
0
|
Successful.
|
1
|
Not supported.
|
Declaration:
FUNCTION boardSetAIMode : INT;
VAR_INPUT
sync : BOOL;
END_VAR;
Example:
INCLUDE rtcu.inc
PROGRAM test;
boardSetAIMode(sync := TRUE);
BEGIN
END;
END_PROGRAM;
|