Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

keep getting -200378: DAQmx Error CustomScale Does Not Exist

Hi,
 
I'm using a PCI-6220, Analog inputs
Created a task for reading a single channel, in Volts
keep getting -200378: DAQmx Error CustomScale Does Not Exist
when I start my task.
No matter what I tried (until now)
 
Using VB in Excel2002 to do this, like:
 
            ReturnValue = DAQmxCreateAIVoltageChan( _
                                   TaskHandle, channel, ChannelName, TerminalConfig, MinVal, MaxVal, DAQmx_Val_Volts, ByVal 0&)
===> Returnvalue is 0
 
            ReturnValue = DAQmxCfgSampClkTiming(TaskHandle, _
                                   ByVal 0&, SampleRate, DAQmx_Val_Rising, DAQmx_Val_AcquisitionType_ContSamps, SampsPerChan)
===> Returnvalue is 0
 
            ReturnValue = DAQmxStartTask(TaskHandle)
===> Returnvalue is -200378
 
Any help is would be appreciated.
Johannes
 
ps.:
TaskHandle is the value received when creating the stask (closing of task works)
channel = "Dev2/ai0", as it is the second device
ChannelName I created a unique name
TerminalConfig =  DAQmx_Val_Diff or DAQmx_Val_RSE (resp. 10106 or 10083), tried both
MinVal = -10 (tried other values as well)
MaxVal = 10 (tried other values as well)
DAQmx_Val_Volts = 10348
 
 
0 Kudos
Message 1 of 7
(3,437 Views)

One addition to make: Created my task in MAX, loaded this by my application, and this worked wel.

At least this gives me the chance to continue creating my application,

but this is definetly not the way the final application will work.

 

Johannes

0 Kudos
Message 2 of 7
(3,427 Views)
Hello Johannes,

Seems like this thread slipped thought the system and has been sitting here for a while.
About your question, do you have a custom scale named "ByVal" in MAX. This error happens when DAQmx could not find the custom scale.
From the C reference help I am copying the prototype of the function:

int32 DAQmxCreateAIVoltageChan (TaskHandle taskHandle, const char physicalChannel[], const char nameToAssignToChannel[], int32 terminalConfig, float64 minVal, float64 maxVal, int32 units, const char customScaleName[]);

If we do not want to perform any custom scale, an example for a voltage signal would look like this:

DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai0","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Volts,NULL));

Notice the NULL at the "custom scale" input.
If you do want custom scaling, you need to configure this first. there are two ways: 1. Programatically using C functions or 2. From MAX and save it.
Hope this helps,


Gerardo O.
RF SW Engineering R&D
National Instruments
0 Kudos
Message 3 of 7
(3,368 Views)

hi Gerardo,

Thanks for your response. Indeed I don't want any customscale. To be sure, I copied your call into my code. Needed to change the "NULL" into "ByVal 0&" to follow the VB syntax.

Note that I needed to use this same "ByVal 0&" in other calls, which work perfectly well (like DAQmxReadAnalogF64)

The prototype is known via the VB way of referencing to the C API.

My problem is not solved, though. To me it feels something funny going on between VB and the C API.

Johannes

0 Kudos
Message 4 of 7
(3,356 Views)

Hello Johannes,

Again, seems like I did not get a “notifier” for this… sorry.
You mention you tried this in Excel but this used different syntax sometimes and this is why we do not support Excel VB code. We do support VB 6 or VB.NET.

The syntax should be something like this:

 

DAQmxErrChk DAQmxCreateAIVoltageChan(taskHandle, physicalChannelTextBox.Text, "",DAQmx_Val_Cfg_Default, minValueTextBox.Text, maxValueTextBox.Text,DAQmx_Val_VoltageUnits1_Volts, "")

 

Therefore, the “” indicate no scale.

As a workaround, you might be able to create a dummy scale in MAX (slope = 1 and 0 crossing) and use it in this task.

Hope these suggestions helps,

Gerardo O.
RF SW Engineering R&D
National Instruments
0 Kudos
Message 5 of 7
(3,273 Views)

Yardov,

Sorry, but your suggestion does not bring any news.

I was already aware that a task created in MAX is a workaround, and I am aware of difference in syntax.

Is there any way to see what is actually received by the task, when I do my call? kind of debug level or mode?

Johannes

0 Kudos
Message 6 of 7
(3,245 Views)
Hi Johannes,

You can try using VB6 (with Visual Studio) and use the correct syntax. You can also make a wrapper in VB6 and call it with your VB Excel function so that you know what you are passing to the task. Then you can be sure that you are passing the correct parameters since VB6 is supported.

Hope this helps,


Gerardo O.
RF SW Engineering R&D
National Instruments
0 Kudos
Message 7 of 7
(3,232 Views)