LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Config a system without MAX. How?

Solved!
Go to solution

I want to config my equipment (DAQ) from a CSV-file. Is that possible? When I study the nce file exported from MAX I see a lot of configurations for each channel. It must be possible to have a CSV-file arranged with columns for every config that is needed for each channel and the program reads the CSV-file and initialize the channels.

Can someone advice?  

 

Why do I need that future?  Well, I have a project with lots of hardware channels and multiple virtual channels and a "Excel" file will give me a much better overview. Why not config the application from that file?

 

Perhaps there is some example to study?

 

 

 

0 Kudos
Message 1 of 8
(3,522 Views)
Solution
Accepted by topic author TakeANap

Well the DAQmx API is perfectly able to give you a way of configuring DAQ hardware without any extra configuration in MAX. But that will mean to use the API functions, not just some DAQ Express VI to use a preconfigured MAX configuration.

 

The idea is that you configure a DAQmx task (or more than one if you have multiple DAQ hardware devices) and add all the channels you want to belong to that task. When you look in the DAQmx palette you can see the different VIs. For every channel in a task you need to call one of the DAQmx Create Channel functions. You have different Create Channel functions depending on the channel type (analog, digital or counter input or output) and the possible sensors you have connected to that channel, such as a thermocouple, RTD, voltage or current signal.

 

It totally depends how flexible you want this to be if this is going to be a fairly straightforward exercise or a project of colossal proportions. The flexibility as is available in MAX would be a very major undertaking to reprogram in your LabVIEW program but if you can live with a small subset of channel types and configurations, it should be not very difficult.

 

Simply look at some of the multi-channel DAQmx examples in the example finder to get an idea about how that would need to be done.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 8
(3,503 Views)

The most important thing you said was to create one or more DAQmx tasks and add channels to that task. This is probably a way forward. Thank you.

 

I have an application that is like a template (state machine) that I use in different projects. To deal with channels/hardware in this way can make a configuration for a new project more easy and more easy to modify. I save scales and calibration factors in the same CSV. Even the result are stored in the same CSV/Array. 

 

 

 

0 Kudos
Message 3 of 8
(3,495 Views)

@rolfk Just as confirmation. There are good and bad ways. I tried this. Any comments?

 

A NI-6001 with 8 ai was connected. 

 

In a for-loop (8 turns) I had a Create Task and after that a Create Channel. The Task-name was connected from Create Task to Create Channel.  Each channel got there own task name ( I don't read several channels simultaneously).

 

One thing that's worry me; where does the Tasks information been stored? I have no Shift Register that stores each task.  Still, it works to use a DAQmx Read with only a task name as identifier. 

 

 

0 Kudos
Message 4 of 8
(3,381 Views)

You should not put the Create Task into the loop. A task is like a container that can contain several channels. These channels need normally to be on the same device and of the same type. And a task can have timing characteristics (if the hardware supports it for that kind of channel) and such that control the overall operation for all channels in the task.

 

The Create Channel functions are even so, that they will implicitly create a task if the task input at the input is invalid.

 

So in the past I did normally things like this:

 

DAQmx Task.png

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 5 of 8
(3,345 Views)

Thanks. I really appreciate your opinions.

Ok, I don't sample several channels at the same time. Only one channel with specific name and calibration parameters. I use autostart in DAQmx Read. 

Is that still a bad thing to have one Task per channel?  Or should I sample, let say 8 AI, in parallel and use Index Array to get the data I want?

 

 

0 Kudos
Message 6 of 8
(3,312 Views)

My reply earlier this afternoon has disappeared. Anyhow, I searched the web for more details about Tasks (i am curious about the details) and NI seems to recommend one task per device. However, that must mean active tasks. If I stop a Task with DAQmx Stop the Device should be free for a new Task.

 

On the other hand, it's not a problem to have all Analogue channels in one task and then pick data out with Index Array. I can have a conversion table Name<>Index.

 

0 Kudos
Message 7 of 8
(3,332 Views)
Solution
Accepted by topic author TakeANap

Well you need one task per device and channel type. You can not mix and match AI and DI channels into the same task for instance and even less AI and AO and simply any other combination like that.

 

And you can not have the same channel be part of two valid tasks.

 

Then there is the matter of active tasks. A task is active as soon as it is started and that always takes some resources like timers or control logic which only exists once on any device.

 

So yes you could configure multiple tasks as long as they do not contain the same channels but you can only have one of them active at the same time.

 

The exception to that is for higher end devices that allow for instance for timed analog inputs and outputs. Here you can have one task controlling the AI channels and one containing the AO channels and let them run in parallel.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 8 of 8
(3,323 Views)