RS232 VB6 connection
TexFly
Posts: 26
Hello,
I need to connect the Propeller to a VB6 software via RS232. In the past I have used other I/O cards that had a DLL to make it easy.
For example: when a button is pushed (...on the Propeller one of the bits goes to 1) I need to turn on
a light on the VB6 software and viceversa. When I push a button on the VB6 software I need to have a bit of the
Propeller to "1".
What's the best way to develop this?
Thanks.
I need to connect the Propeller to a VB6 software via RS232. In the past I have used other I/O cards that had a DLL to make it easy.
For example: when a button is pushed (...on the Propeller one of the bits goes to 1) I need to turn on
a light on the VB6 software and viceversa. When I push a button on the VB6 software I need to have a bit of the
Propeller to "1".
What's the best way to develop this?
Thanks.
Comments
The prop with an FTDI chip gives a USB connection and looks like a normal serial UART (comm port) to the VB6 software. We regularly run comms to the pc at 115,200 baud although you will not necessarily get that figure as throughput. Dr_Acula probably has the most info here as he has used VB6 to communicate with the prop. A Prop Protoboard USB has this circuit on board. Otherwise, a Propplug has the FTDI circuit built in to connect to a prop board.
http://msdn.microsoft.com/en-us/library/aa259393%28v=vs.60%29.aspx
Do you know where I can find some sample code "combo" (Propeller with VB6) to quickly allow the communication?
I am curious as to why you are using the VB6 instead of the newer VB.net platforms?
If this is a non comercial project then you can download the new VB.net Express versions for free.
I believe you will find more examples for Serial Port programming and I also have some experience using VB.net with a serial port.
Load one of the serial object is the Propeller to Tx/RX on pins 30 and 31. See the well documented Parallax Serial Terminal Demo to test your Propeller Rx/Tx code. Do much the same in VB6, load your serial API and test. There are literally tons of of example on serial COM in this forum and on the Internet.
Play with the Parallax Serial Terminal Demo first.
The OBEX has a couple of Serial Port objects that will send data to and from the propeller.
http://obex.parallax.com/objects/54/
http://obex.parallax.com/objects/397/
On the prop end, take a look at the FullDuplexSerial demo program that comes with PropTool. It works fine to/from the pc using P31&P31.
I must say I find VB6 is simpler than VB.net.
I was wondering...do you guys know of any sample code (for the Prop and VB) that I can use to jump start my project?
Thanks.
sniffer.zip
You will need to use a timer to poll the port for incoming characters and also to see if the last TX is complete before attempting another. This code also won't work on win95/98/ME or under WINE in Linux because VB6 doesn't do threading, and those environments get threadbound. It is remarkably unstraightforward and poorly documented; the Windows serial API is absolutely the worst I have ever seen.