キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

ni6008 visual basic analog out error -200077

HI,

 

I have a problem running the following under vb in excel..

 

  Status = DAQmxCreateTask("", taskHandle)  
  Status = DAQmxCreateAOVoltageChan(taskHandle, "Dev1/ao0", "NULL", "0", "5", DAQmx_Val_Volts, "NULL")

   
    Status = DAQmxStopTask(taskHandle)
    Status = DAQmxClearTask(taskHandle)

 

 

In the case of ..mxCreateAO.... status returns -200077, it's ok (0) for the other lines, but I don't know what is wrong. Any suggestions greatly appreciated....

0 件の賞賛
メッセージ1/10
5,556件の閲覧回数

Hi icrook63,

 

This error is commonly seen when trying to perform a hardware timed output on the USB 6008 as the device lacks this capability.

 

Do you set the timing properties of the task anywhere in your code?

0 件の賞賛
メッセージ2/10
5,508件の閲覧回数

Hi Adam and thanks for your reply...

 

The timing statement I've used is as follows:

 

Status = DAQmxCfgSampClkTiming(taskHandle, "/Dev1/OnboardClock", 100, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 1000)

 

Hopefully this is ok, but I can't say I'm totally sure...

 

Best Regards

0 件の賞賛
メッセージ3/10
5,493件の閲覧回数
The USB-6008 has no output clock as you can see from the specs. You can't use s timing function at all. You have to output your signal one point at a time.
0 件の賞賛
メッセージ4/10
5,490件の閲覧回数

Hi Dennis,

 

OK, agreed, the manual says software timed only... However, I'm confused by the second post asking suggesting this could be a timing error.. The only other statement I can think of that 'controls' the timing is ...

 

Status =DAQmxWriteScalarF64(taskHandle,"FALSE",1,1,"NULL")

 

which is after the Status = DAQmxCreateAOVoltageChan(taskHandle, "Dev1/ao0", "NULL", "0", "5", DAQmx_Val_Volts, "NULL") and since this is where the error occurs I don't see how the WriteScalar statement can solve the problem..

 

Perhaps you could expand on the timing issue ?

 

Thanks again for your help...

0 件の賞賛
メッセージ5/10
5,434件の閲覧回数
It's quite simple. Since there is no clock, you cannot specify any timing. I don't have my c reference handy do I don't know if you can specify on demand with the function. In LabVIEW, you simply skip the function altogether.
0 件の賞賛
メッセージ6/10
5,431件の閲覧回数

Hi again,

 

just noticed that in

DAQmxCreateAOVoltageChan(taskHandle, "Dev1/ao1", "NULL", "0", "5", DAQmx_Val_Volts, "NULL")

 

DAQmx_Val_Volts = empty

 

according to the compiler.. I would of thought it should have returned a value ? Could this be the problem ?

0 件の賞賛
メッセージ7/10
5,426件の閲覧回数

Hi icrook63,

 

I should have been more clear, the reason I asked if you'd set timing was that if you had it would cause the error you're seeing as Dennis has explained.

0 件の賞賛
メッセージ8/10
5,395件の閲覧回数

HI,

 

ok, originally I didn't have any timing just the DAQmxWriteScalarF64 statement. I put the timing in to see what happened, but as pointed out it's not a valid thing to do. I know the 6008 is working as I can use it in SignalExpress and Labview. I can also access the logic outputs without error..( see below ). I'm still no nearer getting the analog going though.. If anyone has any thoughts please let me know....

 

Best Regards

 

Private Sub Write_Logic_0_Click()
    Status = DAQmxCreateTask("", taskHandle)
    Status = DAQmxCreateDOChan(taskHandle, "dev1/port0/line0:7", "", DAQmx_Val_ChanForAllLines)
    Status = DAQmxStartTask(taskHandle)
    
   ' Write zeros or ones to the digital lines
    Dim i As Integer
    Dim writeArray(0 To 7) As Byte
    For i = 0 To 7
    ' Reverse Logic
        writeArray(i) = 1
    Next
    
    Status = DAQmxWriteDigitalLines(taskHandle, 1, True, 10#, DAQmx_Val_GroupByChannel, writeArray(0), sampsPerChanWritten, ByVal 0&)
    
    Status = DAQmxStopTask(taskHandle)
    Status = DAQmxClearTask(taskHandle)
    
End Sub

0 件の賞賛
メッセージ9/10
5,345件の閲覧回数

icrook63,

 

Have you tried looking at the VB DAQmx examples and running them to see if they run correctly?

 

The KB here lists where you can find examples for DAQmx in text based languages including VB 6.0, it might be worth seeing if you can get your device working using one of these.

0 件の賞賛
メッセージ10/10
5,295件の閲覧回数