Visual Basic and Picaxe USB Adapter

Denzel

Senior Member
I have my visual basic software working to transmit data to a picaxe in order to control my "robot" and I can recieve data from the picaxe from sensors etc. This is all via the com port.
I want this project to work on my laptop but it doesn't have a comm port, only USB.
I understand that if i buy a USB adapter for the download cable I can programme the picaxe via the programming editor, But will this effect my visual basic programme?
How am I to assign a commport in visual basic when its actually USB?
Has anyone achieved this?

Thanks
 

Cruiser

Member
The USB adapter will still look like a serial port to your Visual Basic application (you shouldn't need to change anything). The adapter will come with driver software or will automatically be recognised and windows will re-direct all your data intended for a com port down the USB cable to the adapter.

Chris.
 

moxhamj

New Member
Once you get a USB to serial device and install it you should be able to see what port has been assigned with Start/Settings/Control Panel/System/Hardware/Device Manager and look in the com ports section.
 

womai

Senior Member
One thing to note though: if you unplug the adapter and the plug it into a different USB outlet on you computer, the serial port number will change. (you can change it back to whatever you like in the Windows device manager - see previous post; for that, open the "advanced properties" window. But it's still tedious).

In my more elaborate applications (e.g. the Picaxe oscilloscope I am developing right now) I get around this by implementing an autodetect feature - i.e. the Visual Basic program tries to open every com port and sends a query; if it gets the expected response (an instrument-specific 5 character string in my case) it knows which COM port to use.

Wolfgang
 

hippy

Technical Support
Staff member
I get around this by implementing an autodetect feature - i.e. the Visual Basic program tries to open every com port and sends a query; if it gets the expected response (an instrument-specific 5 character string in my case) it knows which COM port to use.
Don't forget to add a configuration option so the user can prevent particular ports being scanned. Some Bluetooth devices masquerading as serial can hang the PC when probed this way and the data sent out could reset things such as a PICAXE which may be undesirable.
 

womai

Senior Member
suggestion noted - thanks hippy! Probably need to implement this once I have something other people are supposed to use (the computers I work on are "safe" in that respect - all COM ports are either true serial ports, or USB-to-serial converters).
 
Top