modbus_set_output_register(signal_name, register_value, is_secondary_program=False)

Sets the output register(s) signal identified by the given name to the given value.

>>> modbus_set_output_register("output1",300,False)

Parameters

signal_name: A string identifying an output register signal that in advance has been added. Can not be empty.

register_value: An integer which must be a valid word (0-65535) value or a list of integer values. The list can not be empty. The size of the list must be less than 123 and must be equal or less to the signal's declared register count. Note: if a shorter list is given as an input, then registers with greater indexes will keep previous value

is_secondary_program: A boolean for internal use only. Must be set to False. (Optional, false by default)

Example command 1: modbus_set_output_register("output1", 300, False)

  • Example Parameters:
    • Signal name = output1
    • Register value = 300
    • Is_secondary_program = False (Note: must be set to False)

Example command 2:

modbus_add_signal("127.0.0.1", 255, 0, 16, "output2", False, 10)

list_var:=[10,9,8,7,6,5,4,3,2,1]

modbus_set_output_register("output2", list_var)

  • Example Parameters:
    • Signal name = output2
    • Register values = 10,9,8,7,6,5,4,3,2,1
    • Is_secondary_program = False by default