Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Err. -200303: External sample clock source...

Dear Readers

I'm using Ni-DAQmx 8 and have a PCIe-6259 card.

I wrote the following code (in VC++ 6).

int main(int argc, char* argv[])
{
    int32       error=0;
    TaskHandle  taskHandle=0;
    uInt8      data[10]={1,2,4,8,16,32,64,128,256,0xFFFFFFFF};
    char        errBuff[2048]={'\0'};

    (error = DAQmxCreateTask("",&taskHandle));

    (error = DAQmxCreateDOChan(taskHandle,"Dev1/port0","",DAQmx_Val_ChanForAllLines));

    (error = DAQmxCfgSampClkTiming(taskHandle,NULL,1000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));

    error = DAQmxWriteRaw(taskHandle, 10, true, 10.0, data, NULL, NULL);
   
        if( DAQmxFailed(error) )
        DAQmxGetExtendedErrorInfo(errBuff,2048);
    Robot Mad ERROR: -200303: External sample clock source must be specified for this application

    error = DAQmxStartTask(taskHandle);



I See no output on the oscilloscope.
I tried to put in several values for ClockSource in DAQmxCfgSampClkTiming like Dev1/PFI0, .... - but it never worked.
Could anyone please help me?

Thanks...
Pascal
0 Kudos
Message 1 of 15
(12,353 Views)
hello pascal,

the M-series device can perform correlated digital I/O. this means there is no own clock for the digital lines. you need a clock from an external source or another subsystem of the device.

you can find further information here and an example here.

regards,

robert h
NI germany
Message 2 of 15
(12,350 Views)
Hello Robert

Thanks for your reply.
Is it possible to take an external clock via RTSI-Cable?
How can I use the clock of another subsystem for my purpose? Could you please explain this to me?

The example doesn't give anything to me since I'm coding my stuff in C++ and have no LabVIEW here...

Thanks
Pascal
0 Kudos
Message 3 of 15
(12,341 Views)
hello pascal,

sorry i put the wrong link, the right one is here.

using another subsystem means, that you use for example analog input sample clock also as clock for digital. you could also generate a pulsetrain with a counter and use this as clock for the digital output. of course the clock could also come from an external source, as you mentioned from the RTSI-bus.

regards,

robert
0 Kudos
Message 4 of 15
(12,339 Views)
Hi Robert

I tried to do so:

int main(int argc, char* argv[])
{
    int32       error=0;
    TaskHandle  taskHandle=0;
    uInt8      data[10]={1,2,4,8,16,32,64,128,256,0xFFFFFFFF};
    char        errBuff[2048]={'\0'};

    error = DAQmxCreateTask("",&taskHandle);

    error = DAQmxCreateDOChan(taskHandle,"Dev1/port0","",DAQmx_Val_ChanForAllLines);

    error = DAQmxCfgSampClkTiming(taskHandle,"/Dev1/ai/SampleClock",100.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000);

    error = DAQmxWriteRaw(taskHandle, 10, true, 10.0, data, NULL, NULL);

    if( DAQmxFailed(error) )
      DAQmxGetExtendedErrorInfo(errBuff,2048);
    return 0;
}



No error - nothing happens...
Could you please help me once again...?

Pascal

Message Edited by pboehi on 01-12-2007 07:56 AM

0 Kudos
Message 5 of 15
(12,339 Views)
hello pascal,

you have to configure and start the analog input also, in order to have the AI sample clock running. if you don't run the analog input task also the sampleclock doesn't run.

regards,

robert
0 Kudos
Message 6 of 15
(12,329 Views)
Hi Robert

Do yo mean something like this:

int main(int argc, char* argv[])
{
    int32       error=0;
    TaskHandle digiTaskHandle = 0;
    TaskHandle aiTaskHandle = 0;

    uInt32      data[10]={0xFFFFFFFF,2,4,8,16,32,64,128,256,0xFFFFFFFF};
    float64        dummyBuffer[10];
    char        errBuff[4096]={'\0'};
   
   

    error = DAQmxCreateTask("",&digiTaskHandle);
    error = DAQmxCreateTask("",&aiTaskHandle);

    error = DAQmxCreateDOChan(digiTaskHandle,"Dev1/port0","",DAQmx_Val_ChanForAllLines);
    error = DAQmxCreateAIVoltageChan(aiTaskHandle, "Dev1/ai0", "", DAQmx_Val_RSE, -5.0, 5.0, DAQmx_Val_Volts, "");

    error = DAQmxCfgSampClkTiming(aiTaskHandle, "/Dev1/ai/SampleClock", 1000.0, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 1000);
    error = DAQmxCfgSampClkTiming(digiTaskHandle,"/Dev1/ai/SampleClock" ,1000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000);

    error = DAQmxStartTask(aiTaskHandle);

Robot MadERROR:
"An attempt has been made to perform a route when the source and the destination are the same terminal.
In many cases, such as when configuring an external clock or a counter source, you must select a PFI, PXI Trigger, or RTSI line as the sou"


//    error = DAQmxReadAnalogF64(aiTaskHandle, 10, 20.0, DAQmx_Val_GroupByChannel, dummyBuffer, 10, NULL, NULL);

    if( DAQmxFailed(error) )
      DAQmxGetExtendedErrorInfo(errBuff,4096);

    error = DAQmxWriteRaw(digiTaskHandle, 10, true, 10.0, data, NULL, NULL);
    //error = DAQmxStartTask(aiTaskHandle);




    if( DAQmxFailed(error) )
      DAQmxGetExtendedErrorInfo(errBuff,2048);
    return 0;
}


Could you please explain me how to do it right?

Pascal
0 Kudos
Message 7 of 15
(12,325 Views)
...I finally got it how it works...
Thank you very much! Smiley Happy
Pascal
0 Kudos
Message 8 of 15
(12,305 Views)
Hello,

I have the same problem as Pascal. I tried creating a new project and a new task for using digital inputs, but this error appear:

ERROR: -200303: External sample clock source must be specified for this application

It does not make any error with 1 sample (on demand), but I tried using continuous samples. I am working in Visual Studio .NET using C# code, so I am not sure that the problem can be solved with the code is linked in this theme. My problem is when I tried creating the task (no with my code, because I do not write anything, the problem is only with the automatic generated code)

Can anybody help me, please? Thank you very much.




0 Kudos
Message 9 of 15
(11,303 Views)
hello agarzo,

you always need a clocksource in order to perform correlated digital I/O. you find a example for this here:
http://zone.ni.com/devzone/cda/epd/p/id/1692

most important is, that your hardware supports hardwaretimed digital operations, like the M series deivces.

kind regards,

robert
0 Kudos
Message 10 of 15
(11,281 Views)