Below are the main services to declaring I/O Boards.
Declaration:
paCreateIOBoard - Create an instance of an
IO device
paSetIOBoardComment - Set description text
for an IO device
paSetIOBoardParam - Set a parameter of an
IO board
paSetIOAlias - Define an alias for a
channel of an IO board
Working with existing I/O boards:
paEnumIOBoards - Enumerate IO boards
paGetIOBoardDesc - GetDescription of an IO
board
paDeleteIOBoard - Delete an instance of an
IO device
paDeleteAllIOBoards - Delete all IO
devices
Below are details about these functions:
OK := paCreateIOBoard (SLOT, DEVTYPE)
Parameters:
SLOT : DINT; | Slot number (0..255) |
DEVTYPE : STRING; | Name of the type of IO device |
OK : BOOL; | True if successful |
Description:
This function creates an instance of the specified IO device at the specified slot number
OK := paSetIOBoardComment (SLOT, COMM)
Parameters:
SLOT : DINT; | Slot number (0..255) |
COMM : STRING; | Description text |
OK : BOOL; | True if successful |
Description:
This function sets the comment text of the specified instance of an IO device.
OK := paSetIOBoardComment (SLOT, COMM)
Parameters:
BOARD : STRING; | Board name (e.g. '%QX0') |
PARAM : STRING; | Name of the parameter |
VALUE : STRING; | Value of the parameter |
OK : BOOL; | True if successful |
Description:
This function sets the value of an IO board parameter. Refer to OEM instruction for details about available parameters.
OK := paSetIOBoardComment (SLOT, COMM)
Parameters:
CHANNEL : STRING; | Channel name (e.g. '%QX0.1') |
ALIAS : STRING; | Readable name to be used as an alias for the channel |
OK : BOOL; | True if successful |
Description:
This function defines a readable name for the specified IO channel. The alias can then be used in place of the "%" name in programs.
function block: Inst_paEnumIOBoard (LOAD, CHECK, ITEM, FILTER)
Input parameters:
LOAD : TRUE; | If TRUE, load the list of boards |
CHECK : BOOL; | If TRUE, open a checklist box to select some of the loaded boards |
ITEM : DINT; | Index of the item wanted on input (1 based) |
Ouputs:
NB : DINT; | Number of boards |
Q : STRING; | Name of the item selected with "ITEM" |
Description:
This function block is used for enumerating the IO boards of the target project. You must first call it with LOAD input at TRUE in order to load the list of IO boards. You get the number of boards in the NB output. Then call it again with LOAD at FALSE and specifying the index of the wished structure in the ITEM input to get the name of the selected item in the Q output. The numbering of items starts at 1.
For complex IO devices, only the child boards of the device are listed. The complex device itself does not occur in the list.
After loading, if can call again the block with the CHECK input at TRUE for opening a dialog box where the user can check wished boards. After the box is closed, only checked items remain in the loaded list.
Example:
// "ENU" is a declared instance of
paEnumIOBoard function block
// load all boards
ENU (TRUE, FALSE, 0);
// open a dialog box for
the user to check wished items
ENU
(FALSE, TRUE, FALSE, 0);
// enumerate checked
items
for i := 1 to ENU.NB do
//
select the item
"i"
ENU
(FALSE, FALSE, i);
//
get the name of the item specified by
"i"
sBoardName
:= ENU.Q;
end_for;
function block: Inst_paGetIOBoardDesc (NAME)
Input parameters:
NAME : STRING; | Name of the board (e.g. '%QX0') |
Ouputs:
OK : BOOL; | TRUE if successful |
NBCHANNEL : DINT; | Number of channels |
DEVNAME : STRING; | IO Device name |
DEVGROUP : STRING; | In case of a complex IO device, name of the group within the device |
COMMENT : STRING | Description text |
Description:
This function block is for getting information about an IO board of the target project.
OK := paDeleteIOBoard (SLOT)
Parameters:
SLOT : DINT; | Slot number (0..255) |
OK : BOOL; | True if successful |
Description:
This function deletes the specified instance of an IO device. In case of a complex device, the whole device (with all its groups) is removed.
OK := paDeleteAllIOBoards ()
Parameters:
OK : BOOL; | True if successful |
Description:
This function deletes all the existing instances of any IO device.