Thread: Serial Port Silliness

  1. #1
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273

    Question Serial Port Silliness

    Hello,

    I'm just trying to get into some serial port programming. At the moment I'm treating it exactly as I would a file, so I get a handle using CreateFile and "\\\\.\\COM1" for the filename. Then I engage in a spot of send and receive with my device, using ReadFile and WriteFile.

    The problem is, although I'm able to transmit properly, any bytes I receive seem to have their most significant bit cleared. 7 bit transfer? How do I turn this off?

  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
    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 /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273
    Now see here's the funny thing:- you go through all the rigmarole of checking these settings in the Device Manager to make sure they're correct, and yet when you finally get a handle to the port Windows decides you'd be better off with 1200 baud, 7N1. GAAAAAHHHH!

    Thanks Salem.

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. Can't Read From Serial Port
    By HalNineThousand in forum Linux Programming
    Replies: 14
    Last Post: 03-20-2008, 05:56 PM
  3. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  4. need guidance to connect to serial port
    By gnychis in forum Linux Programming
    Replies: 1
    Last Post: 06-02-2005, 10:10 AM
  5. DOS, Serial, and Touch Screen
    By jon_nc17 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-08-2003, 04:59 PM