Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Custom Scales within same DAQ

I am having trouble trying to Acquire multiple Channels which have multiple Custom Scales defined.

Is there a way to define multiple Custom Scales within the same acquisition, I tried seperating them with a comma but this does not seem to be allowed.
Furthermore the Min and Max from the Custom Scales vary as well

Any help is more than welcome
:
  if (DAQmxCreateAIVoltageChan(thndLocal,                 //  Task Handle
                              "Dev4/ai0:3",               //  Channel List
                              "",                         //  name to Assign
                              DAQmx_Val_Diff,
                              -10,                        //  Expected minimum
                              10,                         //  Expected maximum
//                              DAQmx_Val_Volts,            //  Units
                              DAQmx_Val_FromCustomScale,
                              "Top Torque Scale,Bottom Torque Scale,PS Voltage Output,PS Current Output")                       //  Custom SCale
                               < 0) {                     //  <0 Error
                                                          //  =0 Success
                                                          //  >0 Warning
0 Kudos
Message 1 of 25
(5,333 Views)

Hello,

Here is the code structure for a multiple channel Analog Input task where each channel has different Maximum, Minimum, and Scale values.  Please note that the different channels will be setup in a For Loop.  I am assuming the Scale will be Linear.

- DAQmxCreateTask

- For Loop with array inputs for the following parameters:

 physicalChannel, minVal, maxVal, slope, and yIntercept

Functions inside of For Loop

                - DAQmxCreateAIVoltageChan

                - DAQmxCreateLinScale (can use iteration value for Scale name)

After For Loop configurations run DAQmxCfgSampClkTiming, DAQmxStartTask, DAQmxReadAnalogF64, and DAQmxClearTask.

I hope this helps with your programming and I have also attached an image of what the code would look like in LabVIEW.  Please note the LabVIEW code uses two For Loops.  Let me know if you have any questions or trouble.

Samantha
National Instruments
Applications Engineer
Message 2 of 25
(5,308 Views)
Thanks for this info
0 Kudos
Message 3 of 25
(5,236 Views)

samanthan,

 

I know this thread is a little old but I was just wondering if you could offer me some advice if you get this.  I based the aquisition of a vi i'm trying to use on the code you posted but I'm running into a few problems.  When I run it, absolutely nothing happens, then if I hit stop I get error: 200077 about the min and maximum.  If I change the Min/Max values to those it asks for then nothing continues to happen.  I've attatched a few screenshots.

 

Thanks for your time

 

Luke

Download All
0 Kudos
Message 4 of 25
(4,956 Views)

One different between the two thati can see is that the “Active Chans” input is below the AI CustomScaleName. Generally you want to set the active channel before you alter a channel specific attribute. This could be a source or error in your code, but it's hard to say for sure. What you trying to accomplish? Can you create a task and scale in Measurement and Automation Explorer? What device are you using?

Matt
Applications Engineer
National Instruments
Message 5 of 25
(4,908 Views)

Thanks for the reply.  Yeah, I have access to automation explorer and infact have a series of MAX scales created, is there a simpler way to achieve this using the saved scales then?  I've played around with the scales in LabVIEW for multiple channels but have never managed to get it working (i'm quite new).  I am using a USB-6259 device and the program I'm writing needs to (on the most basic level) aquire 18 channels at 2kHz sample freq, apply a different scale to each channel and save to a text file preferably with the scaling information also recorded.  I thought I could base it on the one on this thread since it seemed to be the most appropriate I found.  I haven't had access to LabVIEW for a while, but I'll try correcting the problem you pointed out first and re-post any updates.

 

Thanks!

 

Luke

0 Kudos
Message 6 of 25
(4,879 Views)

Hi Luke,

I just put together a quick test program using the methods samatham posted earlier and it seemed to work OK here. Are you still having trouble after you switch those terminal inputs?

Matt
Applications Engineer
National Instruments
Message 7 of 25
(4,853 Views)

Hi Matt,

 

Its working now, thanks very much!  Just to clarify, the max and min relate to the post-scaled values for each channel right?  Do you know what happens if the max/min is surpassed? 

 

Cheers

 

Luke

0 Kudos
Message 8 of 25
(4,843 Views)

Hi Luke,

You’re right, the max and min values relate to post scaled data. The max and min inputs are used to calculate what amplification to give your input signal before it goes into the ADC of your DAQ device. This helps reduce quantization error on low level signals by using the full range of the ADC. Specifying a max or min and then exceeding that value has the potential to cause the amp to saturate at VCC or –VCC and this will cause “clipping” in your signal. Best to avoid, but this will not damage your card provided you stay with the overvoltage protection specifications of your DAQ device.

Matt
Applications Engineer
National Instruments
0 Kudos
Message 9 of 25
(4,806 Views)

Hi

 

What is the vi connected to the "i" in the second For loop?

0 Kudos
Message 10 of 25
(4,375 Views)