Jump to content

Help Needed with Configuration File (.ini) Control for Connection to DAQmx Virtual Channel


Recommended Posts

Dear All, 

I'm new to this forum and I'm really glad I became a member.

I am currently in the phase of designing a simple program which can control all the DAQmx channels using a configuration file (.ini) which is capable of change voltage range during mid-simulation. 

At the moment my .ini file reads as follows: 

[AO Channel 1] 

Name = T2

Physical Channel = cDAQ1Mod1/ao0

Max Value = 10 

Min Value = 0 

[AO Channel 2] 

Name = T3

Physical Channel = cDAQ1Mod1/ao1

Max Value = 10 

Min Value = 0 

[AO Channel 1] 

Name = T2

Physical Channel = cDAQ1Mod1/ao0

Max Value = 5 

Min Value = 0 

[AO Channel 2] 

Name = T3

Physical Channel = cDAQ1Mod1/ao1

Max Value = 10 

Min Value = 0 

My LabVIEW VI for the .ini script  is attached. I'm relatively new to using configuration file functions and I don't really understand where "Get Key Names" section should be wired to. I have placed a constant on it for now which reads the "AO Channel 1" but how can I get it to read all the channels in the .ini file.

I am welcome to all suggestions here, I just want to make sure that I don't cause any problems to any of the channels and use best practice methods. All constructive criticism welcome!

Thank you. 

 

 

iniblockdiagram.PNG

Read Configuration (INI) File (1).vi

Link to comment
12 hours ago, neunited said:

My LabVIEW VI for the .ini script  is attached. I'm relatively new to using configuration file functions and I don't really understand where "Get Key Names" section should be wired to. I have placed a constant on it for now which reads the "AO Channel 1" but how can I get it to read all the channels in the .ini file.

Not totally sure what you're asking, but it sounds like it might be a good idea to make sure the format of an ini file is clear?

Its:
[section]
key1=value1
key2=value2

In your case, the key names are known, the section names may not be. I'd suggest using get section names, and then calling read key 4 times with the keys you listed, for each section name. 

 

Stepping back a bit, you are reinventing the wheel. If you want to just take a labview type and save/load it from an INI file, use moore good ideas' MGI read/write anything library which you can download from vi package manager. This uses an ini-like format to store clusters on disk. You could do the same with a variety of other formats (flatten/unflatten to json, or xml) without having to manually select out each value you care about.

Stepping back even further, depending on your needs you could simply configure all of your daqmx tasks in max and never have to worry about saving them to a file, but this obviously depends on your system.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.