Writing in an empty register

How do i write information in 1 of the empty registers for example register 203. And how do I implement it in a code, that is already made in the teach panel?

Are you trying to write to the register from an external device like a PLC, PC, or MODBUS? If so there’s a little bit of work involved on the external device. Otherwise if you just need to key in some info and use it/update it during program execution on polyscope, just name the register you want to use using the Installation tab and then it will show up in your Set commands or be accessible through the Assignment instruction.

No I just want the information when my if statement is true to be written in the register. Can I also do this on the teach panel? I am new with the universal robots, and need to add this to someone else his code who is not here anymore.

You can simply create a variable in the installation tab. then write your data to it (Boolean, Integer or Float)
then re use it in the code later.

I’d suggest you visit the online training. see https://academy.universal-robots.com/

thanks for the information

Hi I tried this but I dont see any changes, I don’t know what I did wrong. I named the registersan set the commands. But it does not write the information in the registers. And I dont see the Name of the register when I try to use the assigment instruction. I really dont know what I did wrong I could upload a picture it that helps.

What is it you’re calling “registers”? :slight_smile: Variables? The term “registers” are mainly used when working with data exchange with external equipment, when it comes to UR.

As already advised, it might be a good idea to do the free, online training to get a good grasp of programming UR robots.

I am trying to fill in the register adress so I can send the data to a schenider PLC and after that display it in SCADA.

I already did the online training and It did help me with programming the other things i needed but still stuck with filling in the register adresses.

Alright. We needed that information. :slight_smile:

Are you using MODBUS or Ethernet/IP?

MODBUS will have to be filled in the MODBUS tab in the Installation, and then you can access the registers in your program.

For Ethernet/IP, you will need to set up the registers:
If you go to Installation and I/O Setup, you will find General Purpose variables (GP) both input and output. If you rename a GP variable, you will be able to write to that register with a Set command within your program.
Then you can write to the output registers and read the corresponding address in your PLC.
There’s an article about it here: Ethernet IP guide - 18712 - collaborative robots support

I am working with MODBUS. I already filled in th MODBUS tab in the installation but I did eccess my register in the program but the robot is not writing it in the register i think I am using the wrong code. Or I did something else wrong I uploaded pictures of the register and the programm were I use it.
positie
register

Hmm. I don’t see anything wrong from the images.

You’re aware that it’s a subprogram and not a thread, which you put your code in, right? Just a long shot. :slight_smile:

You can save your program and installation on a USB drive and then upload it in here. Then someone can take a look at it.

yes I do know that.

Here is my program.

HoofdprogrammaV5_comments.script (44.5 KB)

Can you save the urp and installation to a USB instead and upload here?

Just insert a USB drive and Save As onto it. :slight_smile:

Hi @michl

From what i have get from the conversation: I think you are actually not reading/writing the value in the Modbus addresses that you have made.

For example: To read the position value from PLC.
After line 173 of your code, you should add a script:

current_pos[0]=read_port_register(200) and then add your line 174.
(provided you have defined the variables)

Similarly, to write the output to MODBUS:
After line 175 add : write_port_register(201,current_y_pos) and
after line 176 add: write_port_register(202,current_z_pos)

Please make sure the set up on the PLC and SCADA side are correctly linked as in same address, holding registers etc.
I hope this helps a bit in what you are trying to achieve.

I tried to save it onto the usb but i am getting an error that it is an external storage device and I need to verigy it is attached

I used another USB drive and it worked I hope these are the files u were talking about.

HoofdprogrammaV6_comments.urp (67.5 KB)
default.zip (526.3 KB)

I can’t tell what would be wrong. I sadly don’t have a MODBUS connection to try it with.
I hope someone else can assist you. :slight_smile:

I tried to save it onto the usb but i am getting an error that it is an external storage device and I need to verigy it is attached