LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DC noise values set from ini file

Solved!
Go to solution

Hello,

       I am trying to build a waveform generator with ( sine wave, triangle, saw tooth, square, DC,  random noise). I managed to get the waveform working using the NI waveform generator built in VI function. but I want to add the DC case which I manage to do. but I want the values (amplitude and frequency ) to be in an ini file. My idea is to manual set the values in the file, once I run the vi and select the DC noise case, it should read the file get the values and output the data and once I stop it, it saves the dc values before exiting.

     I am kind of stuck trying to figure how to do this. I hope I was clear enough. I don't have code to show since I havent started coding on that part yet. Please help.

0 Kudos
Message 1 of 2
(2,496 Views)
Solution
Accepted by topic author ritch_by_nature

Clearly enough explained.

 

Have a look at the configuration file VIs, found in File I/O > Config File VIs. There are also plenty of examples n the community, as well as in the Example Finder, which show how to use these. A good place to start is the Write Configuration Settings File example in the Example Finder, as well as Read Configuration Settings File.

 

Your .ini file will look something like this, once created:

 

[DC Noise Settings]

Amplitude = 1.234567

Frequency = 8.901234

 

This is equivalent to:

 

[Section Name]

Key 1 = Value

Key 2 = Value

 

When asked to read a specific key from a certain section, the read VI scans through the file for the named section, then looks for they key name that you've provided it. Bear in mind you'll need to know what the data type is when you read back.

 

You can use the write VI to modify specific keys in specific sections once you close the file.

 

This is one of a multitude of methods you could use to do this, but is probably the simplest.

---
CLA
0 Kudos
Message 2 of 2
(2,482 Views)