How to Code for RS232 in Visual Basic? Part 3 – Example

. Friday, October 23, 2009

You can download the example program written in Visual Basic 6.0 from the following link:

MsCommSample.zip

Sample includes detailed explanations as comment lines, so I am not going to explaing details of coding in this post.

To test the software you need to have a null modem cable if you want to communicate two computers.

You can make your own cable by soldering pins of two female DB9 connectors as follows.

Connector 1                   Connector 2
Pin 2 <---------------------> Pin 3
Pin 3 <---------------------> Pin 2
Pin 5 <---------------------> Pin 5

If you just want to test how data is sent and received on your computer, you just need one connector; short circuit pin 2 and pin 3:

Connector 1
Pin 2 <--
        |
Pin 3 <--

Make the cables at your own risk, short circuiting any pins other than 2 and 3 may damage serial port of your computer.

By default, software opens the Com1 port in 9600 bauds, no parity, 8 data bits and one stop bit without handshaking protocol. You can change it in source codes.

You also need to have Visual Basic 6.0 software to edit, debug and recompile program.

5 comments:

Yasa said...

Hello,

i am representing www.mrosupply.com - industrial goods ecommerce store, extension of a family owned 114 year old business selling motors, electrical components, conveyor belting and related products. In this, we are looking for opportunities to buy inexpensive links from various blogs, websites, etc.. We would like to get a small tiny link on your website, on the homepage preferably. How much would that cost?

Thank you in advance.
Regards,
Yanina Dani
email: kievforyou@gmail.com

Yasa said...

Leeson AC Motors

Anonymous said...

What i don't understood is in reality how you're not actually much more well-favored than you might be right
now. You're so intelligent. You already know thus significantly in the case of this subject, made me in my view believe it from so many various angles. Its like women and men don't seem to be
interested until it's something to do with Girl gaga! Your own stuffs nice. At all times handle it up!

Here is my weblog - sky movie Deals

Anonymous said...

They implement different strategies on your own or hired a professional
for Internet Marketing for startups this is the book for you.
When you give a transcript, the search engine rankings.
There are a couple of names from the crowd. Here are some points to ponder
before choosing a internet marketing provider.

Visit my homepage - business search engine optimization

zippro said...

Hi, Thank for your lessons, It's very good and easy to understand.
But I couldn't dowload your example. Could you please upload again or sent me by email dupham08@gmail.com
Thank you very much.

Post a Comment

Followers

Search This Blog

Comments

About Me

My photo
Automation engineer especially working on PC software development. Formerly I was coding on PLC, but now I am using mostly Visual Basic on PC.