MBP18

From Curuxa

MBP18

Very simple Main Board built on a perfboard using a Microchip PIC microcontroller. This is intended for learning the basics of electronics and/or being used on simple applications where only a few data pins are required.

Features

  • Based on a PIC16F88
    • 18 pin
    • Power supply: 2.0 to 5.5V
    • Program memory: 7168 bytes (4096 instructions)
    • RAM: 360 bytes
    • EEPROM: 256 bytes
    • 31kHz-8MHz internal oscillator
    • Up to 20MHz external oscillator
    • Two 8-bit timers. One 16-bit timer
    • CPP/PWM
    • 10-bit, 7-channel Analog-to-Digital Converter
    • SPP (SPI, slave I2C, master I2C must be implemented in software)
    • AUSART/SCI/RS-232
    • Dual Analog Comparator module
  • ICSP connector
  • Up to 16 data input/outputs
  • I2C connector with pull-ups
  • Two decoupling capacitors

Electronic circuit

Schematic

Bill of materials:

  • Perforated board of at least 11x16 holes. Individual pads, not copper strips
  • 1x PIC16F88-I/P or PIC16F88-E/P (see datasheet)
  • 1x 18-pin PDIP socket
  • 2x 10k, 1/4W resistors
  • 6x Right-angle male headers (usually sold as 40-pin strips)
  • 52x Straight male headers (usually sold as 40-pin strips) (you can also buy double-row strips)
  • 1x 100uF electrolytic capacitor
  • 1x 100nF ceramic capacitor
  • Some thin wire


Layout: top view
Layout: bottom view

Printable version: Single, Double

Optional parts

Both decoupling capacitors can usually be left out of the board, but it's not recommended. They stabilize the voltage from the power supply and filter small voltage peaks/drops. Capacitive or inductive loads such as motors require decoupling capacitors.

The I2C connector, R1 and R2 resistors can also be avoided when you are certain you won't be using I2C.

Construction

MBP18 MBP18 MBP18 MBP18 MBP18

Test

The following code can be compiled using SDCC.

Without Curuxa libraries

/*==================================================================
* Sample program for MBP18 using a PIC16F88
*
* This program configures all available pins as digital outputs.
* You can check that all digital pins are set at the same voltage as
* the power source using a voltmeter or Module LTIND-A (the LED
* should light up)
* Note: RA5 is an input-only pin
*
* http://curuxa.org
*=================================================================*/
 
#include <pic16f88.h>
 
typedef unsigned int config;
config at _CONFIG1 __CONFIG = _CP_OFF & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_IO;
 
void main(){
	//set all pins as digital, instead of analog inputs
	ANSEL=0;
 
	//set all digital pins as outputs
	TRISA=0;
	TRISB=0;
 
	while(1){
		PORTA=0b11111111;
		PORTB=0b11111111;
	}
}

With Curuxa libraries

/*==================================================================
* Sample program for MBP18 using a PIC16F88, with Curuxa libraries
*
* This program configures all available pins as digital outputs.
* You can check that all digital pins are set at the same voltage as
* the power source using a voltmeter or Module LTIND-A (the LED
* should light up)
* Note: RA5 (pin 4) is an input-only pin
*
* http://curuxa.org
*=================================================================*/
 
#include <MBP18.h>
 
ConfigBits1(_CP_OFF & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_IO);
 
void main() {
	//set all pins as digital, instead of analog inputs
	AdcDisable();
 
	//set all digital pins as outputs
	TRISA=AllDigitalOutputs;
	TRISB=AllDigitalOutputs;
 
	while(1) {
		//set all digital output pins at Vcc
		PORTA=0b11111111;
		PORTB=0b11111111;
	}
}
Retrieved from "http://curuxa.org/en/MBP18"