My adventures with PIC micro-controllers.


Well, I finally did it. I broke my number one rule: Don't start a project until you finish the one you are on. I really couldn't help myself. I read up on PIC uc's and was so fascinated with them, that I just had to give it a try. So, here is what I recommend doing to get started:

1. Go to and request 3 free samples from them. I ordered 3 PIC16f628's based on Steve Manzer's recommendation (Steve's site here). Several days later, the PIC's arrived in a neat little anti-static box with the company logo on it. Very nice and a freebee!

2. Download the demo C compiler from CCS and get it installed and working.

3. Purchase a PIC programmer. There are a bunch of them out there, but I really liked this particular one because it doesn't require a seperate power supply. I highly recommend the ZIF socket even though it is another $20. When you are starting out, you will be re-programming the PIC chip quite frequently and the ZIF makes it so much easier. This programmer comes as a kit, but it only takes a few minutes to solder a couple of components to the board and you are ready to go. You will need a USB A-A Male-Male cable, so make sure you have one or order one with the kit. I couldn't find one at 9 pm when I wanted to test the board so I had to wait until the next day. USB PIC programmer from Carl's electronics. Carl's electronics was very prompt with the delivery and I highly recommend them for this programmer.

Now that you have all the hardware and software for PIC development, you are ready to write some code and test it out. I had a tough start because I couldn't find many good C examples for the PIC16f628, but after a day of trying different things, I finally got the PIC to fire up.

After writing an LCD driver, a seven-segment driver, and a few other test programs, I set out to build an optical encoder that would display the step and direction on the LCD display. Here is a shot of the LCD.


Here is my encoder lash-up. I used two opto-interrupters and a home-brew encoder wheel to test my software. The disk is made from a 3" CD that I stripped the silver off of. I printed the encoder wheel onto transparency film and then glued it to the CD. It worked quite well for a test bed.