K8055 search devices

I am using the k8055 and visual basic.
i read in the manual about the function searchdevices().
How can i use it? What have i to write into the declarations? How must i open it?

if anyone has anything to help me please let me know

'sorry for my bad english :slight_smile:

Haven’t been able to try it myself, since i only got one K8055 board, but SearchDevices() is returning an integer.

For me it is returning 0 (zero), because my card is set to zero, but maybe if you got 4 cards it will return 4 or 0123?

yes, but i get zero, too. but if i change the jumpers i get zero,too

Doing it after OpenDevice?

Try putting it in before

0 = 0
1 = 2
2 = 4
3 = 8

remember to disconnect the K8055 and then connect again before trying to search after it again

Here a snippet from the document:

[quote]New multicard function and procedures
SearchDevices
Syntax
FUNCTION SearchDevices(): Longint;
Description
The function returns all connected devices on the computer. The returned value is a bit field.
Returned value
· Bin 0000, Dec 0 : No devices was found
· Bin 0001, Dec 1 : Card address 0 was found.
· Bin 0010, Dec 2 : Card address 1 was found.
· Bin 0100, Dec 4 : Card address 2 was found.
· Bin 1000, Dec 8 : Card address 3 was found.
Example : return value 9 = devices with address 0 and 3 are connected.
[/quote]Do not use the OpenDevice call.

The document is in this package:
Software DLL Rev 2
older DLL with examples and source code (source can also be used with DLL rev 3)

There is no need to use OpenDevice.
You can just use SetCurrentDevice after the SearchDevices()
Here is the link to the download page:

[code]void __fastcall TForm1::Button1Click(TObject *Sender)
{
int intDevices;
bool bChecked;
bChecked = false;
intDevices = SearchDevices(); // Find devices command
if (intDevices) { // If any device was found
GroupBox1->Enabled = false; // Disable buttons
Connect1->Enabled = false;
GroupBox10->Enabled = true;
Timer1->Enabled = true;
}
if (intDevices & 1) { // Device 0 = connected
RadioButton1->Enabled = true; // Enable the radio button
if (!bChecked) {
RadioButton1->Checked = true; // Set radio button check
SetCurrentDevice (0); // Set the current device command
bChecked = true;
}
} else RadioButton1->Enabled = false; // Disable radio button

if (intDevices & 2) {      // Device 1 = connected
RadioButton2->Enabled = true;         // Enable the radio button
if (!bChecked) {
		RadioButton2->Checked = true;       // Set radio button check
  SetCurrentDevice (1);               // Set the current device command
  bChecked = true;
}

} else RadioButton2->Enabled = false; // Disable radio button

if (intDevices & 4) { // Device 2 = connected
RadioButton3->Enabled = true; // Enable the radio button
if (!bChecked) {
RadioButton3->Checked = true; // Set radio button check
SetCurrentDevice (2); // Set the current device command
bChecked = true;
}
} else RadioButton3->Enabled = false; // Disable radio button

if (intDevices & 8) {      // Device 3 = connected
RadioButton4->Enabled = true;         // Enable the radio button
if (!bChecked) {
		RadioButton4->Checked = true;       // Set radio button check
  SetCurrentDevice (3);               // Set the current device command
  bChecked = true;
}

} else RadioButton4->Enabled = false; // Disable radio button

if (bChecked) Button1->Enabled = false;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::RadioButton1Click(TObject *Sender)
{
SetCurrentDevice (0); // Set the current device command
}
//---------------------------------------------------------------------------

void __fastcall TForm1::RadioButton2Click(TObject *Sender)
{
SetCurrentDevice (1); // Set the current device command
}
//---------------------------------------------------------------------------[/code]

[code]Private Declare Function SearchDevices Lib “k8055d.dll” () As Byte
Const CARD_ADDRESS As Byte = 0

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
kartenadresse = CARD_ADDRESS
OpenDevice(kartenadresse)[/code]
it works but i dont know why?!?!

thank you very much