Thread: accessing RS232 using C/C++

  1. #1
    Registered User sandeep080's Avatar
    Join Date
    Apr 2010
    Posts
    17

    Question accessing RS232 using C/C++

    Hi,
    I wanted to know how to access hardware (like rs232, mouse, keyboard, usb port) using a C/C++ program. I'm interested in writing a small program to transfer a text file from PC to a micro-controller (or any other device for that matter) connected via rs232! I'd be grateful if anyone can help me out...

    Thanks in advance!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Well you need to tell us which OS/Compiler you're using on your desktop machine.

    Also, which machine are you asking about - the desktop or the micro-controller.

    RS232 isn't mentioned anywhere in standard C, so you need to be specific about both ends of the link.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User sandeep080's Avatar
    Join Date
    Apr 2010
    Posts
    17
    salem,
    I use both windows xp and ubuntu on my desktop. and i use gnu gcc complier and sometimes use borland.
    The microcontroller I'm using is the classic 8051 from atmel.. If any other info is required?

    thanks in advance.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    For Ubuntu (or any other Linux), try Serial Programming HOWTO

    And perhaps 8051 serial port programming for the device.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Sep 2009
    Posts
    15
    Quote Originally Posted by sandeep080 View Post
    salem,
    I use both windows xp and ubuntu on my desktop. and i use gnu gcc complier ...
    Consider this:

    RS232 serial port library for Linux and Windows

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with RS232
    By evverton in forum C Programming
    Replies: 4
    Last Post: 03-25-2009, 06:12 PM
  2. rs232/485 communication
    By sgh in forum C++ Programming
    Replies: 12
    Last Post: 02-23-2009, 08:09 AM
  3. RS232/DB9 in C
    By minhdung_hoang in forum C Programming
    Replies: 4
    Last Post: 01-19-2009, 05:25 PM
  4. Rs232
    By lostinspace in forum C Programming
    Replies: 1
    Last Post: 06-12-2008, 05:13 PM
  5. rs232 with win api
    By alaturka in forum C Programming
    Replies: 14
    Last Post: 12-27-2005, 10:24 PM

Tags for this Thread