K8055D.DLL Multicard Issues

Hi there,
Using VB. with the latest DLL.

I have 3 cards using all 5 digital inputs (15 in total). The first two inputs on card 1 are counting at a fast pace. And the remaining 3 plus the 10 others on the other two cards are listening to stop buttons.

The problem is that it seems the only way to listen to all 3 cards is to SetCurrentDevice and ReadDigialChannel in a loop for each card. I’m worried that I will miss a count from card1 while I reading from card2/card3.

Card1: 0 0
Card2: 0 1
Card3: 1 0

At the moment I can’t even get VB to read the cards in this way. So I need clarification on how to get this working as there is a lack of examples with the SetCurrentDevice in VB.

At the moment this is what I’m doing:

#start of program

OpenDevice(1)
OpenDevice(2)
OpenDevice(3)

for each card x {
SetCurrentDevice(x)
ReadDigitalChannel(1) 
ReadDigitalChannel(2)
ReadDigitalChannel(3)
ReadDigitalChannel(4)
ReadDigitalChannel(5)
}

#end of program
CloseDevice(1)
CloseDevice(2)
CloseDevice(3)

Thanks for the help.
Chalkman.

This seems to work fine with two cards:
#start of program

OpenDevice(0) OpenDevice(1)

#middle of program
Use ReadAllDigital(). It may be faster than several ReadDigitalChannel() calls.
You can “separate” the individual bits as done in this code snippet.

Dim bit(2, 5) As Integer Dim i As Integer Dim j As Integer Dim K As Integer For Each p As Integer In New Long() {0, 1} SetCurrentDevice(p) K = ReadAllDigital() bit(p, 0) = (K And 1) bit(p, 1) = (K And 2) \ 2 bit(p, 2) = (K And 4) \ 4 bit(p, 3) = (K And 8) \ 8 bit(p, 4) = (K And 16) \ 16 Next ListBox1.Items.Clear() For j = 0 To 1 For i = 0 To 4 ListBox1.Items.Add(bit(j, i)) Next Next

#end of program

        CloseDevice()

This closes all the devices.