LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Physical channel choice .exe

Hello,

I have built a .exe (and it's setup) for a data acquisition system. My problem is that depending on the computer it is installed, the physicall channel to read may change (not the ai, but the Device number; that is, Dev1/ai7 to Dev2/ai7, depending if there are any previous devices installed).

 

I want the user to be able to select the Physical channel, but, my problems come here: I cannot make the program 'wait' for the user to set the channel before starting the acquisition (it takes the default value, and gives an error since it won't match).

 

I have tried looping the whole program and using a case structure so that when the physical channel is selected then the user should press a button to start the acquisition, but then I get an error (sorry can't rememeber the code), saying something like 'Attemped to read samples that are no longer available... try increasing fs...'.

 

Any help?

0 Kudos
Message 1 of 10
(5,366 Views)

Hey,

 

Two ways:

 

1. Use DAQmx System Property Node (Advanced Palette) to read the actuall Devices installed in the system, check for your device, e.g. name, identifier and then pass the correct IO Name to the Task.

 

2. Create a SubVI or as first part of your VI or in an init routine force the user to select the device name. Simply use an event structure to pass the data then to the task

 

 

Christian

0 Kudos
Message 2 of 10
(5,358 Views)

Create a list of all avaiable physical channels - populate a ring at runtime and allow the user to select the correct channel by displaying the ring in a dialog box.

Using a simple dialog box popup will allow you to force the user to select a channel if the defaule channel is not available, otherwise the user doesn't need to be involved if you don't want them to be.

 

(Events could be used for this, but they don't need to be)

 

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 3 of 10
(5,332 Views)

I recently ran into a situation where I wanted to "roll my own" DAQmx setup wizard. Like Chrisitian suggested, I used DAQmx property nodes to query the system for devices/channels available. I made a tabbed dialog state machine to step the user through the process of selecting a device and channel. Here is an example of one of the initialization states, where I poll the DAQ system to find all non-simulated devices, and present the results in the form of a Ring control for the user to select:

 

ScreenHunter_01 May. 19 08.52.gif

 

Hope that helps.

Message 4 of 10
(5,331 Views)

Beautiful Phil,

 

Just what I was trying to describe without bothering to do/find the code

 

if that case is turned into a dialog box... presto, no need for an event and as I previously suggested, you can even check to see if the desired physical channel is on the system before you display a popup.

 

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 5 of 10
(5,307 Views)

Dear Phil, James, everyone,

thanks for your advice. Unfortunately, I still have sooo much LabView to learn.

 

I do have a DAQmx Physical Channel Contol on the front panel, where I wanted the user to choose from. My problem is that, when becomed an executable, I can't make it  'Hey, ignore the default value and wait for the user to select one'. Obviously, the program takes the default value and keeps on running.

 

I have tried including the whole program except the DAQmx Physical Channel Control in a Case Structure, and both the DAQmx Physical Channel control and the Case structure inside a loop. The Case structure, in it's default False case is empty, so that nothing happens until the users chooses the right channel and presses a BUTTON that changes de Case to the True case and the acquisition takes place. But, if I do so, I get the error I mentioned.

 

I see your code and hardly understand it (actually don't at all). I also attach my program's block diagram (the channel should always be ai7, the device may change, that's why I make the check).

 

How can I make a message window with the DAQmx Physical Channel prompt?? This would actually be a great solution!

(LabView is great... but my LV knowledge not enough yet)

 

 

0 Kudos
Message 6 of 10
(5,280 Views)

Sorry here's the code.

Thanks and regards.

0 Kudos
Message 7 of 10
(5,279 Views)

Hi usuario, 

 

The other way of doing this is...

 

- you need min 1 spare terminal on your device

1) Scan your system for all H/W of type x (Product Type)

 

2) Scan specified lines on all devices you have just filtered out - get line status

 

3) Ensure that the H/W pull the input of the specified device up (out of default state) on selected channel.

 

You can now detect which if the device is attached, and programatically determine it's name - very difficult to simulate though.

 

Using boolean logic you can add more lines for more devices

1 line = 1 devices

2 lines = 3 devices

3 lines = 7 devices

etc...

 

Try coding up Phil's example and see what it does when you add new devices - simulated or real. You'll learn lots and see it's not that complicated really.

 

James

 

P.S. - You have a race condition in your code between the input and the property node, just wire the output of the physical channel straight into the string stuff. You could do it simpler as well, like this:

ai7.PNG

 

Edit: -correct spelling of a name

Message Edited by James W on 05-20-2010 10:33 AM
CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 8 of 10
(5,264 Views)

Dear all,

 

I finally managed to solve the problem... learned a bit about events & events handling. I made the program wait (via a case structure) until the selected channel was OK (checking it after the DAQmx Physical Channel changes its value). Also added a START, STOP, QUIT options...

 

Now I have a nice stand alone acquisition program.

 

Thank you all sincerely for your time, effort and attention.

0 Kudos
Message 9 of 10
(5,238 Views)

Here's a picture of the 'event' based solution.

 

thanks again to all.

 

Regards

0 Kudos
Message 10 of 10
(5,203 Views)