6. RAS FEATURES IN HF-W100E/IoT
6-12
6.2.3 Examples of using the RAS library
This subsection describes how to control the external general purpose I/O from applications
running on the CODESYS runtime environment.
Adding the RAS library
Add the RAS library. For information about how to add the RAS library, the library
functions, see “6.2.2 Adding the RAS library”.
Implementation of a program using the RAS library
Implement a program. “(1) General purpose external I/O” shows an example of using the
RAS library.
(1) General purpose external I/O
The following is an example of using the RAS library for the external general purpose
I/O.
<Variables in use>
Table 6-8 shows a list of variables declared in VAR.
Table 6-8 Variables Used in the External General Purpose I/O Functions
Type
Name
Use
INT
uiState
Determines the execution state.
USIINT
dwDO_port
Specifies the output state for the external general
purpose outputs.
USIINT
dwDO_cmd
Specifies which external general purpose outputs to
control.
USIINT
dwDI_port
Variable used for acquiring the input state of the
external general purpose inputs.
DWORD
dwResult_out
Result of the external general purpose output
DWORD
dwResult_in
Result of the external general purpose input
<Functions to use>
Table 6-9 shows which external general purpose I/O functions are used.
Table 6-9 External General Purpose I/O Functions
Function name
Use
GendoControlN
Used for controlling the output of the specified external general
purpose.
(For details about the function interface, see “6.2.1 RAS library
interface (1) Control function for the external general purpose
outputs (GendoControlN)”.)
GetGendiN
Used for getting the status of the input of the specified external
general purpose.
(For details about the function interface, see “6.2.1 RAS library
interface (2) Get function for the external general purpose inputs
(GetGendiN)”.)