Вы находитесь на странице: 1из 2

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.

Вам также может понравиться