accessing RS232 using C\C++

This is a discussion on accessing RS232 using C\C++ within the Networking/Device Communication forums, part of the General Programming Boards category; Hi, I wanted to know how to access hardware (like rs232, mouse, keyboard, usb port) using a C/C++ program. I'm ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,489
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,489
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Sep 2009
    Posts
    14
    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/DB9 in C
    By minhdung_hoang in forum C Programming
    Replies: 4
    Last Post: 01-19-2009, 04:25 PM
  3. Rs232
    By lostinspace in forum C Programming
    Replies: 1
    Last Post: 06-12-2008, 05:13 PM
  4. rs232 with win api
    By alaturka in forum C Programming
    Replies: 14
    Last Post: 12-27-2005, 09:24 PM
  5. mscomm for rs232
    By scott27349 in forum C++ Programming
    Replies: 6
    Last Post: 01-30-2003, 06:28 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21