Wednesday, September 2, 2009

PIC16F628A Development Board

The development board we are going to make for our experimental microcontroller PIC16F628A will look like this. Here are the features it is going to have:
  • Access to all I/O pins through female header pins
  • 4 Push Buttons for Input
  • 4 LEDs for Output
  • An LCD Interface Port
  • A 4-digit Seven-Segment Display Interface
  • LCD Backlight Switch and Contrast Adjustment
  • ICSP Programming (Very Important)


    Here is the outline of my design.



    Things you need:
    1. A protoboard : I used 116 x 96 mm protoboard from Futurlec.
    2. An 18 pin IC socket for PIC16F628A
    3. A 4.0MHz Crystal
    4. 2 22pF capacitors
    5. 4 Push Buttons
    6. 4 BC547 transistors for multiplexing 4-digit Seven Segment Display
    7. 4 Red LEDs
    8. 1 Green LED for Power Supply indicator
    9. 1 10K Trimmer Potentiometer for LCD Contrast
    10. 5 10K resistors
    11. 12 220 Ohm resistors
    12. 4 4.7K resistors (Driving the base of Multiplexing Transistors)
    13. Connection Header pins Male and Female both as required
    14. A 4-digit common cathode 7-Segment Display (I used 7FR5641AS from Futurlec)
    15. A 2X16 LCD Display Module (Total 16-pins including LED back light)
    After you have all these stuff, lets work on the circuit connections. First mark the different areas with a pencil on your protoboard according to the various blocks shown in the outline figure above. We will work one by one.
    1. PIC16F628A Power Supply and Crystal Connections

    You decide how you gonna supply +5V to the board. I am going to use 4 AAA Size NiCd rechargeable battery for power supply. Use 4.0MHz crystal with two 22pF capacitors. This is a standard circuit for PIC16F628A. Pin 4 should be held high, a low pulse on this pin will reset the PIC. I used a diode in series with 1K resistor to prevent the backward current flow when the programming voltage appears on Pin 4 during ICSP. Remember, Pin 4 of PIC16F628A is used as programming voltage input during ICSP.

    2. ICSP Header
    ICSP header pins may have different names. I am following what I have got in my PIC Programmer which I bought from mcumall (www.mcumall.com). Connect the ICSP header as shown above.

    3. Push Buttons
    The standard push button circuit uses a pull up resistor. At normal condition, the output is HIGH (+5V), and when the button is pushed, the output is LOW (GND). I have connected the push button output to female header pin so that I could connect it to any Port of the PIC using a jumper wire. There will be 4 push button circuits like this.

    4. 4-Digit Seven Segment Display Interface

    4-digit Seven Segment interface will be achieved using multiplexing circuit. I have not connected the Seven Segment Display to the board, rather the circuit is built on the board and the displayy will fit on the 12 pin female headers.  I used 7FR5641AS Seven Segment module from Futurlec. The series resistance connected with the seven segments are valued 220 Ohm, and the ones connected to the bases of transistors are 4.7K. Connect a, b, c, d, e, f, g points to PortB.0, B.1, B.2, ..., B.6. Transistors I used were BC547. Connect Aout, Bout, Cout, Dout to a female header pins so that you can later connect to the appropriate PIC port using jumper wires.

    5. LED Connection
    This is the simplest circuit. Again, the LED connections go to a female header so that it can be connected to the desired port of the PIC using a jumper wire.

    6. LCD Interface
    I used HD44780 compatible 2x16 LCD panel with backlight. It comes with 16 pin, to which I soldered
    16 pin male header. Now place a 16 pin female header on board and connect the pins as shown above. We will use LCD in 4-bit mode to save microcontroller pins. The pins 15 and 16 are Backlight LED pins. I used jumpers to make it ON/OFF.

    Here's the complete circuit diagram:







    PIC Programmer


    I have got a PIC programmer from MCUMALL(www.mcumall.com) named PRG-017 USB PIC programmer. This is a low cost USB based PIC programmer that can be used in Windows Vista platform too. It acquires power from the USB port itself, and works on laptop which has no RS232 serial port. This can program a wide variety of PIC devices. The complete list can be found on the website. The price for this item is $24.99 on their websites, and it comes with a link for software and a USB cable. It has ICSP programming capability but does not come with the cable. I made my own ICSP cable.

    14 comments:

    1. can we use this board for 16f877 processor?

      ReplyDelete
    2. No, the circuit on this board is specifically designed for PIC16F628A, which has 18-pins, whereas PIC16F877 has 40-pins.

      ReplyDelete
    3. Hi, why do you use a 4.0 MHz Xtal to programm when the 16F628A already has an Internal oscilator of 4 Mhz

      ReplyDelete
    4. Use of external crystal is more accurate while dealing with precise timing applications. Of course, you can use the internal oscillator for simple applications.

      ReplyDelete
    5. How about if I using 20Mhz xtal for this PIC.? What will happen to the circuit?

      ReplyDelete
    6. if u use 20 mhz xtal, power consumption will increase that will affect the regulator circuits. dont use 20 mhz for simple applications

      ReplyDelete
    7. hi how to use digit selector in 7segment led pls clarify this doubt am very novice to this field

      ReplyDelete
    8. If any of the digit select pin is pulled HIGH, the corresponding transistor conducts and the seven segment display digit attached to it is on.

      ReplyDelete
    9. I have the same PIC programmer, but I don't know which one is the best software to run it. Can you help me?

      ReplyDelete
    10. This comment has been removed by the author.

      ReplyDelete
    11. the xtal is on pin 13 and 12 but the datasheet call for it on pin 16 and 15 so what gives

      ReplyDelete
    12. I am having trouble coming up with a schematic for the tachometer. I just don't see how the display connects to the device. The development board just confused things.
      js

      ReplyDelete
    13. I want to buy a PIC16F628A dev board and a USB based programmer in India which is versatile. Which one do you recommend?

      ReplyDelete
    14. I want to buy a PIC16F628A dev board and a USB based programmer in India which is versatile. Which one do you recommend?

      ReplyDelete

    Microcontroller-based Embedded Systems Design