Jump to content

DAQ USB 6008 Multiple Analog Input


Mr CCE

Recommended Posts

Hello everyone,

I'm a new Labview user and I'm currently working with DAQ USB 6008 to acquire a couple of analog inputs which are actually readings from variable resistors. I'm Using NI-DAQmx 7.5 with LabVIEW 7.1.

For this purpose I'm using a DAQ Assistant for each input and for each I' ve chosen Analog Input >> Voltage >> .. with single ended connection and acquisition of Single Sample ( On Demand ).

The problem is, everytime I run the VI an error occurs " The specified Resource is not available". Forgive me for this sort of question but you see, I'm a beginner and I really appreciate any help I can get from professionals like you guys.

I've attached my *.VI file plus two picture showing how I connected the two potentiometers/ variable resistors to the DAQ and the error that I received. Thanks very much in advance.

Best Regards

Two Analog In.vi

post-25059-0-90515500-1308233025_thumb.j

post-25059-0-21488300-1308233040_thumb.j

Link to comment

Okay a couple things. Regarding your error, I usually see that error when I have MAX running an forgot to stop the task, then run LabVIEW and it can't get a hold of that resource. Not sure if you're familiar with MAX (Measurement & Automation Explorer) but if it's not running then this isn't your problem.

Secondly I'm not a big fan of the Express VIs and am not sure how they work. But I believe you can simply get rid of the two express VIs on the left, and replace their output with a string constant (wiring into the DAQmx read), with the name of the virtual channel, or task you want to sample. Obviously the two string constants will need to be different, or else you will try to run the same task twice, and you will get the resource error you have.

Also you may want to add a DAQmx Clear operation after each of your Stop operations.

Another minor issue I see is you have 2 indicators for each output. You can right click the POT 1 Reading dial and go to Visible Items and choose Digital Display. With this I believe you can get rid of the extra indicators.

Have you ran a NI example on your channels? If you go to the Help menu then Find Examples. I'd recommend searching for DAQmx and finding a Continuous Read example then use your virtual channel name (made in MAX) and see if the NI example reads your AI.

Link to comment

The problem is exactly what the error message says - the first DAQ Express VI reserves the AI section of the DAQ card for an analog input task and the second thorws an error when it tries to reserve the AI, since the first DAQ Express VI has already reserved it. When you need to read multiple channels on most DAQ cards you have to read all channels in a single task, since there's really a single A/D and a multiplexer. Take a look at the revised VI I attached.

Mark

Two Analog In.vi

Link to comment

Hello everyone,

First I want to thank you for your help. I' ve been working on it and here's what happened so far:

- @ Hooovahh: About MAX yes I have it and I used it before I got the DAQ USB 6008 just to create a virtual DAQ and perform some tests and try out the different functions of DAQmx. And no, I was not using it when I ran my VI. As to the Express VI's with respect to DAQmx's, I'm starting not to like them either! I replaced the Express VI's with DAQmx functions such as "create task/ start/ clear / stop" ... etc Also I want to thank you for the other tips they were very useful. I tried some NI examples and not all of them are compatible with DAQ USB 6008 ( compatible with other DAQ modules).

- @ mesmith: It's exactly what I suspected the two express VI's are fighting over the DAQ resources. But as for your revised VI I couldn't open it, you see I'm using LabVIEW 7.1 and you're using version 10 so I got the message below.throwpc.gif

Actually I was able to somehow bypass the problem and so far it's working. You know what I did? I created a flat sequence structure and placed each acquisition operation in a separate frame!

Anyways I've just started and the project is not yet complete so I'm gonna need your help everyone rolleyes.gif and thanks very much for the help so far.

Regards

post-25059-0-45817800-1308859986_thumb.j

Link to comment

Hello everyone,

First I want to thank you for your help. I' ve been working on it and here's what happened so far:

- @ Hooovahh: About MAX yes I have it and I used it before I got the DAQ USB 6008 just to create a virtual DAQ and perform some tests and try out the different functions of DAQmx. And no, I was not using it when I ran my VI. As to the Express VI's with respect to DAQmx's, I'm starting not to like them either! I replaced the Express VI's with DAQmx functions such as "create task/ start/ clear / stop" ... etc Also I want to thank you for the other tips they were very useful. I tried some NI examples and not all of them are compatible with DAQ USB 6008 ( compatible with other DAQ modules).

- @ mesmith: It's exactly what I suspected the two express VI's are fighting over the DAQ resources. But as for your revised VI I couldn't open it, you see I'm using LabVIEW 7.1 and you're using version 10 so I got the message below.throwpc.gif

Actually I was able to somehow bypass the problem and so far it's working. You know what I did? I created a flat sequence structure and placed each acquisition operation in a separate frame!

Anyways I've just started and the project is not yet complete so I'm gonna need your help everyone rolleyes.gif and thanks very much for the help so far.

Regards

Sequence structure!? Nooooooooooo............

Sorry about that - it's just that sequence structures are one of those things that new LV'ers overuse (sometimes horribly so). Anyway, I can't save back to LV7.1, but here's a screen shot of a better way to do things. The crux is that you read both DAQ channels in a single scan and then just get the each channel's value from the scan results array.

Mark

post-1322-0-35546400-1308865096_thumb.pn

Link to comment

Hi everyone,

@ mesmith: Thanks very much for the great help I completed it yesterday and it's working perfectly.thumbup1.gif

- To be honest I tried doing it in a while loop before I resorted to the sequence structure but strange things happened and the readings from both POT's made very little sense so I thought I was doing it wrong.

Sequence structure!? Nooooooooooo...........

laugh.gif so all new LV'ers do that? LOL so I guess I'm on the right track then!

- As U may have guessed it, I'm doing a project that includes position control where each of the variable resistors specify a position for a DC-Geared Motor and I' ve already added two additional POT's to act as feedback. The idea is that I want to apply PID theory but I'm not sure how exactly in LabVIEW. I heard there's a PID toolset but I don't know how to get it: Is it downloadable from "ni.com" ?

- Last but not least I need your advice everyone on how to achieve this 'cause I already did it with a PIC but not quite sure how with LabVIEW.

Best regardswink.gif

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
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.