Results 1 to 3 of 3

Thread: Reading and writing to the serial port

  1. #1
    Mentor
    Join Date
    Jul 2001
    Posts
    1,666

    Reading and writing to the serial port

    I'm making an application in C that will interface with a rover. The rover is controlled via strings sent through the serial port. I was thinking that I could just use the port as a file, like so

    FILE *serial;
    serial = fopen("/dev/ttyS1","w"

    Then write to it using fprintf(). And then close the port and open it for reading, but this doesn't work. Can anyone tell me where I'm going wrong? The rover works by recieving a string, and then returns a string, so I need to write, then read.
    When the app is finished it will be used in windows unfortunately, so I assume that /dev/ttyS0 will be interchangable with COM1.
    Cheers
    CP

  2. #2

    Re:Reading and writing to the serial port

    Hmm...try, /dev/tty.

  3. #3

    Re:Reading and writing to the serial port

    Try CAD-UL, or a list of compile manufacturers. If you find a good one let me know. I'd like to ditch the Keil Win based compiler.

Similar Threads

  1. Serial port doesn't seem to be working
    By Lixus Looser in forum Linux - General Topics
    Replies: 6
    Last Post: 03-25-2004, 05:13 PM
  2. USB and Serial Port Problems + Dual Boot Question
    By Lixus Looser in forum Linux - Hardware, Networking & Security
    Replies: 18
    Last Post: 01-19-2004, 11:54 PM
  3. read from serial port
    By Miepmuts in forum Linux - Software, Applications & Programming
    Replies: 1
    Last Post: 12-01-2002, 06:37 PM
  4. Serial Port
    By mugs in forum Linux - Hardware, Networking & Security
    Replies: 17
    Last Post: 06-24-2002, 04:57 AM
  5. Multiple Serial Port cards
    By zipman in forum Linux - Hardware, Networking & Security
    Replies: 2
    Last Post: 02-27-2002, 06:49 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •