Modbus Com Lib
Modbus Com Lib
WAGO-I/O-PRO 32 Library
Mod_com.lib
Contents
ADD_DESC (Data type)..............................................................................2
ADD_PI_INFORMATION..........................................................................4
CRC16..........................................................................................................6
FBUS_ERROR_INFORMATION...............................................................7
GET_DIGITAL_INPUT_OFFSET..............................................................8
GET_DIGITAL_OUTPUT_OFFSET........................................................10
KBUS_ERROR_INFORMATION............................................................12
MOD_COM_VERSION ............................................................................13
MODULE_INFO (Data type) ....................................................................15
MODULE_INFO_ACCESS (Data type) ...................................................16
PI_INFORMATION ..................................................................................18
READ_INPUT_BIT...................................................................................19
READ_INPUT_WORD .............................................................................20
READ_OUTPUT_BIT...............................................................................21
READ_OUTPUT_WORD .........................................................................22
SET_DIGITAL_INPUT_OFFSET ............................................................23
SET_DIGITAL_OUTPUT_OFFSET ........................................................25
SLAVE_ADDRESS...................................................................................27
WRITE_OUTPUT_BIT .............................................................................28
WRITE_OUTPUT_WORD .......................................................................29
Header:
TYPE ADD_DESC :
STRUCT
posPAA : WORD;
posPAE : WORD;
sizePAA : BYTE;
sizePAE : BYTE;
channels : BYTE;
altFormat : BYTE;
END_STRUCT
END_TYPE
This data type is a structure and provides more detail process image information
regarding a module.
ADD_PI_INFORMATION
TRUE:
The function was successfully
performed.
Graphic display:
Time behaviour:
Function description:
Using this function more detailed process image information can be determined
regarding the modules (see components of the structure MODULE_INFO).
VAR
access : MODULE_INFO_ACCESS;
info : ARRAY[0..63] OF MODULE_INFO;
END_VAR
access.physicalPosTo := 0;
access.moduleType := 0;
CRC16
Graphic display:
Time behaviour:
INPUT
EN
CRC
Function description:
The CTC 16 function block calculates the CRC16 value for a number of input bytes.
FBUS_ERROR_INFORMATION
Graphic display:
Time behaviour:
Function description:
This function block offers the programmer the possibility to obtain information on the
status of the fieldbus communication. The values of the ERROR output are fieldbus
specific.
With MODBUS for instance, the current status of the communication monitoring
(Watchdog) is indicated. (0: no error, 1: Watchdog has detected „time exceeded".)
GET_DIGITAL_INPUT_OFFSET
Header:
FUNCTION_BLOCK GET_DIGITAL_INPUT_OFFSET
VAR_OUTPUT
DIG_IN_OFFSET: WORD;
ERROR: WORD;
END_VAR
Graphic display:
Time behaviour:
Function description:
This function reads the current value of the saved address offset for the digital
inputs. The value is pre-assigned with the function block
SET_DIGITAL_INPUT_OFFSET and permanently saved in the controller. The read
value is identical with the pre-assigned value. In case of a fault the output ERROR of
the FB is set to a value not equal to 0. No communication takes place between the
controller and the modules. This status is displayed via the blink code 10 by the blink
argument 1 on the IO LED of the controller.
The default value when supplying the controllers is 0. As the value is saved
permanently, for safety reasons the value should be set once again in the user
program.
The current start address for the bits of the digital inputs can be interrogated with the
FB PI_INFORMATION. The output INPUTBITS_OFFSET emits the value.
GET_DIGITAL_OUTPUT_OFFSET
Header:
FUNCTION_BLOCK GET_DIGITAL_OUTPUT_OFFSET
VAR_OUTPUT
DIG_OUT_OFFSET: WORD;
ERROR: WORD;
END_VAR
Graphic display:
Time behaviour:
Function description:
This function reads the current value of the saved address offset for the digital
outputs. The value is pre-assigned with the function block
SET_DIGITAL_OUTPUT_OFFSET and permanently saved in the controller. The
read value is identical with the pre-assigned value. In case of a fault the output
ERROR of the FB is set to a value not equal to 0. No communication takes place
between the controller and the modules. This status is displayed via the blink code
10 by the blink argument 1 on the IO LED of the controller.
The default value when supplying the controllers is 0. As the value is saved
permanently, for safety reasons the value should be set once again in the user
program.
The current start address for the bits of the digital outputs can be interrogated with
the FB PI_INFORMATION. The output OUTPUTBITS_OFFSET emits the value.
KBUS_ERROR_INFORMATION
Graphic display:
Time behaviour:
Function description:
This function block offers the programmer the possibility of receiving information
about the condition and configuration of the internal bus.
MOD_COM_VERSION
Graphic display:
Time behaviour:
EN
MOD_COM_VERSION
Function description:
The function of the MOD_COM_VERSION returns the current version number of the
library. This function can be used during the program development for information. In
addition version conflicts during the running time can be avoided.
Version: Description:
1.0 First version
1.1 The function blocks READ_OUTPUT_WORD and
READ_OUTPUT_BIT were supplemented.
2.0 The function blocks GET_DIGITAL_INPUT_OFFSET,
GET_DIGITAL_OUTPUT_OFFSET,
SET_DIGITAL_INPUT_OFFSET and
SET_DIGITAL_OUTPUT_OFFSET were supplemented.
Header:
TYPE MODULE_INFO :
STRUCT
physicalPos : BYTE;
moduleType : WORD;
desc : ADD_DESC;
END_STRUCT
END_TYPE
This data type is a structure and supplies extended process image information with
regard to a module.
For digital modules no exact module designation can be determined. For this reason
the 'module type' assumes one of the following values:
16#00D0: This digital module does not assume any bits in the PLC input or output
process image.
16#00D1: This digital module only occupies bits in the input process image of the
PLC
16#00D2: This digital module only occupies bits in the output process image of the
PLC
16#00D3: This digital module occupies bits in the input and the output process
image of the PLC.
Header:
TYPE MODULE_INFO_ACCESS :
STRUCT
physicalPosOf : BYTE;
physicalPosTo : BYTE;
typeNumber : BYTE;
moduleType : WORD;
window : WORD;
END_STRUCT
END_TYPE
This data type is a structure and indicates which module more detailed process
image information is to be determined.
physicalPosTo <> 0:
Determine more detailed module information from 'physicalPosOf' to
'physicalPosTo'. 'physicalPosOf' and 'physicalPosTo' may be identical.
Example:
rd
Determine information for the 3 connected module of type 750-650/651/652/653:
physicalPosTo = 0
typeNumber = 3;
moduleType = 650;
window = 3;
PI_INFORMATION
Graphic display:
Time behaviour:
Function description:
This function block offers the programmer the possibility to obtain information about
the structure of the process image.
READ_INPUT_BIT
Graphic display:
Time behaviour:
WORD_ADDRESS
BIT_ADDRESS
VALUE
ERROR
Function description:
This function block offers the programmer the possibility of indirect access to the
process image. The current value of the input bit is made available immediately after
invoking the FB at the outputs. The function block must be used with particular care
as here the guidelines of IEC 61131-3 „all addresses are assigned at the time of
programming and during the running time“ are not adhered to.
READ_INPUT_WORD
Graphic display:
Time behaviour:
WORD_ADDRESS
VALUE
ERROR
Function description:
This function block offers the programmer the possibility of indirect access to the
process image. The current value of the input word is made available immediately
after invoking the FB at the outputs. The function block must be used with particular
care as here the guidelines of IEC 61131-3 „all addresses are assigned at the time
of programming and during the running time“ are not adhered to.
READ_OUTPUT_BIT
Graphic display:
Time behaviour:
WORD_ADDRESS
BIT_ADDRESS
VALUE
ERROR
Function description:
This function block offers the programmer the possibility of indirect access to the
process image. The current value of the output bit is made available immediately
after invoking the FB at the outputs. The function block must be used with particular
care as here the guidelines of IEC 61131-3 „all addresses are assigned at the time
of programming and during the running time“ are not adhered to.
READ_OUTPUT_WORD
Graphic display:
Time behaviour:
WORD_ADDRESS
VALUE
ERROR
Function description:
This function block offers the programmer the possibility of indirect access to the
process image. The current value of the output word is made available immediately
after invoking the FB at the outputs. The function block must be used with particular
care as here the guidelines of IEC 61131-3 „all addresses are assigned at the time
of programming and during the running time“ are not adhered to.
SET_DIGITAL_INPUT_OFFSET
Header:
FUNCTION_BLOCK SET_DIGITAL_INPUT_OFFSET
VAR_INPUT
EN: BOOL;
DIG_IN_OFFSET: WORD;
END_VAR
VAR_OUTPUT
ENO: BOOL;
ERROR: WORD;
END_VAR
Graphic display:
Time behaviour:
EN
DIG_IN_OFFSET
ENO
ERROR
Function description:
This function sets the address offsets current value for the digital inputs. The
changed configuration is used when reading the input PA during the next PLC cycle.
The value is permanently saved in the controller.
When entering an invalid offset value the controller transmits the blink code 10 with
the blink argument 1. The data exchange between the controller and the modules is
stopped.
The default value when supplying the controllers is 0. As the value is saved
permanently, for safety reasons the value should be set once again in the user
program.
SET_DIGITAL_OUTPUT_OFFSET
Header:
FUNCTION_BLOCK SET_DIGITAL_OUTPUT_OFFSET
VAR_INPUT
EN: BOOL;
DIG_OUT_OFFSET: WORD;
END_VAR
VAR_OUTPUT
ENO: BOOL;
ERROR: WORD;
END_VAR
Graphic display:
Time behaviour:
EN
DIG_OUT_OFFSET
ENO
ERROR
Function description:
This function sets the address offsets current value for the digital outputs. The
changed configuration is used when writing the output PA during the next PLC cycle.
The value is permanently saved in the controller.
When entering an invalid offset value the controller transmits the blink code 10 with
the blink argument 2. The data exchange between the controller and the modules is
stopped.
The default value when supplying the controllers is 0. As the value is saved
permanently, for safety reasons the value should be set once again in the user
program.
SLAVE_ADDRESS
Graphic display:
Time behaviour:
Function description:
This function block allows the programmer access to the address set on the
programmable fieldbus controller. The address is made available when invoking the
FB.
WRITE_OUTPUT_BIT
Graphic display:
Time behaviour:
WORD_ADDRESS
BIT_ADDRESS
VALUE
ERROR
Function description:
This function block offers the programmer the possibility of indirect access to the
process image. The current value of the output bit is made available immediately
after invoking the FB. The function block must be used with particular care as here
the guidelines of IEC 61131-3 „all addresses are assigned at the time of
programming and during the running time“ are not adhered to.
WRITE_OUTPUT_WORD
Graphic display:
Time behaviour:
WORD_ADDRESS
VALUE
ERROR
Function description:
This function block offers the programmer the possibility of indirect access to the
process image. The current value of the output word is made available immediately
after invoking the FB. The function block must be used with particular care as here
the guidelines of IEC 61131-3 „all addresses are assigned at the time of
programming and during the running time“ are not adhered to.