INI File Usage

From AdvancedHMI
Jump to: navigation, search

INI File Usage

The drivers include 2 properties to specify an INI file for setting the communication parameters when the application starts. This can be useful in a case where the IP address of the PLC may change and you want to change the HMI without having to re-compile. Another useful purpose is when using multiple forms with a driver that points to the same PLC. If your IP Address changes, it then will not be necessary to go to every driver instance.

The format of the INI file is a commonly used format with sections and attributes. This format allows many different drivers to pull their settings from a single file. This is an example of the contents of an INI file:


[EthernetIPDriver]
IPAddress=192.168.0.1


The name in brackets is the file section which would be specified in the INIFileSection property. Following the section declaration are the properties and values. This works for any of the driver properties. It is very important the spelling and casing of the property name matches exactly.


To add an INI file to your solution, follow these steps:

1) In Solution Explorer, right click the AdvancedHMI project
2) Select Add->New Item
3) In the pop up window, select the Text File
4) Give it the name you wish to use with an ini extension (e.g. PLCConfig.ini), then click the Add button
5) In Solution Explorer click once on the new file to select it
6) In the Properties Window, set Copy To Output Directory to Copy if newer
7) In Solution Explorer, double click the new ini file to open in the text editor
8) Add your settings following the format shown above