Hello everybody
How can I test / measure the NI DAQ 6527 board output ?
When I run the folowing code I cant see / measure the output on the 'Dev1/port5/line0:7' chanel.
If anyone knowns some method please help me, because on the selected 'Dev1/port5/line0' chanel I can't measure any voltage difference.
Thank you for any advise.
=========================================================================================
#include <unistd.h>
#include <stdio.h>
#include <NIDAQmx.h>
#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else
int main(void)
{
int32 error=0;
TaskHandle taskHandle=0;
uInt8 data[8]={1,0,0,0,0,0,0,0};
char errBuff[2048]={'\0'};
int i = 0;
/*********************************************/
// DAQmx Configure Code
/*********************************************/
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle,"Dev1/port5/line0:7","",DAQmx_Val_ChanForAllLines));
/*********************************************/
// DAQmx Start Code
/*********************************************/
DAQmxErrChk (DAQmxStartTask(taskHandle));
/*********************************************/
// DAQmx Write Code
/*********************************************/
while(i++<60)
{
data[i%8] = !data[i%8];
data[0] = 1;
printf("Write ports sample No...[%d] - ", i);
printf("data[");
int j = 0;
for(j=0; j<8;j++)
{
printf("%d ", data[j]);
}
printf("]\n");
DAQmxErrChk (DAQmxWriteDigitalLines(taskHandle,1,1,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL));
printf("Write end \n");
uInt32 data_r = 0;
int32 read_r = 0;
DAQmxErrChk (DAQmxReadDigitalU32(taskHandle,1,10.0,DAQmx_Val_GroupByChannel,&data_r,1,&read_r,NULL))
printf("Data acquired: 0x%X\n",data_r);
sleep(1);
}
Error:
if( DAQmxFailed(error) )
DAQmxGetExtendedErrorInfo(errBuff,2048);
if( taskHandle!=0 ) {
/*********************************************/
// DAQmx Stop Code
/*********************************************/
DAQmxStopTask(taskHandle);
DAQmxClearTask(taskHandle);
}
if( DAQmxFailed(error) )
printf("DAQmx Error: %s\n",errBuff);
printf("End of program, press Enter key to quit\n");
getchar();
return 0;
}