Saturday, June 21, 2014

pic16f628 and USART via a max232 chip

Max232 chip and associated capacitors.  3.5mm jack on the right.

While I was thinking out pennybot I was wondering how I could get more debug information out as the single blinking led I have currently isn’t much.  I remembered that the pic16f628 had usart onboard so a read up on it.  Only two pins were needed with a max232 chip to handle the voltage pumping to a RS232 connection. Sounded pretty easy.

However before this point I needed a usb to serial dongle and a serial terminal program for my Mac.  I already had a usb/serial adapter based on the pl2302 chip, a cheap ebay purchase.  I searched around and found the necessary drivers for Mac so the pl2302 would be detected.  Google is your friend for that.  For a terminal program some people suggested using the ‘script’ command but that didn’t work very well.  I then tried CoolTerm which was great and I fully recommend it.

For the max232 chip (and associated capacitors) I knew that I would want to use it both on my breadboard and possibly on future pic projects.  A standalone board was the best option.  I had a 4 pin (5v, GND, RX, TX) male header to connect the board to a breadboard or circuit and a stereo 3.5mm socket to connect the serial cable to.  The serial cable was a recycle job were I got an existing 9 pin cable, cut off one end and wired up RX, TX and GND to a 3.5mm male stereo plug.  It’s smaller than a full 9pin shell and is quite robust.  Now I will be reserving the USART pins on pic projects in future and having a 4 pin female header so I plug in my max232 board when needed.

No comments: