COM Port not accepting "11" bytes

This is a discussion on COM Port not accepting "11" bytes within the C++ Programming forums, part of the General Programming Boards category; Hello, I 've been working on some code that requires me to output a stream of byte through a COM ...

  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    34

    COM Port not accepting "11" bytes

    Hello, I 've been working on some code that requires me to output a stream of byte through a COM port. Everything works fine until I have to output a value that corresponds to the byte "11." In that case, it doesn't output anything at all. Not a zero, not a randomized byte, it just skips right over it. Does anyone have a clue why this happens?

    P.S. It seems to be due to the WriteFile function found in the winbase.h file.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Is that 11 decimal or 11 hex?

    11 hex is control CTRL-Q [using my brain to figure that out, so it may be wrong], so if you have XON/XOFF protocol, then XON is CTRL-Q, so that would be eaten by the low-level driver.

    Edit: The obvious solution is to disable XON/XOFF when setting up the COM-port. If you are sending binary data, you do not want XON/XOFF on the line - alternatively, you need to escape CTRL-Q, CTRL-S and by prefixing by some other unusual character and changing the CTRL-Q/S to something else [and like \ in C, you would need to use two escape to make one escape].

    --
    Mats
    Last edited by matsp; 08-19-2008 at 09:59 AM.
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. FTP program
    By jakemott in forum Linux Programming
    Replies: 14
    Last Post: 10-06-2008, 01:58 PM
  2. Replies: 16
    Last Post: 11-23-2007, 12:48 PM
  3. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  4. HUGE fps jump
    By DavidP in forum Game Programming
    Replies: 23
    Last Post: 07-01-2004, 10:36 AM
  5. socket question
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 07-19-2002, 01:54 PM

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