Delcom Products
 
Home->Web Notes

WebNoteId: 19
Title: Controlling multiple device with the DelcomDLL.


Summary: This webnote describes how to control multiple Delcom devices on the same computer with the DelcomDLL.

The DelcomDLL was initially designed to only open one device at a time. But there is a work around to use the DelcomDLL with multiply device. To use the DelcomDLL with multiple devices you must first enumerate all the devices and record each devicename and serial number. Then using the appropriate deivcename, open and close the device each time you need to access the device.

// On start – read the device names and serial numbers. Note DelcomGetNthDevice can take a long time to process
// and therefore should only be done once on program start.
DelcomGetNthDevice(0,0, devicename1)                                             // get the devicename to the first device
DelcomGetNthDevice(0,1, devicename2)                                             // get the devicename to the second device
// Note order in which the devicename are return depends on machine and the usb  port the device is plugged into
// and therefore is ambiguous and should not be used to enumerate the device. Use serial number to enumerate
// the devices

// Get the unique serial number so you know which device is which.
Device1SN = DelcomReadDeviceSerialNum(devicename1, 0)                      // get device1 serial number
Device2SN =DelcomReadDeviceSerialNum(devicename2, 0)                       // get device1 serial number
// now that you know the serial number you will know which devicename goes to which physical device


// Main Program Loop
while(1){
// read device button 1 status
myhandle = DelcomOpenDevice(Devicename1,0)
device1buttton = DelcomGetButtonStatus(myhandle)
DelcomCloseDevice(myhandle)


// read device button 2 status
myhandle = DelcomOpenDevice(Devicename2,0)
device2buttton = DelcomGetButtonStatus(myhandle)
DelcomCloseDevice(myhandle)

} // end main program loop


homeproductsservicescontact usshopping cartlegal   © Copyright 2024 Delcom Products Inc - R720 4/18/2024