Category: microchip


This is a shot of the processor and servo’s interface board for PeterBot, the processor board has a Microchip 18F2221 microcontroller (Schematic posted before). The processor board was designed using the open source CAD program called KiCAD and the Servo’s interface was designed using the popular program Eagle.

Servo and processor board

Servo and processor board

#include <p18f2221.h>
#include <p18cxxx.h>
#include <delays.h>

#pragma config WDT = OFF
#pragma config LVP = OFF // Este bit debe estar desactivado para poder usar PORTA5
#pragma config OSC = HSPLL
#pragma config PWRT = ON //Power On timer enable

void initialization (void)
{
LATA=0;
ADCON1=0x0f;
CMCON=0×07;
TRISA=0;
PORTA=0;

PORTB=0;
LATB=0;
TRISB=0;
PORTB=0;

LATC=0;
TRISC=0xc0;
PORTC=0;
}
//——————————————–

void main (void)
{
unsigned short digits[10] = {0b10111110,0b00000110,0b01111100,0b01011110,
0b11000110,0b11011010,0b11111010,0b00001110,
0b11111110,0b11011110};
unsigned short i;
unsigned long j;

initialization();

while(1){
for (i=0;i<=9;i++){
PORTB = digits[i];
PORTAbits.RA0=!PORTAbits.RA0;

for (j=0; j<150000; j++){
Delay100TCYx;
}
}
}
}
//     end of file

Microchip’s microcontrollers were the first ones I tried years ago and sometimes I still like to work on them, I think pretty soon I would like to try another brands, AVRs are very popular nowadays.

This is a board for the PIC18F2221 that I did a few months ago, it has a crystal on board, headers to acces all ports and a ICSP interface in order to program it, I have used the Pickit2.

The board was design using the open source program KiCAD which is pretty good, schematic can be found here: PIC18F2221 Board

PCB for Microchip PIC18F2221

PCB for Microchip PIC18F2221

Follow

Get every new post delivered to your Inbox.