LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Where to put communication with NI USB-6212

Solved!
Go to solution

@Michael.Koppelgaard wrote:

I think I will buy 2 NI USB-6210, since I need 3 maybe 4 digetal input for 2-3 valves and 1 pump.

The sampling rate is lower 250 kS/s , instead of 400, but I guess the will be okay.

Am I right?


Price vs Cost.  Buying "Extra" hardware that "Costs" a bit more has a far cheaper "Price" than trying to force the hardware to be used in a way it was not intended because of the savings in development time!  

 

I have worked projects where the "Bean counters" said "Buy This Device" because it was $xxx.xx dolors cheaper.  Then I spent a few hours developing a LabVIEW P-n-P Driver for the device since the available one was grossly flawed!  The other option had a nice driver.   At my hourly rate they lost a lot of potential profit on the project because of that choice. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 21 of 40
(2,132 Views)

I’m also very happy for the advice you gave med buying extra hardware Smiley Very Happy

 

0 Kudos
Message 22 of 40
(2,120 Views)
Solution
Accepted by Michael.Koppelgaard

I attached the example project as a zip file, version is LV 2014. Unzip it, and check how it works. Right now the lvlib is designed to work with 6 digital outputs, and the default setting for the AI is to DAQ 12 channels.

If you get a second USB hardware, half the AI and DO channels. I also put an example main VI into the project so you can see how to use the VIs:

 

MAIN_test_example_BD.png

 

I just programmed the resource module to use "on demand" data acqusition from the analog inputs, so use software timing in your loops when you use these subVIs (as i did in the example VI in the project).

The 4 public methods in the lvlib are:

  1. Init hardware
  2. Sample a single double from all 12 channels
  3. Set the logical level of the specified digital output line
  4. Close resources, release hardware. 

edit: slight mistake with the second digital output level 🙂 Modify it in the zipped file! 🙂

0 Kudos
Message 23 of 40
(2,105 Views)

I haven’t had a single minute today to look at your code and might not have it before Tuesday I’m afraid Smiley Sad

0 Kudos
Message 24 of 40
(2,083 Views)

This is really great!!!  Smiley Very Happy Well organized I can see that. I’m not sure, I understand everything jet, but I will certainly try my best to understand and will also of course use it.  I will try to correct my stateMashine next week and build your AE into it.

I hope I may return with the new code and let you (or somebody else, review it) for further corrections. Hope I’ll do better this time.Smiley Embarassed

0 Kudos
Message 25 of 40
(2,062 Views)

I have a question

I tried to build in your “set DO” and “Read” sub vi’s.

But when I do that, I get an error even though, I have run the init-vi beforehand.

What can be the reason?

Capture.PNG

Download All
0 Kudos
Message 26 of 40
(1,944 Views)

No idea, unless you show your whole VI with all the functions (Init, Read, etc...). Are you sure the Init happens BEFORE the Read?

If you make a test VI, like my snippet above a few posts before, does it produce error too?

 

0 Kudos
Message 27 of 40
(1,937 Views)

I think you can pretty easy produce the error yourself. And I made an example in the 2 snippets attached. Very simple.

I had my LabVIEW trainer to look at the error, and he was puzzled and couldn’t explain the error. He had to think.

 

I checked that the resource module in your vi’s were the same and it was.

0 Kudos
Message 28 of 40
(1,927 Views)

snip 1.pngsnip 2.png

0 Kudos
Message 29 of 40
(1,921 Views)

@Michael.Koppelgaard wrote:

I think you can pretty easy produce the error yourself.

I can setup a virtual DAQmx device, and I will test it. I come back when I tested it.

And I made an example in the 2 snippets attached. Very simple.

No. You showed the two subVIs only. You did not show how you use my subVIs!!

I had my LabVIEW trainer to look at the error, and he was puzzled and couldn’t explain the error. He had to think.

Still thinking? 🙂

 

I checked that the resource module in your vi’s were the same and it was.


 

0 Kudos
Message 30 of 40
(1,919 Views)