# VB6 Interface via RS-232

**URL:** <https://forums.digi.com/t/vb6-interface-via-rs-232/3104>\
**Category:** Python\
**Created:** [May 19, 2009, 6:30am UTC](https://forums.digi.com/t/vb6-interface-via-rs-232/3104 "2009-05-19T06:30:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dioxden08](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@dioxden08](https://forums.digi.com/u/dioxden08)\
**Post date:** [May 19, 2009, 6:30am UTC](https://forums.digi.com/t/vb6-interface-via-rs-232/3104/1 "2009-05-19T06:30:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Admin1](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@Admin1](https://forums.digi.com/u/Admin1)\
**Post date:** [May 19, 2009, 2:55pm UTC](https://forums.digi.com/t/vb6-interface-via-rs-232/3104/2 "2009-05-19T14:55:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dioxden08](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@dioxden08](https://forums.digi.com/u/dioxden08)\
**Post date:** [May 29, 2009, 9:29am UTC](https://forums.digi.com/t/vb6-interface-via-rs-232/3104/3 "2009-05-29T09:29:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![johnf](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@johnf](https://forums.digi.com/u/johnf)\
**Post date:** [May 20, 2009, 8:05pm UTC](https://forums.digi.com/t/vb6-interface-via-rs-232/3104/4 "2009-05-20T20:05:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dioxden08](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@dioxden08](https://forums.digi.com/u/dioxden08)\
**Post date:** [May 22, 2009, 4:21pm UTC](https://forums.digi.com/t/vb6-interface-via-rs-232/3104/5 "2009-05-22T16:21:19Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![johnf](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@johnf](https://forums.digi.com/u/johnf)\
**Post date:** [May 23, 2009, 3:15pm UTC](https://forums.digi.com/t/vb6-interface-via-rs-232/3104/6 "2009-05-23T15:15:45Z")

</div>

I just found this via Google. Does it help?

[http://www.devx.com/dotnet/Article/31001](http://www.devx.com/dotnet/Article/31001)

“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).

---

<div class="post-metadata">

**Author:** ![fordcf2000](https://avatars.discourse-cdn.com/v4/letter/f/82dd89/32.png) [@fordcf2000](https://forums.digi.com/u/fordcf2000)\
**Post date:** [May 25, 2009, 12:53am UTC](https://forums.digi.com/t/vb6-interface-via-rs-232/3104/7 "2009-05-25T00:53:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fordcf2000](https://avatars.discourse-cdn.com/v4/letter/f/82dd89/32.png) [@fordcf2000](https://forums.digi.com/u/fordcf2000)\
**Post date:** [May 29, 2009, 4:54pm UTC](https://forums.digi.com/t/vb6-interface-via-rs-232/3104/8 "2009-05-29T16:54:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dioxden08](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@dioxden08](https://forums.digi.com/u/dioxden08)\
**Post date:** [June 8, 2009, 6:02am UTC](https://forums.digi.com/t/vb6-interface-via-rs-232/3104/9 "2009-06-08T06:02:50Z")

</div>

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.
