02-08-2022 03:07 AM
Hello,
I used in the past a PCI6503 card to output two binary signals. My new PC have no PCI bus and for the replacement we buyed a USB-6210 case. I have to modify my program to address two output lines from the USB-6210 (P1.0 and P1.1) box but I don't see how to name these two lines, can you help me please?
Before I had the following code:
uInt8 data[8]={0};
data[1]=1;
data[2]=0;
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle,"Dev1/port0/line0:7","",DAQmx_Val_ChanForAllLines));
// DAQmx Start Code
DAQmxErrChk (DAQmxStartTask(taskHandle));
// DAQmx Write Code
DAQmxErrChk (DAQmxWriteDigitalLines(taskHandle,1,1,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL));
Can you help me modify this code to work with the USB-6210?
Thank you
Solved! Go to Solution.
02-08-2022 03:23 AM
Hi,
Since you have given the channel string as "Dev1/port0/line0:7" you need to name your new device as "Dev1".
And be aware that your code updates all 8 bits of digital IO, not just 2, since you specifed all lines by writing "line0:7".
And the lines that will be updated will be line-1 and line-2.
Because you wrote to the 1st and 2nd indices of your array.
Hope this helps,
02-08-2022 03:34 AM
02-08-2022 03:39 AM
Also as reminder:
You start your task before you write to the lines.
So they will output the default states first and then switch to the values you have given.
Either Make sure that does not harm your system or start after you write the data lines.
02-08-2022 04:12 AM
Yes, I will change that, ty.
To address the correct first line I had to put "Dev1/Line4" and I changed the setting "DAQmx_Val_ChanForAllLines" by "DAQmx_Val_ChanPerLine"
Everything works, thank you very much