hola pendexgabo,
Respecto a como hacer diferencia entre dispositivos con el mismo vid y pid, en el funciones_dll.txt tienes la respuesta, te pego aquí la parte que te interesa:
///////////////////////////////////////////////////////////////////////////////
// MPUSBGetDeviceCount : Returns the number of devices with matching VID & PID
//
// Note that "input" and "output" refer to the parameter designations in calls
// to this function, which are the opposite of common sense from the
// perspective of an application making the calls.
//
DWORD _MPUSBGetDeviceCount(string pVID_PID);
///////////////////////////////////////////////////////////////////////////////
// MPUSBOpen : Returns the handle to the endpoint pipe with matching VID & PID
//
// All pipes are opened with the FILE_FLAG_OVERLAPPED attribute.
// This allows MPUSBRead,MPUSBWrite, and MPUSBReadInt to have a time-out value.
//
// Note: Time-out value has no meaning for Isochronous pipes.
//
// instance - An instance number of the device to open.
// Typical usage is to call MPUSBGetDeviceCount first to find out
// how many instances there are.
// It is important to understand that the driver is shared among
// different devices. The number of devices returned by
// MPUSBGetDeviceCount could be equal to or less than the number
// of all the devices that are currently connected & using the
// generic driver.
//
// Example:
// if there are 3 device with the following PID&VID connected:
// Device Instance 0, VID 0x04d8, PID 0x0001
// Device Instance 1, VID 0x04d8, PID 0x0002
// Device Instance 2, VID 0x04d8, PID 0x0001
//
// If the device of interest has VID = 0x04d8 and PID = 0x0002
// Then MPUSBGetDeviceCount will only return "1".
// The calling function should have a mechanism that attempts
// to call MPUSBOpen up to the absolute maximum of MAX_NUM_MPUSB_DEV
// (MAX_NUM_MPUSB_DEV is defined in _mpusbapi.h).
// It should also keep track of the number of successful calls
// to MPUSBOpen(). Once the number of successes equals the
// number returned by MPUSBGetDeviceCount, the attempts should
// be aborted because there will no more devices with
// a matching vid&pid left.
Bien te explico un poco, para empezar tienes que llamar a esta funcion:
_MPUSBGetDeviceCount(string pVID_PID)
donde pVID_PID = vid_04d8&pid_0011;
esa función te devolverá un valor entero (DWORD) dependiendo del número de dispositivos encontrados con el mismo vid y pid; Si como preguntas tienes dos dispositivos conectados, el valor deberá ser 2. Si es así entonces (y aquí es donde tengo una pequeña duda de como enumerarlos) a la hora de llamar a la funcion:
_MPUSBOpen (DWORD instance, string pVID_PID, string pEP, DWORD dwDir, DWORD dwReserved)

deberás elegir el dispositivo que quieres "controlar" seleccionandolo con "instance" el cual tomará un valor entero dependiendo de la numeración que tenga el dispositivo y ahora viene el problema, como saber como los ha enumerado el sistema operativo?? imagina que en vez de dos dispositivos (este caso quizá sea facil...) tenemos tres (dos iguales y uno diferente a ellos), pudiendo haber sido enumerados así:
Device Instance 0, VID 0x04d8, PID 0x0001
Device Instance 1, VID 0x04d8, PID 0x0002
Device Instance 2, VID 0x04d8, PID 0x0001
Como ves, tenemos los device 0 y 2 iguales, y el 1 distinto a estos. Esto es debido a que los 3 usan el mismo driver...
Para hacer distincion entre los dispositivos iguales simplemente tendriamos que llamar a la funcion open de la siguiente forma:
- Para el dispositivo 0
_MPUSBOpen (0, string pVID_PID, string pEP, DWORD dwDir, DWORD dwReserved)

(esto es lo q yo tengo hecho en el ejemplo, ya que doy por supuesto de q solo va a haber un PicUSB conectado al PC)
- Para el dispositivo 2
_MPUSBOpen (2, string pVID_PID, string pEP, DWORD dwDir, DWORD dwReserved)

Pero claro, aquí está el problema... como he dicho antes... como saber como los ha enumerado el sistema operativo???
Si solo tenemos dos dispositivos y ademas son iguales, usando el mismo driver tendríamos esto:
Device Instance 0, VID 0x04d8, PID 0x0001
Device Instance 1, VID 0x04d8, PID 0x0001
Aquí no habría ningun problema (que es lo q tu preguntabas realmente

)
- Para el dispositivo 0
_MPUSBOpen (0, string pVID_PID, string pEP, DWORD dwDir, DWORD dwReserved)

- Para el dispositivo 1
_MPUSBOpen (1, string pVID_PID, string pEP, DWORD dwDir, DWORD dwReserved)

De todas formas esto no lo he probado, asiq no te puedo garantizar 100% q funcione... cuestion de hacer pruebas

Respecto a tu segunda pregunta:
Pon ese switch en una pata con interrupción externa, como puede ser RB0... cuando entres en la rutina de interrupción de esa pata, haz lo q tengas que hacer con el USB. Así el PIC en su estado "normal" no estará pendiente de ese Switch ni el HOST de la información por USB, ya q no estará activo.
Saludos
