16F877A devBoard

Laen’s PCB Order comes through again with some nice quality boards for a recent design.  I wanted to try soldering a few TQFP microcontrollers in a toaster oven, and ended up using a 16F877A.  Using the 16F877A allowed enough pins to connect quite a few devices together.   Since you get three copies of any PCB that you order, I decided to try and use one for building a scoring controller for an airhockey table.

My basic requirements for the board were:

  • ICSP port
  • LCD character display
  • 7-segment display using a MAX7219 driver IC
  • Thermocouple support using a MAX6675 sensor IC
  • Piezo speaker
  • 2 onboard buttons for input
  • 4 onboard LED’s
  • RS232 I/O via software -> PICBASIC
  • Unused pins brought out to header pins

I then went to work using eagleCAD for the schematic and board layout.  After many changes I finally settled on a design.

The design was then sent off to Laens PCB order for fabrication.  A few weeks later the boards arrived and I began to assemble them. I decided to assemble just one in the beginning to see if they were even going to work.

Here was the build log:

PIC16F877A TQFP Development Board ver.1 Log

ver1 of the development board has a few traces that were not fully routed during design.

Pins E.0 and E.2 need to be connected via jumpers.

The LCD_AnyPin.pbp must be used to allow different pins for the LCD.

The MAX6675 silkscreen is upside down, turn the IC 180 before placement.

The silkscreen by the speaker shows D.6 while it is actually D.7.

The Thermocouple I have is WHT=+, RED=-

After soldering the minimum required components, my first attempt at programming via ICSP did not work. The ICSP connector must be placed a certain way; see completed board. Finaly I was able to successfully program the 16F877A via the ICSP, although a program to flash the LED failed.

A simple PICBASIC program to flash the LED connected to E.0 initally would not work. I tried various settings of the fuses but nothing seemed to work. While looking over the board layout trying to figure out the problem, I noticed two traces form the onboard LEDs were not fully connected to the PIC! I dont know how this slipped through, but was an easy fix with some small gauge jumper wire. I then decided to remove the 33pF capacitors on the 20mHZ crystal and replace them with 22pF. I also changed the 47uF capacitor on the 7805 with 10uF. After reprogramming the 16F877A again, the green LED began to blink! Now I was finally starting to think the board wasn’t a complete bust. I soldered on the final components and decided to wait until tomorrow to try it.

I did not want to start the board without configuring the 16F877A to use the various I/O’s first. My initial test of the MAX7219 did not work. I also noticed the MAX6675 was now becoming very hot. I removed the MAX6675 until I have more time to look at it in detail. Initial thoughts are wrong routing of signals. I finally got the MAX7219 to work. After moving the code over from the PID program I noticed there is a subroutine “Transfer” that directly calls the PORTS instead of using a variable. Once both were changed to their corresponding ports the 7segment display jumped to life! The MAX6675 still wasn’t working properly.

I finally figured out the cause of the overheating MAX6675. The artwork that was silkscreened on the PCB has the chip orientation wrong. Once I noticed this I de-soldered the old chip and placed a new one using  the reversed orientation. This fixed the MAX6675 and now works perfectly. After using the LCD_AnyPin.pbp from Darrel Taylor, I then was able to set the individual pins for the LCD bypassing PICBASICs restrictive settings. So up to this point it seems everything is working that I have tested. I need to check out the RS232 connection and the onboard speaker.

The onboard speaker works after noticing the silkscreen is incorrect by displaying port D.6 while it is actually D.7.

Everything seems to be funtioning on the second board I built. I used SMD LED’s instead of thru-hole. The SMDs I had can be soldered nicely between the pads for the thru-hole versions. The finished board looks much nicer than when using the SMD LED’s. While building the second board I had trouble getting it to reliably start. It seemed intermitent at best with no reason. Later I narrowed it down to either the crystal or the trim capacitors near it. Once the trim capactitors were removed The board seemed to work perfectly. I read something a while back that mentioned the capactince? of the entire board can allow use of no trim capacitors. Whats weird is the first prototype has the capactitors and works fine.

Here are some images of the assembly process:

PCB just after coming out of the oven

After installing basic components to allow use of the ICSP

Completed development board with LCD removed

Picture of the bottom side showing the wire jumper fix

Completed board w/LCD attached running a demo

Running a test of the MAX7219 7segment driver

Using PICBASIC, I created a demo for the board testing various features including the LEDs, speaker, thermocouple, and the 7segment display. Ill post the code in another post.  Right now I am trying to implement a simple menu system for selecting various tests.

Final thoughts on the project:  I was impressed the board had only a few mistakes that were fixable; especially for not testing the design first via simulation or using a breadboard.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s