Click to See Complete Forum and Search --> : writing/receiving data from serial port


colin59
10-07-2003, 12:20 AM
i want to know how to output data through a serial port and also how to read in data from a serial port. Also, is there a way to automatically write data that comes into the serial port to a file? basically, i am a newbie in linux that just wants to test data communication between two computers, (one windows machine via hyperterminal and one linux machine).

Any help welcome.
Thanks.

CaptainPinko
10-07-2003, 12:28 AM
i believe that it is done through specific memory addresses. i remember seeing them while studying for my A+ Cert in high school. start searching some A+ brain dumps if you really need since i don't know off hand. If i still remember when I get to my room I'll look it up for you.

tecknophreak
10-07-2003, 08:25 AM
Originally posted by colin59
i want to know how to output data through a serial port and also how to read in data from a serial port. Also, is there a way to automatically write data that comes into the serial port to a file? basically, i am a newbie in linux that just wants to test data communication between two computers, (one windows machine via hyperterminal and one linux machine).

Ok, minicom is the program you're looking for. It's a command line program, so you can open it up in xterm or something whatever terminal you're using. I believe there is a way to dump to a file, it's at least as good as hyperterminal so it should. If not, set up the baud rate and all the handshaking in there, then exit without reset.
To get the data coming in on serial port1 to go to a file,

cat /dev/ttyS0 > serialOutput

If you want to learn how to program it, search google.com/linux for serial port programming howto. That'll have about all you need for C programming for the serial ports.

Have Fun!