Thread: writing to a COM port

  1. #1
    Registered User
    Join Date
    Dec 2006
    Location
    netherlands
    Posts
    2

    writing to a COM port

    hello ,

    i'm programming a microcontroller which gets some characters from a computer over a RS232. now the microcontroller partt isnt a problem. but the pc program is.

    i just want to make a simple program (on the pc) which send purely 1 character to the com port, and then waits until it receives something back from the microcontroller.

    but i havent got a clue how i can read/write to a COM port in C.

    can someone help me out en point me in the wright direction?

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    On windows you can open com-port using CreateFile
    and then WriteFile to send data to the port

    http://msdn.microsoft.com/library/de...s_resource.asp
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Registered User
    Join Date
    Dec 2006
    Location
    netherlands
    Posts
    2
    oke thanx! hope i can make it work now

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. serial port to poll on request
    By infineonintern in forum C++ Programming
    Replies: 2
    Last Post: 06-11-2009, 06:52 AM
  2. FTP program
    By jakemott in forum Linux Programming
    Replies: 14
    Last Post: 10-06-2008, 01:58 PM
  3. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  4. Reading and writing to a serial port
    By SwarfEye in forum C Programming
    Replies: 2
    Last Post: 08-18-2006, 12:28 AM
  5. accessing my com port, writing and reading data
    By shoobsie in forum C Programming
    Replies: 7
    Last Post: 09-16-2005, 03:29 PM