Translate It!

    Translate to:

Print This Page Print This Page

More PIC Projects

On this page I’ve posted links to software for projects that haven’t been documented elsewhere on the site. Where relevant I’ve also included links to any PCB project files (Eagle only) that have been developed. It’s best to regard the projects as very much works-in-progress and they are presented here as such.

A PIC-based I2C Master controller written for PIC18F2550.

The software (in ‘C’) contains a working example of communicating with another PIC (my test case was an 18F452 – see below) via I2C, and also a working example of Reading/Writing to a 24LC128 EEPROM.

Background. This project is being developed to control a Freescale DSP and is the first time I have used I2C on a PIC. Sadly, most of the Microchip documentation on I2C I have found impenetrable, and their example software is buggy and flawed. I have used what I found on the Web, and fixed it where it was broken. Source code from 3rd parties still has the original comments in it, with any amendments I have done documented by me. As is usual, anyone is free to copy and use all or some of the software supplied free of charge, provided an acknowledgement is made.

The project source (Microchip C18) and pre-compiled HEX files (posted 19 Nov 2008) (WinRAR zip file) are here

AN991-based I2C routines for Reading/Writing to a 24LC128 EEPROM using PIC18F87J50 (or other dual-SSP PICs).

In 2005 Microchip released an Application-note AN991 (DS00991A) and source-code showing a method of accessing external EEPROM. I’ve updated the source-code to use it on the newer PIC18F87J50 which provides 2 SSP modules. Some slight changes to the code have also been made – especially the addition of EEAckPolling to the HDPageWriteI2Cx routines. In the attached archive, I’ve also changed the name of the implementation file to i2c_ee.c. (It was originally i2c.c) The archive also provides an example of initialising the SSP modules and read/writing EEPROM. These have been tested on my PIC18F87J50 home-made lash-up.

The source-code (Microchip C18) (posted 17 Dec 2008) (WinRAR zip file) is here.
The source-code in PDF file-format: AN991.h;
A PIC-based I2C Slave written for PIC18F452.

The software (in ‘C’) is basically just a test slave and contains a working example of an I2C slave responding to the I2C Master project above.

The project source (Microchip C18) and pre-compiled HEX files (posted 20 Nov 2008) (WinRAR zip file) are here

A PIC-based Digital Voltmeter Display (DVM) based on PIC16F873.

The software (in SourceBoost ‘C’) is for a DVM display I used in one of my power supplies. I wanted 4 displays – 2 for voltage & 2 for current so the code had to cater for both types of display. This is done in code using the pre compiler #if #else stuff. The reason that the project is in SourceBoost ‘C’, rather than C18 is that quite simply, the Microchip ‘C’ compiler doesn’t support the 16F devices and the FREE (for small projects) SourceBoost compiler does. (I managed to purchase 4 of the 16F873s for under £1 each. – hence their use here) I’ve also included the Eagle Project for the schematics and PCBs – for the DVM itself and the little add-on board for the op-amp circuit that reads the current. I made single-sided PCBs and used wire links for the top tracks.

DVM Board Top View

DVM Board Top View

DVM Board Track View

DVM Board Top View

DVM Board Components

DVM Board Components

Ammeter Extension PCB

Ammeter Extension PCB

Sorry about the aspect ratio mix above – The original Eagle files are correct! The DVM board should be cut between SV3 and SV4. I joined the 2 boards together (after testing) using 0.1” right-angle pin headers.

The project source (SourceBoost ‘C’) and pre-compiled HEX files (posted 20 Nov 2008) (WinRAR zip file) are here

The project Eagle Project files (posted 20 Nov 2008) (WinRAR zip file) are here

PICKit2 Clone


PICKit 2 Clone

PICKit 2 Clone

My version of PICKit 2

My version of PICKit 2

A word about devices I have used. For the P-channel MOSFETS I used Fairchild’s FQP17P10 – these are big fat power-mosfets with a low RDS (which was really the most important criteria) – I bought a job-lot of these a while ago for 19p each! You could substitute any p-channel device that has a similarly-low RDS to the devices used by Microchip. For the N-channel MOSFETs I used BS170. I used a 60mA 1000uH miniature inductor instead of the 680uH choke specified by Microchip. I also used 3 X 2n3905 pnp bipolar devices for the 3 transistors connected to aux, clock and data lines. All of the 100n capacitors are disc ceramics. The value for the VUSB (C7) capacitor I used was 470n not 330n. For the sample-and-hold circuit (driven by CCP1) I substituted an LM358 (I had one to hand) If anything, the circuit suffers a little from droop, so I may substitute something else later on. IC2 is a 7805 (TO220) regulator – the circuit works without an external supply (off USB) but I prefer to power the hardware separately. Note make sure only 1 of the links X3 OR X4 is made. (depending on choice of supply) NOTE the screen on the USB cable is NOT connected at the PICKit2 hardware end. The screen should only be connected at the PC end. (beware of ground loops)

The Eagle project files are located (as a WinRAR zip file) here

View Page As PDF Document
View Page As Pre-generated PDF Document

Copy the code below to your web site.
  • Share/Bookmark

You must be logged in to post a comment.