Serial programming

This is a discussion on Serial programming within the C++ Programming forums, part of the General Programming Boards category; Gidday. I was talking to a friend today, and he mentioned a mate who he said used BASIC to program ...

  1. #1
    stovellp
    Guest

    Serial programming

    Gidday.

    I was talking to a friend today, and he mentioned a mate who he said used BASIC to program serial connections, etc. I was really interested and I want to know more about programming at such a low level. Is it possible in C++? Could I write code on a computer to control the electricity flow in something like a train track? I've heard of it bieng done at my local university (I'm not old enough to attend yet), but how?

    Could someone please show me a few places to start? Or even a quick explanation as to how?

    Thanks, Paul.

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    Yes, you can do serial communications programming with C++. It is also possible to control the electricity flow in a train track, that is a matter of controlling the switches which control the electricity flow.

    Here's some info and an example of serial communications programming using Borland C++ and some links to further info.
    http://www.traverse.com/people/poinsett/bcbcomm.html

    Here info on RS232:
    http://www.arcelect.com/rs232.htm

    More general info on serial communication:
    http://www.taltech.com/TALtech_web/r.../intro-sc.html

    Note that there are also free libraries available to do communication.
    Last edited by Shiro; 01-19-2003 at 04:06 AM.

  3. #3
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    I used to be interested in that as well. Are you looking to turn on a certain pin in a serial cable, or something similar to that? I'm sure it's possible in C++, but I would suspect that it would be very difficult. Modern programming languages tend to make it difficult for people to access ports directly. More often than not, drivers are used for interfacing. But don't give up hope, someone out there knows how to do it.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  4. #4
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    Another link I almost forgot:
    http://www.beyondlogic.org/serial/serial.htm

    >Modern programming languages tend to make it difficult for
    >people to access ports directly.

    Not necessarily, modern programming languages have the facilities to access ports, but it is usually the OS which does not allow applications to access ports directly. Some Windows systems for example don't allow direct hardware accessing.

    >More often than not, drivers are used for interfacing. But don't
    >give up hope, someone out there knows how to do it.

    Drivers make it easier to work with the hardware. Usually drivers have implemented the basic operations with the hardware, this makes it easier for an application programmer to work with the hardware.
    Last edited by Shiro; 01-19-2003 at 04:10 AM.

  5. #5
    stovellp
    Guest

    Thanks

    You guys are absolute legends! You've really made my day!

    Thanks very much!

  6. #6
    stovellp
    Guest
    Sorry to bother you again, but I'm only on the net here for a minute and don't have chance to read anything, so i've thrown it all on a disk to read when I get home.

    Let me see if I have a basic understanding here: If I wanted to do the train thing, I'd set up switches to control the electricity, which have serial connection on them so my computer can talk to them? Is that it? Do I need to put special software into the switches to make it work or would the serial cable communicate straight into the switch by itself?

    I'm probably way off track.

    Paul

    PS: Thanks for all your help!

  7. #7
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    The parallel port is easier to interface, unless you have an existing serial device you want to interface with. In either case, if you're using a windows OS other than Win95 or Win98, you'll still have to get-around the "user mode" access restrictions.

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. Lame null append cause buffer to crash
    By cmoo in forum C Programming
    Replies: 8
    Last Post: 12-29-2008, 02:27 AM
  3. Music Programming - Serial Matrix Display
    By CrazyHorse in forum C Programming
    Replies: 1
    Last Post: 11-12-2007, 03:16 PM
  4. Please help with serial communication problem - Long
    By spdylude in forum Windows Programming
    Replies: 3
    Last Post: 04-06-2005, 09:41 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, 03:59 PM

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