Breadboard module for PIC16F628A

Here’s another breadboard module that carries a PIC16F628A microcontroller. The power supply pins and the I/O ports of the PIC16F628A microcontroller are accessed through male headers. It can be easily plugged into a breadboard and is very useful for quick prototyping. It frees up a lot of space on the breadboard since the oscillator, reset, and ICSP circuits are already built on the module. It is different from the previous PIC16F688 breadboard module in the way that the microcontroller now runs with an external 4.0 MHz crystal. So, this module will be more appropriate for experiments that require accurate timing calculations. Besides, the PIC16F628a microcontroller allows you to read/write 8-bit data directly through PORTB, which is 8-bit wide (none of the ports in PIC16F688 were 8-bit wide).

The layout and the circuit diagram of the module is shown below. The module has ICSP header pins for in-circuit programming, a reset switch, and an LED as power-on indicator. It provides easy access to all the pins of PORTB, and RA0 through RA4 pins of PORTA. Pins RA6 and RA7 are used for external crystal connections, whereas RA5 is input only pin and is used for reset circuit.

Component layout

This circuit can be soldered on a general-purpose prototyping circuit board. Here are some pictures that I took of my finished board.

Now, the breadboard module is ready and its a time to test it. I have written a small application program to chase 8 LEDs that are connected to the PORTB pins of the PIC16F628A microcontroller. The circuit diagram is not shown here as it is very simple. The anodes of the 8 LEDs are connected to the  PORTB pins, whereas the cathodes are grounded through 330 ? resistors in series. The program is written in C and is given below. I compiled it with MikroC Pro for PIC, and loaded the HEX file into the PIC16F628A microcontroller with my handy iCP01 USB programmer from iCircuit technology. In the configuration bit settings, MCLR should be enabled and the clock source could be XT or HS, both will work for 4.0 MHz.

Here is the test program in MikroC.

/*
Project: LED chaser program for testing the PIC16F628A module
Eight LEDs are connected to PORTB pins
Copyright @ Rajendra Bhatt
Dec 2, 2010
MCU: PIC16F628A
Oscillator: XT, 4.0000 MHz
MCLR Enabled
*/
unsigned short i, j;
void main() {
 CMCON = 0x07; // Disable comparators
 PORTB = 0x00; // Start with all zero O/Ps
 TRISB = 0x00; // PORTB pins all O/Ps
 do {
 i = 1;
 for(j=0; j<8; j++) {
 PORTB = i;
 Delay_ms(100);
 i = i<< 1; // Left shift one bit
 }
 }while(1);
}

Download the HEX file

After the program is loaded, turn the power ON and watch the chasing LEDs.

Related Posts

18 comments

Leave a Reply

Your email address will not be published. Required fields are marked *