Serial Port Setup

Nicholas Bacon plug-discuss@lists.PLUG.phoenix.az.us
Wed, 21 Nov 2001 08:43:32 -0700


Thomas Mondoshawan Tate wrote:
> 
> On Tue, Nov 20, 2001 at 08:41:25AM -0700, Nicholas Bacon wrote:
> > I am trying to set up a serial port to
> > read data from a weather station.  I
> > have some C code that will set up the
> > allow the port to listen, but I can't
> > find any information on how to get
> > the code "into" dev/ttyS0 or ttyS1.
> > Do I compile it into that directory
> > with the name ttyS1 and replace it,
> > or something else?
> 
> Well, first off, you have to realize that all of the files in the /dev
> directory correspond directly to each device installed in your system. If
> you want to send data to a device, you have to open() it like a file, and
> write() to it. The same procedure goes for reading: open() it and then
> read() from it.
> 
> What do you mean "get the code 'into' dev/ttyS0 or ttyS1"? Do you mean
> upload the actual program into the device?

Sorry for the vague language.  I understand that the 
serial port interface is a file (ttyS0, etc.), and I 
know which device I'm dealing with (ttyS1).  What 
I don't get is how to change the serial interface 
to a driver for a particular device, in this case a 
weather station.

I have the code that interfaces with the port, but I 
don't know what file to compile into.  Does it get 
compiled into a file with name 'ttyS1', replacing 
the existing 'ttyS1'?  Again, sorry for the clumsy 
language, this is new territory for me. 

  --Nick

-- 

Nick Bacon                          -
Coordinator, Independent Study Lab  -
Scottsdale Community College        -
480.423.6223                        -