Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Control DAQ Pinouts using an Array which connects to Physical Channel Node on DAQmx

Solved!
Go to solution

No, you should have a section for each channel.  Here is an example from one of my recent projects.

 

[AI Channel1]
Name=GPIO1
Physical_Channel=DAQ1/ai1
Max_Value=10
Min_Value=0

[AI Channel2]
Name=GPIO2
Physical_Channel=DAQ1/ai2
Max_Value=10
Min_Value=0

GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 11 of 20
(1,922 Views)

Alright sure no problem, it should look something similar to this with what you had in mind:

 

Block Diagram File Config_Crossrulz.PNGFront Panel Result File Config_Crossrulz.PNG

I was trying to think of a way of narrowing down the number of blocks used without having to create a sub VI. 

 

There was one other method I came across on the forum which I thought may be simpler, feel free to critique its functionalities in comparison to the other VI.

DAQ from File Good Example.PNGFront Panel DAQ from File Good Example.PNG 

 

Many Thanks

 

0 Kudos
Message 12 of 20
(1,914 Views)

Use a FOR loop for reading each section.  It will greatly reduce the amount of wiring you will have to do.  And using clusters would also help.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 13 of 20
(1,903 Views)

Are you using that function from OpenG library? 

0 Kudos
Message 14 of 20
(1,898 Views)

No.  I have not gotten permission to use OpenG.  I just have a VI that gets all of the section names and filters them.  This gives me an array of sections that I loop over to make an array of channels (cluster or object).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 15 of 20
(1,890 Views)

Yeah after doing further research I don't want to run into any compatibility issues so I'll stick to generic LabVIEW functions.  

 

I've highlighted the execution for the .ini file and it seems to be delimiting the data as desired. 

 

The only issue I'm experiencing now is connecting the virtual channel. I'm sure it's just a simple function that's required. I've illustrated the block diagram below: 

 

IniFile.PNG

 

Would I need an array function to achieve a connection? Would appreciate feedback for the best practice approach. 

 

Many Thanks

0 Kudos
Message 16 of 20
(1,878 Views)
Solution
Accepted by topic author neunited

1. Do not use the second FOR loop.  Just hard code the key names and have all of the Read Key associated with each parameter.

2. Put the Create Virtual Channel inside of the FOR loop.

3. Get in the habit of using shift registers on your FOR loops for references.  Bad things happen when you end up with an empty array autoindexing into a FOR loop (the loop will iterate 0 times and all of your output tunnels will have default values, shift registers pass the initial value through).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 17 of 20
(1,871 Views)

Hi Crossrulz,

 

Many Thanks for your hints and tips. I followed your advice and have edited the design. 

 

There's one function of the VI that remains to be attached which is the "Key Names" for the "Get Key Names" VI. I'm not sure what it should be connected to. On my previous VI it was connected to the "Read Key" via Auto Indexing channel using the additional "For Loop". However now that the "For Loop" is removed the "Key Names" output will not connect to the Key input of "Read Key".

iniblockdiagramii.PNGerror.PNG 

0 Kudos
Message 18 of 20
(1,850 Views)
Solution
Accepted by topic author neunited
Just use the key names as constants. Here is an example from one of my older projects.

GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 19 of 20
(1,847 Views)

Thank you!

 

For any beginners looking to use Config Files (.ini) here is a small template to get you started. Many Thanks and full credit to Crossrulz for his advice along the way. 

 

Hopefully it will make its way to "Find Examples" in LabVIEW someday (my personal optimism!). 

 

Working DAQ ini.PNG

 

 

 

0 Kudos
Message 20 of 20
(1,836 Views)