Loading...
This chapter shows how to use Modbus values in Widget Designer. To follow the examples, please set up a Master, a patch, or a patch element as explained in the previous chapters Modbus Master Configuration and Modbus Patch Configuration.
The Modbus data can be sent and received via two independent approaches: scripting and nodes. Both ways can be used at the same time, it depends on the application what suits your needs best.
For detailed information about the setup of the Modbus Input and Modbus Output node, please refer to the respective chapters.
The scripting members for each Master and its respective patches are available as soon as the Master setup is confirmed. Simply start writing the Master name and let the Script Assistant complete the text for you.
There are functional members available for connecting, reconnecting and disconnecting a complete Master to or from its hardware. Please see the below list for all available members and examples.
Furthermore, each patch can be addressed independently. All used patch names will be offered by the script assist after typing a dot behind the master name. Likewise, additional members for the patch can be accessed by setting another dot behind the patch name.
If you defined element names in the patch configuration, they will also be available here for retrieving or assigning values directly. Please note that all Modbus members are offered for all patch types, though the "Set" commands do not have any effect on patches configured as Input Contacts or Input Registers. Same goes for setting a value with an equal sign "=".
FHPP, Festo handling and positioning profile, is a data profile designed for handling and positioning tasks, e.g. executed by robot arms.
For more information about the profile itself and an exact description of the used byte structure, please visit Festo's website and take a closer look at the specifications:
https://www.festo.com/net/SupportPortal/Files/403824/CMM_-FHPP_2010-06a_555696g1.pdf
WD can use the Record Selection mode or the Direct mode. The Record Selection mode means that the flags CCON_OPM1 = 0 and CCON_OPM2 = 0 in the control byte are set. The same applies for the operation acknowledgment flags in the status byte, SCON_OPM1 and SCON_OPM2. For the Direct mode, the flags are set to CCON_OPM1 = 1 and CCON_OPM2 = 0. In Record Selection mode, you can access stored Motion Sets in the controller. In Direct mode, you can set absolute or relative position and velocity.
The Modbus Fhpp input node allows you to read out each flag, set for incoming control and status bytes, as well as the actual position value and input / output record number.
If you decide to send a value in Fhpp format, you can set (but also read out) each flag individually by accessing them via the patch members. An example is shown in the table below.
Please find here a table with all members available for Modbus. The commands can be entered in any scripting field.
Object |
Master Members |
Patch Members |
Example |
MasterName |
.Connect .Reconnect .Disconnect |
|
M1.Connect M1.Reconnect M1.Disconnect |
Select one of those members to connect, reconnect or disconnect the specified Master without having to open the Master List. |
|||
|
.PatchName |
|
M1.DigitalOut |
To access the members of a specific patch, select the respective patch name from the list. |
|||
|
|
.Get(ElementIndex or ElementName) |
Label1.Text = M1.DigitalOut.Get(0) Label2.Text = M1.DigitalIn.Get("A") |
Use the "Get" member to retrieve the current value of any single element of this patch, may it be configured as input or output. You can use the element's index as integer or its name as string if you have assigned one. |
|||
|
|
.Set(ElementIndex or ElementName) |
M1.DigitalOut.Set(1,0) M1.DigitalOut.Set("A",false) M1.AnalogOut.Set(0,11001) |
Use the "Set" member to set the value of one single element of this patch, it has to be configured as output. You can use the element's index as integer or its name as string if you have assigned one. Digital Output Coils can receive their output state either the integer "0" and "1" or as Boolean expression "true" and "false" |
|||
|
|
.SetMany(ElementIndex or ElementName, list of values) |
M1.DigitalOut.SetMany(0,[1,1,0]) M1.AnalogOut.SetMany("C",[13579,0,1001]) |
The "SetMany" member allows you setting the output value of several Coils or Registers of one patch at once. Specify the starting element and enter a list of values. The values will then be applied with each list element corresponding to a patch element consecutively following the start element. |
|||
|
|
.ElementName |
M1.DigitalOut.A = true M1.DigitalOut.B = 0 M1.AnalogOut.C = 556 Label1.Text = M1.AnalogIn.D Debugmessage(M1.DigitalIn.E.ToBoolean) |
Set or retrieve the current value of any single element of this patch, may it be configured as input or output. Setting a value effects only patches configured as output. To use this member, element names must have been set beforehand in the patch configuration. This member returns an object data type, so further data type specific members can be used. |
|||
|
|
.ccon_enable .cpos_jogp .out_recordset .position .scon_warn .spos_still ... |
M1.FhppOut.ccon_reset = true M1.FhppOut.spos_halt = 0 M1.FhppOut.in_recordset = 23 Label1.Text = M1.FhppIn.position |
Only available for Fhpp type patches. Set and retrieve each single flag of the control and status bytes of a message received in Fhpp format. You can do so by either using "0" and "1" as well as Boolean values. Also available are the input and output record set numbers (as byte value, 0 - 255) and the current position as 32bit integer value. |