From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB 6002: Should Analog Channels be initialized at start?

Hi everyone,

Using USB-6002 for the first time.

Are all Analog Channels automatically set as Inputs when the USB is plugged in or do I have to initialize them programmatically? 

Thanks.

0 Kudos
Message 1 of 8
(3,285 Views)

Hello Broni,

 

The Analog Inputs of the USB-6002 have dedicated ports and use an analog to digital converter in the card. Therefore, they will always behave as Analog Inputs and there's no need to declare them as inputs.

 

I recommend you check the following documents:

 

I also encourage you to review the following programming resources if this is the first time you work with the DAQmx driver:

 

All the best,

Message 2 of 8
(3,255 Views)

While the Analog Input (AI) lines are all input, there are also two Analog Output (AO) lines.  If you are wiring anything to them, it would probably be a good idea to (a) set them to 0 v when the program starts, and (b) consider setting them to 0 v (if it is safe to do so!) when the program exits (so they are more likely "safe" when you next plug it in).

 

Note that the Digital Ports can be set to Input or Output.  If you are considering an Initialization routine, you might consider setting the ports to Input, or if they are going to be Output, setting their value to Low (False, 0v).  When I started doing DAQ stuff with LabVIEW, one of the systems I worked with made a very loud "Pop" when you turned it on, as a DO line was left "High".  I wrote a routine that ran when the program ended, and when the user logged in, that set all of the DO lines to Low -- no more Pops.

 

Bob Schor

Message 3 of 8
(3,227 Views)

Hi Bob,

Thank you very much for your detailed explanation.

If it were possible, I would give you more than one kudos.

Based on your advice I will initialize all Analog and Digital Ports as inputs both at the start and at the end of the program. This sounds like a pretty safe approach!

Thank you again for your response.

Broni

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

And the AO I will set to Low both at the start and at the end of the program.

Thanks!

0 Kudos
Message 5 of 8
(3,181 Views)

I've got an NI USB-6002 in my hand.  As this Pin-out Diagram from MAX shows, the Analog pins are fixed -- 8 of them are Analog Inputs (AI 0-7), and two of them are Analog Outputs (AO 0-1).  The 13 Digital I/O Ports (P0.0-P0.7, P1.0-P1.3, and P2.0) are settable as Input or Output.  If you are only using Analog lines, you only need to worry about the Analog Output lines, which could have a non-zero voltage if left plugged-in after a previous use.USB-6002 PinoutUSB-6002 Pinout

Bob Schor

Message 6 of 8
(3,179 Views)

I will be using DO and DI as well. I realized that they should be my main concern.

Isn't it an acceptable approach to set all Digital Ports as inputs at the beginning and at the end of the program and set the ones that will be used as DO later when I need them within the body of the program?

Thank you!

0 Kudos
Message 7 of 8
(3,167 Views)

What makes more sense is to know how your device will be used, and set it up appropriate to that use.  Again, lines that are being used as inputs are generally "safe".  Depending on what is being connected to an output line, setting the line to an appropriate (output) value might be "safer" than changing it to an input, only to switch it later to an output (which might involve a "click" -- put a scope on the output and look what happens which you play around with the Digital ports).

 

When In Doubt, Be an Engineer (and Measure/Test It).

 

Bob Schor

Message 8 of 8
(3,141 Views)