Difference between revisions of "INI File Usage"

From AdvancedHMI
Jump to: navigation, search
(INI File Usage)
(INI File Usage)
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
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 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. The allows many different drivers to pull their settings from a single file. This is an example of the contents of an INI file:
+
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]
+
[EthernetIPDriver]<br>
 
IPAddress=192.168.0.1
 
IPAddress=192.168.0.1
  
Line 16: Line 16:
 
To add an INI file to your solution, follow these steps:
 
To add an INI file to your solution, follow these steps:
  
1) In Solution Explorer, right click the AdvancedHMI project
+
1) In Solution Explorer, right click the AdvancedHMI project<br>
2) Select Add->New Item
+
2) Select Add->New Item<br>
3) In the pop up window, select the Text File
+
3) In the pop up window, select the Text File<br>
4) Give it the name you wish to use with an ini extension (e.g. PLCConfig.ini), then click the Add button
+
4) Give it the name you wish to use with an ini extension (e.g. PLCConfig.ini), then click the Add button<br>
5) In Solution Explorer click once on the new file to select it
+
5) In Solution Explorer click once on the new file to select it<br>
6) In the Properties Window, set Copy To Output Directory to Copy if newer
+
6) In the Properties Window, set Copy To Output Directory to Copy if newer<br>
7) In Solution Explorer, double click the new ini file to open in the text editor
+
7) In Solution Explorer, double click the new ini file to open in the text editor<br>
8) Add your settings following the format shown above
+
8) Add your settings following the format shown above<br>

Latest revision as of 08:43, 3 September 2016

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