Universal Robots Forum

Read Bit from 16 Bit Modbus Register mapped to General purpose 16 bit registers [Doc 16377]

Hi,

according to Modbus Server Article the UR has 128 GP Modbus Registers which can be used for communication.

Currently, we have a application using Profinet (on PLC Master Side and other Slaves) and Modbus (for UR Slave only, because there is still no option to access Fieldbus GPIO Registers with the Java API).

My Aim is to Access Single Bits with the script function read_port_bit and write_port_bit. The Doc says it is possible to use the Coil Nr - which in the case of the first General Purpose Register is Adress 2048. When i use this Adress like below:

the bit cannot be changed (Value Mark) - ofc on the real robot (Sim is just for example)

Is it even possible to access Single Bits from the Registers with the Coil Adress and add them with the Adress Name (to Access that one with the API)?

Or do i have to convert every 16 Bit Modbus Register to Access a Coil?

Thank You! :slight_smile:

in other words: read_port_bit or write_port_bit does not work with bit (coil) adresses higher than 255 (Getting Modbus Error with Status Message “2”) - although there are more than 1024x16 Bits to read…

Is this a bug?

Hello everyone,

we had this problem with the Fieldbus GPIOs here as well for a couple of times. Things could be much easier if the Java API has direct access to the Fieldbus GPIOs.

Is there a feature request about this topic?

Regards,
Andreas

well, that was your topic once :smiley:

@jbm Any news regarding this?

I think it as something unavoidable that the value of GPIOs cannot be obtained by java api.
So I had created the urcap for reading and writing GPIOs and published on github repository.

Hey Takaaki,

i like your solution but having to send robot programs over the real time interface is not a solution for real real-time applications. Its latency is just too high! :wink:

Also, RTDE has less priority than polyscope (messages will not be sent when polyscope has a high performance load).

Therefore a native GPIO Java Interface should be best

How long is your expected latency?

I recently got Modbus I/O working myself so let me see if my issues help you.

I am doing Modbus UR <=> Mits PLC

The Modbus Server link you posted is exactly that, It is only vaild for the UR to be the Server (master) and was not accessible to write to from my PLC Master.

In my application, I was able to setup the UR as both a Slave and Server. I use my PLC to read status data from the locations listed on that Server Article (above) and setup the UR as a slave with individual Inputs/ Outputs / Registers

URModbus1 URModbus2

Hi,

what also confuses me is the naming of slave = server and client = master according to the UR doc, which differs from your explaination.

What i want to do is read the UR‘s input registers from the URCap API (localhost adress) which are changed by the plc. That means i have to read Registers 128 - 255. but how do i access Single Coils with a Name if i can‘t setup a Adress higher than 255 for both registers and bits? When i use a higher adress it says my modbus device is disconnected

Hi Takaaki,

It should be less than 50 ms. So using robot background programs just to set gpios is no option.

Yeah the Server/Master/Slave… confused me too. After about 5 days of messing with it this is what worked. Both my PLC & UR see all the inputs & outputs as single bits, and registers work too

The way i set it up, the inputs are all accessible directly in jobs and should show up to the URCap just like a standard Input signal does.