View Full Version : Vijeo Scripting

September 30th, 2010, 12:58 AM
I'm trying to figure out how to write a script to change the PLC address a variable points to when a button is pressed. For example, integer variable "int1" is setup as external and points to integer address %MW10 in a twido PLC. When a button is pressed on the Magelis screen, I'd like to change the plc address so that "int1" will now point to %MW20. Not sure if this can be done. Any advice?

September 30th, 2010, 03:48 AM
I don't know much about the twido, but you could create an array, then use a 'pointer' to index into the array, based on where you want it to be...

We do this all the time, and it works really well. I don't have time just now to post an example, but may get a chance over wknd.

September 30th, 2010, 03:58 AM
When you create a variable in Vijeo in the bottom right hand corner is a field called index (or offset or something like that) this allows indexed addressing to be used. Have a look, if you can't find ask again and I'll supply some more info when I get a chance

October 1st, 2010, 11:04 PM
I don't see the field called index. There is an offset field and into it you enter the word address in the plc. eg. %MW[Offset]

Attached is a screen cap of the create variable screen

October 2nd, 2010, 12:52 AM
Ok so my memory was a bit out
Use the Indirect Address field (tick the box) then enter the variable name and the value in this variable will act as an offset
eg if this variable has a value of 1 then you would be pointing to %MW51 (from your example)

October 2nd, 2010, 11:50 AM
Thanks for the tip GeoffC, it works smooth.