1 Attachment(s)
Automatic VB6 to pic serial connection
The attached project files demonstrate how to make an automatic serial connection between a VB6 interface and a pic. This relieves the user from having to know what port the pic is connected to and then manually connect . This is very useful when using a USB to serial converter, as the virtual port numbers can be from com 5 on up and change depending on the USB port being used. The VB6 application functions as follows: As the application loads, the program attempts to open port 1.If this fails, the program errors, leaves the routine, increments the port number and attempts to open the next port. If the opening is successful, the program transmits a character that the pic will recognize, and in turn the pic will begin sending data. The VB6 program will wait for a period of time for data to arrive, if successful the application will finish loading and data will be displayed. If unsuccessful, the program will try all the ports until exhausted, displaying no connection. When the application is shut down, the program transmits a character that the pic will recognize, and in turn the pic will stop sending data. The pic used was a 16F873A. At the very least its another example for serial communication between a pc and a pic. Some of the code was found on VBnet.com and modified.
Poor'ol slow & obsolete VB6
Suggest using timegettime or gettickcount API's for the delay. This approach will ensure that it runs at the same speed on every machine. Plus, it will also make the process much more efficient, with no dead time - other processes can be processed in the background. A for next loop with an irritation of 10,000 is a big ask for poor'ol slow & obsolete VB6.