Master function

Write and read access to various slaves is possible using the F145 and F146 instructions. Individual access to each slave as well as global transmission is possible.

  1.  (1) Master
  2.  (2) Slave

Procedure for master communication

  1. Set communication parameters

    Required settings: communication mode (MEWTOCOL-COM or Modbus RTU), station number, baud rate, communication format

  2. Execute write or read instruction

    Use one of the following instructions:

    Instruction

    Application

    Restrictions

    F145_WRITE_DATA

    Easy to use for communication with Panasonic devices supporting the MEWTOCOL-COM or Modbus RTU slave function

    Devices must have matching address areas

    F146_READ_DATA

    F145_WRITE_DATA_TYPE_OFFS

    F146_READ_DATA_TYPE_OFFS

    F145F146_MODBUS_MASTER

    For communication with any device supporting the Modbus RTU protocol

    For station numbers 1–99 only, start register range of 0–32764

    Start register range of 0–65535

  3. Evaluate flags

    Use one of the following instructions:

    Method

    Comment

    IsF145F146NotActive

    Returns the value of the "F145/F146 not active" flag. It is TRUE if the execution of an F145 or F146 instruction is possible because neither instruction is active.

    sys_bIsComPort1F145F146NotActive

    sys_bIsComPort2F145F146NotActive

    These system variables are TRUE if the execution of an F145 or F146 instruction is possible because neither instruction is active.

    IsF145F146Error

    Returns the value of the "F145/F146 error" flag. It is TRUE if the execution of an F145 or F146 instruction has terminated with an error.

    sys_bIsComPort1F145F146Error

    sys_bIsComPort2F145F146Error

    These system variables are TRUE if the execution of an F145 or F146 instruction has terminated with an error.

    sys_wComPort1F145F146ErrorCode

    sys_bIsComPort2F145F146ErrorCode

    These system variables contain the error code if transmission has terminated with an error.
NOTE

The optional user library NCL-MODBUS-LIB for Control FPWIN Pro offers the most complete Modbus functionality, including function blocks for multi-master and multi-slave applications. The library can be used with the FPS Serial Data Unit and the FP2/FP2SH Multi-Communication Unit.

Related topics:

Modified on: 2022-01-13Feedback on this pagePanasonic hotline