LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial port number savings in .ini file (executable with application builder)

Hello,

I have a builded application (with Application builder) that uses a serial port.

I want to save the last serial port number used in an .ini file when I close the executable.
So, I can use the same number for the next use of the application

How can I use the .ini file to configure the VISA resource name control ?

More generally: is there any documentation for the .ini file for executable ?

Thx,
0 Kudos
Message 1 of 37
(4,683 Views)
Hi etillol,
you can find the VIs you need in the "Configuration file VIs"- palette, it's located in the file-IO palette. To save the serial port, you could make a VI looking similar to this:



Hope, this helps,
dave

Message Edited by daveTW on 11-06-2006 11:52 AM

Greets, Dave
0 Kudos
Message 2 of 37
(4,675 Views)
That's what I need!

thanks a lot!
0 Kudos
Message 3 of 37
(4,665 Views)

Hi dave 

I am trying something similar I guess you could help

 

I want to change or control VISA Config  controls (visa resource name, parity, stop bit, etc) through .ini file when I create a Executable.

I tried deploying VISA resource settings from the properties of the Build->executable and it does create .ini file with the .exe application but not taking or reading the changes I do in config.ini file(which is created while building .exe )

I needed this because when I connect different usb cable or in different usb socket COM value changes . I need to check the COM value from Device Manager and I want to simply edit this .ini file part where COM value is stored to the one I am using. 

Hope you get the point I am trying to make.

 

Thanks and Regards

Baig

 

 

 

0 Kudos
Message 4 of 37
(3,491 Views)

Hi Baig,

 

you need to read those INI keys on your own and set the parameters for VISAOpen with them.

 

As has been asked in your other threads too: Attach your VI so we can give recommendations on how to improve it!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 37
(3,479 Views)

The ini file generated by Application Builder is normally created brand new every time, however you can define your own file in the Advanced tab of the Application properties (see the Use custom configuration file option). The custom ini file must be added to the project before.

Another possibility is to use an alternative ini file. Personally I prefer not to mix my settings with LabVIEW settings. I always define an application folder (e.g. C:\MyApp or similar to be located in the Windows user folder), where all settings and data will be stored/retrieved. My ini file would be typically located in the MyApp\Config folder.

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 37
(3,457 Views)

Hi GerdW

 

I am attaching the VI that has a glimpse of how I am using VISA communication for RS232 protocol. Since  my main application have many subvi's and .cntls and would be like troubling you guys more for no reason.

 

In the second tab of tab control there are bunch of VISA config controls. I want these controls to be changed from .INI file so that i can completely  remove them from FP.

In my application com port, baud rate and stop bit are the things I might need to Change for every run.

 

Thanks and Regards

Baig

 

 

 

Download All
0 Kudos
Message 7 of 37
(3,434 Views)

I think the recommendation from MS is to not write/use the Program Files-folder for dynamic data. Instead, use the File variable block (i don't remember the name) to point to 'Public program data' (which gives the %programdata% folder) and create a structure from there, such as %programdata%\[company name]\[program name]\setup.ini

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 37
(3,422 Views)

Can you explain with example please

 

Thanks and regards 

Baig

0 Kudos
Message 9 of 37
(3,405 Views)

Yamaeda simply reminds you that Microsoft's recommendation is not to write application data into the %ProgramFiles% subfolders, use %ProgramData% instead.

Here is is an example following his suggestion:

 

example1.png

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 10 of 37
(3,388 Views)