Within the Configuration view, ArConfig contains the Runtime Configuration. The Runtime configuration includes all sorts of useful information, including the unit's assigned IP address, host name, subnet mask, and much more. These functions serve to be extremely useful when configuring a device.
However, if you want to change these setting from the HMI of a unit, there are a few more steps involved.
- In the Logical view, add the AsARCfg library to your global libraries.
- This libary contains functions that will let you read/write ArConfig settings, such as CfgGetSubnetMask(), CfgSetIPAddr(), and many more.
- In a program, create the function block to set parameters and call the desired function.
- Link the proper tags to the HMI to create a display/input field to view/change the ArConfig Parameter.
Below I have an example of using both the CfgGetIPAddr() and CfgSetIPAddr() functions. Upon entering a new IP address and hitting the change button, I am changing the current IP address and re-updating the gray text box. The change button is setting the IPSet boolean, the new box contains the NewIPTemp string, and the gray box contains the NewIP string. In the program, the CfgSetIPAddr_1 has a data type of CfgSetIPAddr, and the CfgGetIPAddr_1 has a data type of CfgGetIPAddr.
IF IPSet THEN
CfgSetIPAddr_1.enable := 1;
CfgSetIPAddr_1.pDevice := ADR(pDevice);
CfgSetIPAddr_1.pIPAddr := ADR(NewIPTemp);
//Once IP is finished, re-read current
IF CfgSetIPAddr_1.status = 0 THEN
CfgGetIPAddr_1.enable := 1;
CfgGetIPAddr_1.pDevice := ADR(pDevice);
CfgGetIPAddr_1.pIPAddr := ADR(NewIP);
CfgGetIPAddr_1.Len := 20;
//Once new readout is done, finished
IF CfgGetIPAddr_1.status = 0 AND CfgSetIPAddr_1.status = 0 AND IPSet THEN
IPSet := FALSE;
CfgGetIPAddr_1.enable := 0;
CfgSetIPAddr_1.enable := 0;
Overall, with these functions, B&R units are extremely flexible and easily customized from an HMI screen.
Want to check out more B&R? See what else we've written about here.
Learn more about DMC's B&R Automation Studio Programming services.