Thread: sendng bytes to a serial port need help

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    14

    sendng bytes to a serial port need help

    i think i have managed to open the serial port but i need to write a 3 byte protocol to it with the first byte containing 255 the second 1 and the third 127.
    how would i go about doing this iam using a windows OS and using embedded C++
    hope u can help thanx

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    unsigned char buff[] = { 255, 1, 127 };
    serial_port_write_api_function ( device_handle, buff, 3 );

    serial_port_write_api_function is whatever your operating system has for writing a number of bytes to a device (specified by device handle)

    > how would i go about doing this iam using a windows OS and using embedded C++
    embedded C++? So does the code run under windows, or are you just using windows for development, and running the code elsewhere?
    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.

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. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  3. Reading and writing to a serial port
    By SwarfEye in forum C Programming
    Replies: 2
    Last Post: 08-18-2006, 12:28 AM
  4. HUGE fps jump
    By DavidP in forum Game Programming
    Replies: 23
    Last Post: 07-01-2004, 10:36 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