06-28-2007 12:58 PM
07-01-2007 11:55 PM
07-02-2007 01:33 PM
Thanks, Raajit. Changing : " uint8 w_data[1] = {1} " works. So it is the array usage that I got confused in that call. I will check any cross-talk to adjacent channels using a scope to see if any interference exists. I anticipate no cross-talk. If I see anything, I will report back here. Again thank you very much for your reply.
02-02-2009 08:47 PM
I also have the same problem.
Port access is OK, bit0 access is also OK, turn on/off correctly when I write 1/0 to bit0, but other bits behave strangely, no rules can be summarized.
Does anyone have any idea?
Thanks in advance.
02-03-2009 10:38 AM
Lily311,
When you say they behave starangely what do you mean? Are you writing a value to each of the bits? Do have your array configured properly as mentioned above? Can you describe to us what you are doing?
02-03-2009 10:18 PM
Hi, Jason,
Thanks for reply.
Basically when I write 1 to each bit, such as using DAQmxBaseWriteDigitalU8 to write data uInt8 0x01 for bit 0, uInt8 0x02 for bit 1, uInt8 0x04 for bit 2, etc, it works fine.
But when I write 0 to any one bit, all the other bits are unexpectedly cleared to 0.
02-05-2009 01:40 PM
Lily311,
You mentioned that bit 0 seemed to work? Are you writing 8 bits or just 1? Can you post the code in question? Can you run the WriteDigPort.c example code (seems to work for me)?
02-05-2009 10:40 PM
I've said at my first post that "Port access is OK", I just have problem in bit access. The example you mentioned is port access, I think.
bit0 access actually have the same problem, I just didn't notice at that time that writing 0 to one bit will affect all others bits.
My code snippet, which writes bit by bit to a 8 bit port.
Note: Totally I create 8 tasks for each bit of that port.
for (int i=0; i<8; i++)
{
int nPos = 7-i;
if ([regStr characterAtIndex:nPos] == '0')
{
w_data[0] = 0;
DAQmxErrChk (DAQmxBaseWriteDigitalU8(taskHandleB[i],1,1,1.0,DAQmx_Val_GroupByChannel,w_data,&written,NULL));
}
else if ([regStr characterAtIndex:nPos] == '1')
{
w_data[0] = pow(2, i);
DAQmxErrChk (DAQmxBaseWriteDigitalU8(taskHandleB[i],1,1,1.0,DAQmx_Val_GroupByChannel,w_data,&written,NULL));
}
}
Thanks & Regards,
Echo
02-06-2009 01:45 PM
Echo,
I have unfortunate news. According to the DAQmx Base C Refrence Help on DAQmxBaseCreateDOChan, which you need to perform the output: "NI-DAQmx Base supports grouping the digital lines of a port as a single channel, not multiple channels."
02-06-2009 09:35 PM
Thanks anyway.
Regards,
Echo