Example: Reading out Modbus slave



Reading out from a UMG 103 using a UMG 604 with GridVis.

The Communication programming element module is required for the graphic programming of Modbus devices. This includes the elements Read/write Modbus or Profibus.

images/download/attachments/251036777/jasic-modbus-uebersicht-en-version-1-modificationdate-1692275797000-api-v2.png



Create the JASIC program (see JASIC start ).

Required components provided in the Palette window: Repeater, group, read Modbus, user variable (numeric).

images/download/attachments/251036777/jasic-modbus-en-version-1-modificationdate-1692275860000-api-v2.png



Configuration of the read Modbus function:

  1. Modbus function
    We use the Modbus function Read holding registers (fc=3) to read a value.

  2. Slave address
    Device address of slave. Here it is the UMG 103 address.

  3. Modbus address
    In the Modbus address list for the UMG 103, you will find the corresponding Modbus address for each measured value.

  4. Variables
    Add a variable via the Add value button.
    Assign the variable a name and select a format for the variable in accordance with the Modbus address list.
    Expand the variable list accordingly if other required variables follow the selected Modbus address directly.
    A new read Modbus function has to be added and configured for variables that do not come directly after the following variable addresses.

The Modbus functions used must be supported by both devices.

images/download/attachments/251036777/jasic-lese-modbus-en-version-1-modificationdate-1692275998000-api-v2.png



Configuration of the User variable function:

  1. Variable name
    The variable name must start with _gbl if this variable is to be used as a Global variable.

  2. Variable type
    The variable must be a Global variable type, in order to facilitate its access by other programs.

  3. Available for Modbus
    In the UMG 604, the Modbus address range 20000-32000 is reserved for user-defined variables.
    We have assigned the variable _gbl_ULN1 used in our example to the available address 20000.
    The next free address is 2004.

images/download/thumbnails/251036777/jasic-modbus-benutzervariable-en-version-1-modificationdate-1692276088000-api-v2.png