Discussion:
SATAr
(too old to reply)
anarkie
2008-07-25 13:10:10 UTC
Permalink
Hello?
I have some DAQ functions to be converted for DAQmx. These are for PCI-6025E and USB-6218.
I'll test these for PCI-6025E first. Some of them works fine.
Is this list matching well?
DAQ                                                                                                         DAQmx---------------------------------------------------------------------------------
To setup---------------------------------------------------------------------------------Init_DA_Brds    -> DAQmxGetDevProductType and DAQmxGetSysDevNamesDAQ_Check          -> just check TaskHandler?
To use internal clock with external trigger.---------------------------------------------------------------------------------DAQ_Config    -> DAQmxCfgSampClkTimingSelect_Signal    -> DAQmxCfgAnlgEdgeStartTrig
Scan setup---------------------------------------------------------------------------------SCAN_Setup   ->?
 
Scan analog channels              (use this sequence)---------------------------------------------------------------------------------SCAN_Start   ->DAQmxCreateAIVoltageChan      DAQmxCfgSampClkTiming      DAQmxRegisterEveryNSamplesEvent      DAQmxRegisterDoneEvent      DAQmxReadAnalogF64
counter(use this sequence) ->????---------------------------------------------------------------------------------GPCTR_Control( 1, ND_COUNTER_1, ND_RESET )     GPCTR_Set_Application( 1, ND_COUNTER_1, ND_SIMPLE_EVENT_CNT )GPCTR_Change_Parameter( 1, ND_COUNTER_1, ND_SOURCE, ND_PFI_3 );GPCTR_Change_Parameter( 1, ND_COUNTER_1, ND_SOURCE_POLARITY, ND_HIGH_TO_LOW )GPCTR_Control( 1, ND_COUNTER_1, ND_PROGRAM )
I counld find what matches with SCAN_Setup, for SCAN_Setup has 3 parameters such as number of channels,channel scan sequence, and gainVector. Is there any DAQmx function has these parameters?
And as you see, DAQmxCfgSampClkTiming is used twice. Can I use it only once?
Final question is, what is equivalent function in DAQmx for that sequence counting in DAQ?
Thanks,
 
 
 
anarkie
2008-07-25 19:10:11 UTC
Permalink
About the DAQ counter, is this code right for them?
 
 DAQmxErrChk(DAQmxCreateTask("", &handle)); DAQmxErrChk(DAQmxCreateCOPulseChanTicks(handle,"Dev1/ctr0","","/Dev1/PFI3",DAQmx_Val_Low,0.0,50,5000));
 DAQmxErrChk(DAQmxCfgDigEdgeStartTrig(handle,"/Dev1/RTSI0",DAQmx_Val_Falling)); for(i=0;i<5;i++) {  /*********************************************/  // DAQmx Read Code  /*********************************************/  DAQmxErrChk (DAQmxReadCounterScalarU32(handle,10.0,&data,NULL));
  printf("\rCount: %d",data);  getchar();  getchar();  fflush(stdout); }
 
It gave me an error; Status Code: -200460
Measurement: Read failed, because there are no channels in this task from which data can be read.
 
Thanks,
 
 
PBear
2008-07-28 22:40:06 UTC
Permalink
Hi anarkie,
A direct 1:1 correlation between the two driver functions doesn't exist but there are many example programs on how to properly construct DAQmx applications. You can find many of those at C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ after installing DAQmx with C support.
As far as your counter error, this is being caused because you are creating a counter output task. Since you are performing an output you are unable to read from this. For output tasks, simply setup you task and configure what you want to be output, and then start the task. There are great examples of this in the above file location.
I would also recommend using the following article for assistance in moving over from the Traditional DAQ driver.
<a href="http://zone.ni.com/devzone/cda/tut/p/id/5957" target="_blank">http://zone.ni.com/devzone/cda/tut/p/id/5957</a>
anarkie
2008-08-01 02:40:18 UTC
Permalink
Oh, thanks a lot!Then in case of digital output, can I use the same function (DAQmxWriteBinary..) after creating a digital output with DAQmxCreateDOChan()?Regards,Message Edited by anarkie on 07-31-2008 09:35 PM
PBear
2008-08-01 20:40:11 UTC
Permalink
Hi anarkie,
I would use the DAQmxWriteDigital set of functions for a digital output task. Try looking in C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Digital\Generate Values for some great examples.
Loading...