Thread: How to read from a serial port

  1. #1
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271

    Question How to read from a serial port

    Hello all.

    It's been a while. I need beginner texts into how to read data from a port (possibly serial) on my computer. The idea is that I write a back end that reads the data from a web cam or digital camera connected to the port and is saved in a file on the computer.
    I'm going to google this info but I want ideas from all you geniuses on here that may speed up my task.
    Thanx y'all
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    If it's for running under Windows, have a look at this thread (its got code too!)

    gg

  3. #3
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271

    Thumbs up

    Thanx for the reply cp. That was half the job but I was kinda looking for a platform independent text explaining the semantics behind reading from a serial port. beginners wise.
    This is 'cause I also have to have the code written for the *nix platform(s). so I guess I'm kinda asking for teachings on the semantics of reading from devices connected to a computer.
    Thanx y'all. (esp CP)
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

  4. #4
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    How many webcams and digital cameras use the serial port for communication?
    USB and FireWire also communicate serially, but are more advanced to use.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  5. #5
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271
    My mistake. I guess I mis-communicated. I'm looking for any clear and concise text or instruction for beginners on how to read from devices connected to the computer be it USB or firewire. I just need the semantics behind reading from peripheral devices; the standard practice so anything will do, be it USB, parallel, serial or firewire.
    Thanx
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    The simple answer is: file I/O
    That's what \dev\ directory is all about on most *nix systems.

    However, communicating with a device over a parallel vs. serial port is going to be very different.

    Specialty devices (like web cams or digital cameras) may come with their own device drivers. Software applications then talk to the device driver instead of the device itself.

    Some devices may communicate using a protocal over an existing communication device or bus, like serial, parallel, USB, firewire, etc...

    If you're really lucky, your device will have it's own SDK - making it nice and easy to write applications that use the device.

    Here is an example of some specifics on serial ports: Serial Programming HOWTO.

    If you want to learn about device drivers in general (on Linux), the book I learned from can be downloaded here.

    gg

  7. #7
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271
    Thanx man..... As always I'm indebted to you. Looks like there are two people who now owe you a drink should you ever happen to be in the Oxford neighbourhood.
    Last edited by WDT; 05-10-2004 at 06:35 AM.
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Serial Port Questions
    By valaris in forum Tech Board
    Replies: 2
    Last Post: 05-22-2009, 08:26 AM
  2. FTP program
    By jakemott in forum Linux Programming
    Replies: 14
    Last Post: 10-06-2008, 01:58 PM
  3. Serial Port Issues (again!)
    By HalNineThousand in forum Linux Programming
    Replies: 6
    Last Post: 04-09-2008, 08:26 PM
  4. HELP with storing serial port data into txt file
    By inmaterichard in forum C Programming
    Replies: 2
    Last Post: 04-02-2008, 02:20 AM
  5. Serial port read..can someone tell me..
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 06-27-2002, 08:21 AM