Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Visual Basic 6 VB6 NI-DAQmx digital output 24 bits

I downloaded the example program for Digital Output in NI-DAQmx using Visual Basic 6 located here
 
 
The example is for 8 bits using DAQmxWriteDigitalLines().
What should I do if I want to control 24 bits at once. I am using PCI-6503.
 
0 Kudos
Message 1 of 5
(4,075 Views)

Hello nyc,

I have opened this example, and it writes to 8 digital lines because the array called writeArray is only of size 8, and the textbox on the form has line0:7 inside it.  To make this application work for 24 lines you need to first make the writeArray of size 24 and write 24 values inside it.  You then need to change the channel string specified in the textbox.  This textbox string could be either:

DevX/port0/line0:7, DevX/port1/line0:7, DevX/port2/line0:7

or

DevX/port0:2

where X is your device number.  The reason why you cannot specify DevX/port0/line0:23 is because this device has 3 ports (0, 1, and 2) each with 8 lines.

I hope this clarifies things.

Jesse O.
Applications Engineering
National Instruments

Jesse O. | National Instruments R&D
0 Kudos
Message 2 of 5
(4,061 Views)

Jesse,

Thanks.

The size of writeArray cannot be changed to something other than 8.

The function    DAQmxWriteDigitalLines(taskHandle, 1, 1, 10#, DAQmx_Val_GroupByChannel, writeArray(0), sampsPerChanWritten, 0) requires that writeArray be a byte in size.

So, is my only choice to use DAQmxWriteRaw( ) ?   If so, how do I use it?



 

0 Kudos
Message 3 of 5
(4,061 Views)
Hello nyc,

I have tested this, and it should work.  To get that example to work I modified the array code as follows:

    Dim writeArray(0 To 23) As Byte
    For i = 0 To 23
        writeArray(i) = 1
    Next

I then used the channel string:

DevX/port0:2

where X is your device number. 

Regards,

Jesse O.
Applications Engineering
National Instruments


Jesse O. | National Instruments R&D
Message 4 of 5
(4,050 Views)
Jesse,
 
It is working now. I declared the writeArray type incorrectly!
 
Thank you for your persistence in helping me on this. 🙂
0 Kudos
Message 5 of 5
(4,044 Views)