Khammonh
2007-05-08 10:10:10 UTC
Hello There
We just bough new PCI-DIO96 board for our new project and use managed NI-DAQmx library to develop our own software application using VB.NET on Visual Studio 2005.
I build the class DIO with a subClass name MyBit which will represent 12 Ports as a member of the class each name AA,AB....and so on and end with DC .
Each port will share a ReadTask , WriteTask ,MyReader and MyWritter (ReadTask and WriteTask is of type Task and MyReader and MyWritter is of type DigitalSingleChannelReader and DigitalSingleChannelWrite Respectively) .
Class DIO has method SetOut for Output a specific port and bit or Bit array and method ReadPort for reading a Bit array of a specific port.
When the class DIO is instantiate with its constructor the 12 ports will be initialized and a shared member (Static in C++) also will be also initialized and add channel to its respective Task (ReadTask for Input Port and WriteTask for OutPut port with their respective MyReader and MyWritter ).
I got problem when I try to use Sub SetOut which its body use MyWritter.WriteSingleSampleMultiLine(True,DATA()) command in NI-DAQmx library . I got error message telling that the number of Channels in the Task not Match with Number of channels in Data.
I don't know what does it mean.
The intention of creating a class MyBit which is a sub class of DIO with the shared member is for keeping the channel status in ReadTask and WriteTask during software run , as if we create a new Task each time and add the same channel name to the task would not possible unless the old task is disposed , so each time the task create and add channel a physical status of a current channel will be lost.
So how to overcome the above error (Number of channel in data and task not match).
Regards
We just bough new PCI-DIO96 board for our new project and use managed NI-DAQmx library to develop our own software application using VB.NET on Visual Studio 2005.
I build the class DIO with a subClass name MyBit which will represent 12 Ports as a member of the class each name AA,AB....and so on and end with DC .
Each port will share a ReadTask , WriteTask ,MyReader and MyWritter (ReadTask and WriteTask is of type Task and MyReader and MyWritter is of type DigitalSingleChannelReader and DigitalSingleChannelWrite Respectively) .
Class DIO has method SetOut for Output a specific port and bit or Bit array and method ReadPort for reading a Bit array of a specific port.
When the class DIO is instantiate with its constructor the 12 ports will be initialized and a shared member (Static in C++) also will be also initialized and add channel to its respective Task (ReadTask for Input Port and WriteTask for OutPut port with their respective MyReader and MyWritter ).
I got problem when I try to use Sub SetOut which its body use MyWritter.WriteSingleSampleMultiLine(True,DATA()) command in NI-DAQmx library . I got error message telling that the number of Channels in the Task not Match with Number of channels in Data.
I don't know what does it mean.
The intention of creating a class MyBit which is a sub class of DIO with the shared member is for keeping the channel status in ReadTask and WriteTask during software run , as if we create a new Task each time and add the same channel name to the task would not possible unless the old task is disposed , so each time the task create and add channel a physical status of a current channel will be lost.
So how to overcome the above error (Number of channel in data and task not match).
Regards