VB6 Interface via RS-232

can anyone help me to interface via RS-232 any psuedo code etc to be just a guide to get me started… thnaks!

Regarding “psuedo code”, is there a particular programming language you’re asking about?

how about communicating with another module?
in your mscomm1.write or .output = “HELLO WORLD” does the module recieve it as it is?

I guess your reference to VB6 means visual basic. If so, there’s a snippet in an earlier post: “Visual Basic Application - For anybody that wants to send data to XBee”. It’s not as much as you might like, but maybe it’ll help you get started. As far as I know no-one’s yet produced a set of starter code, though I agree it would be useful.

yes i am refering to visual basic 6.0
can someone share some ideas for a beginner like me just for a like what johnf said a starter code or a basic structure code for interfacing the xbee…

I just found this via Google. Does it help?


“Programming serial ports using Visual Basic 2005”

(That’s presumably not the VB version you specified, but I imagine the examples would still work.)

I don’t use Visual Basic (or Windows for that matter) but it looks to me as though the code given in the article would be a good base to build on for the XBee. In particular it uses asynchronous I/O, which is a Good Thing because the XBee can send unsolicited messages from time to time (eg modem status).

Initializing serial communications is different in VS 2005 compared to VB6. In VB6 you will need to look how to add an MSComm compenent to the toolbox. Once you do that set your baud rate, etc in the properties box. Within your code in the form load section add:
MSComm1.open 'Open com port

If that causes an error try using:

Then add a button and it will be called button1. Double click the button to create a button click sub routine. Within the button click sub add:
MSComm1.write(“HELLO WORLD”)

If that causes an error try using:
MSComm1.output(“HELLO WORLD”)

This should get you going. It has been about 4 years since I used VB6. Just FYI, you can get visual studio 2009 express edition for free from microsoft, just do a search on yahoo or google. If you want to start using visual studio let me know and I can send some examples.

Message was edited by: fordcf2000

Another module will recieve it as it is. As for capturing recieved data within VB6, I do not remember. I know in Visual Studio 2005 and 2008 thier is a DataRecieved event that will interrupt the program when data is in the serial buffer that needs to be read.

Is there any one can share some codes on how to make a program from visual basic to allow me interact with the another xbee to initialize range testing? or where in i can change or modify its firmware parameters? without using x-ctu. i do not now how to mimic the AT commands in visual basic so if anyone can help me. i thank you.