WinPicProg PIC Tutorial

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

WinPicProg PIC Tutorial

This is an ongoing series of beginners PIC tutorials, started in June 2002, they will describe the construction of simple modular hardware and give examples of code to make use of it. The boards are connected together by leads with Molex 10 pin connectors, and it's designed so that more than one extension board will be used as the tutorials develop. There's a great deal of free source code you can download from the Internet, a superb resource is the PicList - and I will probably be using many snippets of code from there. PIC's are extremely versatile devices, they are basically an entire computer on a chip, the device used in this tutorial is particularly easy to use as it's a 'FLASH' based chip, which allows easy reprogramming, and it requires hardly any support components (not even a clock crystal). For a suitable programmer, please refer to my WinPicProg site. Although any programmer and software capable of programming a 16F628 will be suitable, obviously I'm using my own WinPicProg software, in conjunction with the P16PRO40 hardware. Support for this tutorial series will be available on my PicProg BBS, I'll be adding an extra forum just for tutorial questions, by asking questions in the forum other users will be able to take advantage of any answers given, and provide answers themselves.

I've decided to base this tutorial on the PIC16F628 rather than the 16F84, there are a number of reasons for this!. 1. The 16F628 is now often cheaper. 2. It contains more program memory and registers. 3. It has more hardware facilities. 4. It has a built-in 4MHz oscillator, making it easier (and cheaper) to construct. 5. It has more I/O pins, 16 as opposed to 13 for the 16F84, the extra 3 I/O pins take the place of the oscillator in and out connections, and the MCLR (reset) pin - to use these extra 3 pins you must set the oscillator to internal, and disable the MCLR pin. The examples given will include this in the configuration fuse settings. The 16F628 has it's I/O pins split across two ports, PortA and PortB, these have quite different properties, and it's important to understand these differences or things don't always work as you expect!. Firstly PortB, this is pretty straightforward, although some of the pins can be used by various of the built-in hardware, as a normal port all pins can be inputs or outputs. PortA is a little less straightforward, all pins can be used as inputs, but RA5 can only be used as an input, and RA4 has an 'open-collector' output stage, this means it requires a 'pull up' resistor to function as a 'normal' output - it can 'sink' current, but can't 'source' it. RA4 in the 16F84 has the same properties - this is often a cause of problems. I've now introduced a second alternative processor board, based on the larger PIC16F876, running at 20MHz, I'll be introducing specific tutorials using this board, and also giving details of the slight changes necessary for using the existing tutorials on the new board. The first part of the Tutorial 1 will simply pulse all the output pins repeatedly, and will

demonstrate how to setup the PIC before use. Most of the Tutorials will include a number of examples (1.1, 1.2 etc), starting with a very simple example and working towards slightly harder ones. Although 'Tutorial 1' specifies it needs the LED Board, the first couple of parts of the tutorial can be used without it, by selecting Jumper J1 to connect the on-board LED to pin RB7. To build the boards see the hardware page. Tutorial Number Hardware Hardware Extras Tutorial 0 Tutorial 1 Tutorial 2 Tutorial 3 Tutorial 4 Tutorial 5 Tutorial 6 Tutorial 7 Tutorial 8 Tutorial 9 Tutorial 10 Tutorial 11 Boards required. Hardware for the tutorials. Extra little circuits that will be useful. Programmer board and software. Main Board, (LED Board). Main Board, Switch Board, (LED Board). Main Board, LCD Board, (Switch Board). Main Board, Joystick Board, LCD Board. 2 x Main Board, 2 x IR Board, LCD Board, Switch Board. Main Board, LCD Board, various I2C Boards. Main Board, LCD Board, RS232 Board. Main Board 2. Main Board, Keypad Board, LCD Board, IR Board, RS232 Board. Main Board, 7 Segment LED Board. Main Board 2 or 3, Analogue Board, LCD Board, RS232 Board. Two Main Boards, One 876 Main Board, TX Board, RX Board, LCD Board, RS232 Board, Switch Board, LED Board, Analogue Board. 876/877 Main Board, Multiplex LED Board. To be decided. How to actually program a chip. How to flash LED's. How to read switches. How to use an LCD text module. How to read a PC Joystick. How to do IR communications. How to use I2C. How to do RS232. How to do hardware PWM. How to use a HEX keypad. How to use dual 7 segment LED's. How to use analogue inputs. How to use licence free wireless modules. How to multiplex a matrix of LED's. To be decided. What do we learn?.

Tutorial 12

Tutorial 13 Tutorial 14

You might also like