Page 1 of 1

Slave USB Questions

Posted: Tue Sep 20, 2011 9:52 am
by Jay Dee
Hi guys,
I've been playing with VB6 and flowcode and have a nice little Slave USB setup but would appreciate if anyone can confirm a couple of points.
Using an ECIO 40P

VB6
A) ECIO_OPEN, the return 'status' value is 0 for a successful connection? Not specified in the help but seems to be this way.

FlowCode
B) Under what conditions will the micro-controllers flowcode slave service routine stop and return to the main program, is the only (proper) option to call the Stop_Slave_Service macro from within the running service macro? If I simply disconnect the USB cable to the Microcontroller, the Micro appears to just wait for the USB to e reconnected. Its not a big problem as i guess I'll just need to add a 'release micro' routine, activated when it sees a specific message from the PC.
Cheers,
When I've tidied the whole lot up, I'll post some of the project as it been quite a learning process. :-)
J.

Re: Slave USB Questions

Posted: Tue Sep 20, 2011 10:03 am
by Benj
Hello,
A) ECIO_OPEN, the return 'status' value is 0 for a successful connection? Not specified in the help but seems to be this way.
I seem to remember that this returned a 1 when connecting successfully. I could be remembering it wrong though if its currently working for you and returning a 0.
B) Under what conditions will the micro-controllers flowcode slave service routine stop and return to the main program, is the only (proper) option to call the Stop_Slave_Service macro from within the running service macro? If I simply disconnect the USB cable to the Microcontroller, the Micro appears to just wait for the USB to e reconnected. Its not a big problem as i guess I'll just need to add a 'release micro' routine, activated when it sees a specific message from the PC.
The only way to get the microcontroller back to the main program is to use the stop_slave_service macro with the USB connected. Disconnecting and re-connecting the USB may be resetting the device which is why the code is working for you ok. You could maybe add a input to the micro that checks to see if the USB 5V is present. If it is no longer present then you could call the end slave service macro as part of a timer interrupt.