Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxWriteAnalogScalarF64

Solved!
Go to solution

I am trying to output a fixed current to a single channel use VB6

My code is below.  I get no error messages but I also get no output.  If I save this task to MAX the current value saved is 0. If I change this and run it and I get the appropriate output.

 

DaqMxErrChk = DAQmxCreateTask("Task2", mytask1)
MsgBox ("Create Task" & DaqMxErrChk)


DaqMxErrChk = DAQmxCreateAOCurrentChan(mytask1, "Dev14/ao16", "ImaxLD1", 0, 0.02, DAQmx_Val_CurrentUnits2_Amps, "")
MsgBox ("Set Chan" & DaqMxErrChk)

DawMxErrChk = DAQmxWriteAnalogScalarF64(mytask1, True, 10, 0.01, Null)
MsgBox ("Set Current" & DaqMxErrChk)

DaqMxErrChk = DAQmxStartTask(mytask1)
   MsgBox ("start" & DaqMxErrChk)

0 Kudos
Message 1 of 5
(7,540 Views)

Clarify what you mean by, "If I can change this and run it and I get the appropriate output."  I'm not sure what you mean by this.  Not sure if this is a typo, but your code is: DawMxErrChk = DAQmxWriteAnalogScalarF64(mytask1, True, 10, 0.01, Null).  You may need to change that.

 

Thanks,

 

Sean

Applications Engineering Specialist - Semiconductor Test
National Instruments
0 Kudos
Message 2 of 5
(7,528 Views)

I am running the task two ways.

#1 : With MAX.  I need to manually enter the current set value since this value is not saved with the task.   I then press the run button.  This method works and I get output from the card.

#2 : With the VB code shown.  When I run this all the functions return 0 (no error) but I get no output from the card.  ("Daw " was just a typo when entering in this forum).

0 Kudos
Message 3 of 5
(7,515 Views)

It maybe the fact that you are using the DAQmxErrchk as a handle, and that you are not performing a boolean check.  See the attached example to verify syntax (it is for voltage, but it should still give you an idea of syntax).

 

Thanks,

 

Sean 

Applications Engineering Specialist - Semiconductor Test
National Instruments
0 Kudos
Message 4 of 5
(7,505 Views)
Solution
Accepted by topic author lls01

With some help from ni support I found this solution.  Last parameter in function call cannot be null

 

DaqMxErrChk = DAQmxWriteAnalogScalarF64(mytask1, True, 10, 0.003, ByVal 0&)

Message 5 of 5
(7,487 Views)