Serial Ports

This is a discussion on Serial Ports within the C Programming forums, part of the General Programming Boards category; How difficult is it to write C/C++ code which works with the serial ports....such as.........you have a serial port cable ...

  1. #1
    Registered User SavesTheDay's Avatar
    Join Date
    Jan 2002
    Posts
    77

    Serial Ports

    How difficult is it to write C/C++ code which works with the serial ports....such as.........you have a serial port cable hooked up to your serial port, and the other end to a small circuit board you made consisting only of an LED....what's the difficulty level of writing code to turn the LED on and off....is that really hard?

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    Its not too hard. Just operating system dependant. What os?
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User SavesTheDay's Avatar
    Join Date
    Jan 2002
    Posts
    77
    mmm....most likely WIN ME....

  4. #4
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    You can use the win32 api function CreateFile() to access the serial port. Look in the documentation at msdn
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  5. #5
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    Not sure if it'll work perfectly under windows, but if you want to try some inline ASM you can use ASM's IN and OUT instructions.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. virtual ports
    By royuco77 in forum Networking/Device Communication
    Replies: 5
    Last Post: 07-02-2005, 10:33 AM
  2. How do you send and recieve info from serial ports?
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 06-29-2002, 12:13 PM
  3. Polling serial ports
    By Nevyn in forum Windows Programming
    Replies: 3
    Last Post: 06-12-2002, 03:02 AM
  4. Need a hand accessing the serial ports
    By Danwood13 in forum C++ Programming
    Replies: 3
    Last Post: 04-24-2002, 10:03 AM
  5. Serial Ports
    By camposv in forum C Programming
    Replies: 2
    Last Post: 01-30-2002, 11:18 AM

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