- MASTEROPC UNIVERSAL MODBUS SERVER HOW TO
- MASTEROPC UNIVERSAL MODBUS SERVER SOFTWARE
- MASTEROPC UNIVERSAL MODBUS SERVER CODE
User defined URScript functions to simplify the process Calling write_port_register(128, modified_int) will set the value 733 in register address 128.
The converted value can be written to the Modbus TCP server register using the command write_port_register(, ). Modified_int = binary_list_to_integer(sample_list) = 733 This can be done using the URScript command binary_list_to_integer().Īfter modifying sample_list as above, converting it to an integer returns the value 733. Before the register can be updated with the modified value, the list must be converted back to an integer value. Converting a list back to an integer valueīecause sample_int and sample_list are program variables, manipulating them in our program does not change the value of the Modbus TCP server register.Sample_list = integer_to_binary_list(725) Using a list allows us to accurately read or set a single bit regardless of the current value of entire register. Because lists use zero-indexing, the first element is accessed as sample_list and the third by sample_list. This list is the equivalent of the binary value 0b0000 0010 1101 0101 except the list uses little-endian notation, meaning the value of the first element is the least significant bit.Įach element of the list can be accessed or modified using standard list bracket notation. Sample_list = integer_to_binary_list(725) = This command returns a list of True and False values. This can be done using the URScript command integer_to_binary_list(). If the goal is to treat each bit in the 16-bit register as an individual on/off (binary) signal and only change one bit at a time, this is best accomplished by converting the integer value to a binary list. Converting integer values to binary lists.For example, which bits are affected when adding an integer changes depending on the current status of those bits:ģ3 (0b0010 0001) + 8 (0b0000 1000) = 41 (0b0010 1001)
MASTEROPC UNIVERSAL MODBUS SERVER CODE
This integer value can be modified directly by adding or subtracting other integers but this method is prone to mistakes and code written this way is difficult to read. This command will return an integer value between 0 – 65535. Modbus TCP server registers can be read from a program using the URScript command read_port_register(). Reading values from the Modbus TCP server registers.A complete description of these commands and user-defined functions can be found in the URScript Manual. This guide also introduces sample user-defined URScript functions to facilitate the use of the above commands. This process allows you to treat each bit as an individual on/off signal.
MASTEROPC UNIVERSAL MODBUS SERVER HOW TO
This guide explains how to use the following URScript commands to 1) read an integer from a server register, 2) convert it to an easily modifiable list, 3) converted the modified value back to an integer, and 4) write the modified value to a server register. The following method is a recommended approach for accessing each bit individually and maintaining a readable program. Up to 16 on/off or other binary signals can be consolidated in a single register instead of using a different address for each. Universal Robots’ Modbus TCP server provides 128 general purpose 16-bit registers (addresses 128-255).
MASTEROPC UNIVERSAL MODBUS SERVER SOFTWARE
Note that older or newer software versions may behave differently.īinary signals using the Modbus TCP server