Resources: Serial Communication in OSX Terminal
Serial Communication in OSX Terminal
I knew it had to be possible to view serial data in the OSX terminal window, but I’m not enough of a unix geek to figure it out. Finally, a little googling told me what I needed to know. Here’s how to read and send serial data from the terminal in OSX.
First, open Terminal. If you’ve never used it before, it’s under Applications/Utilities/Terminal. Next, type
to get a list of all of your serial ports. Pick the one that you want to open. For example, my list looks like this:
And I know from previous experience that /dev/tty.Keyserial1 is my Keyspan USB-to-serial adaptor. It’s connected to a PIC at the moment. The PIC’s programmed to read one byte of serial data at 9600 bits per second, then send back three bytes, “A”, “B” and “C”.
Knowing the serial port, you can just type screen portname datarate to show the serial data on the screen. In my case, it was:
screen /dev/tty.Keyserial1 9600
Then I started typing bytes at the PIC, and it sent bytes back to me. Whee! No need for zTerm! To quit the screen app, tyoe control-A, then control-.
Posted by tigoe at February 13, 2006 01:46 AM