An automated RS232 data transfer between my program and a microcontroller

Posted on 2005-03-28
Medium Priority
Last Modified: 2013-11-20
To start off, my program is written in MFC style.

I've got a dialog box, where on the push of a button, ive got to transfer data between our microcontroller and my program.
The microcontroller side I'm not too worried about because there is a built-in interface already for it.  (its in the motorola 86x familty i believe..the hc11)
Could someone give me a good place to start?  
the baud rate should always be consistent as well as transfer rate, headshaking, etc.
I'm not sure what the protocol for the RS232 is and haven't been able to find a good source online anywhere.

I'm not quite sure even how to open a COM on my computer (thats how much i know...-___-;;).  My laptop doesn't have a serial interface, but i have a usb-to-serial cable that i will be using.

Any guidance, and help will be very very greatly appreciated!! C:

Question by:chinese_bunny
LVL 55

Accepted Solution

Jaime Olivares earned 1200 total points
ID: 13648409
LVL 86

Assisted Solution

jkr earned 400 total points
ID: 13648643
For further reading, I'd suggest taking a look at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp ("Serial Communications in Win32"), it also comes with sample code.

Assisted Solution

WKalata earned 400 total points
ID: 13661712
Another note, as I had a little hiccup when trying to do some serial port programming with a USB->Serial adapter on my laptop, is that a call like :

      GetCommState( m_hReader, &dcb );
      // fill the dcb with information
      dcb.BaudRate = CBR_38400;
      dcb.ByteSize = 8;
      dcb.Parity = NOPARITY;
      dcb.StopBits = ONESTOPBIT;
      dcb.fRtsControl = RTS_CONTROL_DISABLE;
      dcb.fDtrControl = DTR_CONTROL_DISABLE;
      SetCommState( m_hReader, &dcb );

would not correctly work unless the baud rate/byte size/parity/stop bits/flow control were set to match the settings in my program from the USB->Serial port's driver on the Device Manager in the System control panel applet.

I'd suggest making sure that you configure the device with the settings you desire to use, just incase you happened to land yourself with the same converter (or drivers) that I did.

Author Comment

ID: 13662788
thank you all for all your help. C:

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…
Suggested Courses

593 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question