Need help on Serial Port programming!!!

This is a discussion on Need help on Serial Port programming!!! within the C Programming forums, part of the General Programming Boards category; Hi, I have just started to learn C and C++ and i find it very interesting. I have also pulled ...

  1. #1
    Unregistered
    Guest

    Need help on Serial Port programming!!!

    Hi, I have just started to learn C and C++ and i find it very interesting. I have also pulled my Scalectrix car racing kit out of the basement, and really enjoy racing it. Then I had an idea, that is should be possible to make a program that could calculate the speed of my car (real speed), cound laps and take the lap-time. I have now built a electrical circuit with a 9V batteri that creates a voltage pulse each time the car passes a spesific point. All I need to do now is to make a program that can take this puls and take the time until the next puls appears ... then do all the calculations. I have looked around the web for information, but have'nt found much. Do anyone know how I should do this. Should I use the serial port or the parallell port? What kind of commands do I have to use? What should I be aware of? Could anyone help me? PLEASE.

    CAZ, Norway

  2. #2
    *
    Guest
    There is a little thing called *impedance* you want to be aware of. Do you know what your voltage is on your serial port? Do you know what your pinout is?

    What you're trying to do is a little more complicated (albeit very doable if your careful and methodical), than fooling with a 9volt battery.

    You do _not_ want to burn up either your serial or your parallel ports-- as they are usually controlled by circuitry right on the motherboard (you'd need a new MOBO if you hurt it).

  3. #3
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    *, it's more likely that his code isn't working (i.e. "I have just started to learn C and C++") than his serial port doesn't work on the computer -- so don't talk to him like he's an idiot. He just wanted some help learning how to write to serial ports.

    My advice - I should imagine it would be very similar to writing through modems, which is a more common thing these days. If you can't get any answers here, try searching for that on the internet. That should give you the bulk of it.

  4. #4
    Unregistered
    Guest
    I'm really at the startingpoint of this project, so I'm just looking for som help about how to communicate with the serial ports when working with such a simple input signal. I haven't hooked this 9 volt battery directly to my computer if that was what one of you thought I think I can handle the hardware (since I'm an electronic engineer), but having more trouble with the software side. Haven't tried hard yet so I might find it out myself, but thought maybe someone could have some nice tips or even a small program (class) to make simple communication with the serial port. I think, even with my short experience with C, that I can make a nice little program, but I would like some help with the F****NG serial port

    Preciate all help
    Cato, Norway

  5. #5
    :_:
    Guest

    inportb_ outportb_

    I think *guest was pointing out that the first step is to ask oneself "what do I need to know to undertake this project?". So what if a simple c++ class is used? That's a very good idea, and you will benifit from the memory management, the templates, and so on. But just remember: All variables should be tunable, by way of file or real-time.
    You will be venturing into the world of micro-controller technology and it it not an easy task, believe me! Not a simple address book, or calculator you know. I personally cannot pitch in at the time, but I hope you luck

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. Can't Read From Serial Port
    By HalNineThousand in forum Linux Programming
    Replies: 14
    Last Post: 03-20-2008, 05:56 PM
  3. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  4. Reading and writing to a serial port
    By SwarfEye in forum C Programming
    Replies: 2
    Last Post: 08-18-2006, 12:28 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