04-29-2009 10:35 AM
Question/situation: While my app is running, I'd like the user to be able to select, via a menu (similar to windows tools/options and/or some configuration menu) which would pop-up another vi/window, comm ports for 3 devices (potentially more) via a drop down list for each one. The dropdown lists would list the comm ports on the pc. The same comm port cannot be selected for more than 1 device (I can evaluate this when the save button is pressed). Following the save, I would then tell the user to restart the app (or I could force the "initialize" state again to read the .ini file), so the new comm port selections can be read and then used throughout.
I've read that perhaps this can be done with .ini files and the config-related vi's, but I'm struggling with how to get this started.
Background: my app has 2 loops: a state machine and queued event loop (reads stop and logging buttons, so far).
I'm a newbie and have been working with labview since the beginning of the year. Have taken basics and intermediate training. Looking to use "best-practice" methods/designs for this.
I'm using labview 8.6.
Any thoughts? Examples/tutorials to get me going?
Thank you in advance for your time and effort!
Anthony
04-29-2009 07:55 PM
Have you looked at the examples of configuration files?
Basically, the .ini file will look like this (you decide the actual format):
[CommPorts]
CommPort1=Comm1
CommPort2=Comm2
CommPort3=Comm3
When you read from the ini file, you hook up a section ( [CommPorts] ) and a Key (CommPort1). In this case, it would return Comm1. Now you do have to hook up the right type (in this case an empty string) to the default input of the read ini vi.
Also, you have to open the file (With the open config file VI) and close it (with the close config file VI). That's it. If you are using any of the other file I/O vi's you are going to have a difficult time and would probably be better off slamming your head into a brick wall.