I recently switched from PCI 6250 with 3 - 8 bits port to PCI6254 with 1 - 32 bit port (Port 0). Below is the codes I used to write data out to the 8 bit digital port and it worked well with PCI 6250. However, I do not know how to make it work with the 32 bit port (I need to utilize all 32 bits in Port 0 on PCI6254). When I used the exact code on PCI 6254 (32 bit port), it give me an error " The requested memory could not be allocated. Task Name = DigitalWriteTask". I will appreciate your help!
CNiString physicalChannel = "Dev1/Port0";
try
{
// Create the task
CNiDAQmxTask digitalWriteTask(_T("digitalWriteTask"));
// Create an Digital Output channel and name it.
digitalWriteTask.DOChannels.CreateChannel(
physicalChannel,
"",
DAQmxOneChannelForAllLines);
// Write digital port data. WriteDigitalSingChanSingSampPort writes a single sample
// of digital data on demand, so no timeout is necessary.
CNiDAQmxDigitalSingleChannelWriter writer(digitalWriteTask.Stream);
writer.WriteSingleSamplePort(true, (unsigned long) dataToWrite);
}
Thanks,
Yajai.