First - A PIC16C84 test circuit and program

First - A PIC16C84 test circuit and program - My First PIC...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
My First PIC Project ==================== David Tait [email protected] The PIC16C84 (or PIC16F84) from Microchip is a really great little processor. Being based on EEPROM (or "flash") technology means that it can be programmed in a matter of seconds and typically it can be reprogrammed around 1000 times. Of its 18 pins 13 can be used as general purpose I/O. When programmed as outputs the I/O pins are able to source 20mA and sink 25mA (more than enough to drive LEDs directly for example). It is inexpensive and can be programmed with simple DIY hardware. Obviously these features make the '84 attractive for many projects but they also mean that it is an ideal processor for anyone wanting to learn about microcontrollers. This short document is meant for people who have just built or purchased a PIC programmer and are itching to get their '84 doing something if only to convince themselves that their programmer, PIC or both are working. To do this we obviously need to lash together some simple hardware and this means knowing a little about the PIC. Here's a pinout diagram (looking from above): +-----+ +-----+ RA2 |1 +-+ 18| RA1 RA3 |2 17| RA0 RA4/T0CKI |3 16| OSC1/CLKIN /MCLR |4 16C84 15| OSC2/CLKOUT VSS |5 14| VDD RB0/INT |6 16F84 13| RB7 RB1 |7 12| RB6 RB2 |8 11| RB5 RB3 |9 10| RB4 +-------------+ The RA* and RB* pins are I/O pins associated with the PIC registers PORTA and PORTB respectively (RA4 can also be used as an input to the internal timer and RB0 can be used as an interrupt). VDD and VSS are the power pins. The '84 works over a wide range of voltages but typically VSS is connected to 0V and VDD to +5V. The main reset pin, /MCLR, can simply be tied to VDD (either directly or through a resistor) because the PIC includes a reliable power-on reset circuit - all you need to do to reset the PIC is cycle its power. The processor needs a clock and the OSC1 and OSC2 pins can be configured for a variety of different options including crystal and low cost RC oscillator modes. A simple circuit that you can use as the basis of your first PIC16C84 project is shown here: / +-O O---+---------------+--------------------+ | | | | | | +----O----+ | | + | | 14 | PIC16C84 | ------- | ____ | | ____ | --- +--[____]--O 4 16 O----+--[____]--+ ------- 1K | | | 4.7K | 4.5V --- ____ | | | | battery ------- +--[____]--O 10 | _|_ _|_ --- _|_ 470 | 5 | ___ 22pF ___ 0.1uF
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
| - \ /^ +----O----+ | | | --- LED | | | | | | | | +-------+---------------+---------+----------+ (Grab http://www.man.ac.uk/~mbhstdj/files/test.gif for a more readable version). The circuit uses an RC oscillator and one I/O pin (RB4) attached to a LED. This is all you need to get the PIC to do something and see it happening. Charles Manning (Electronics Australia, April 1996) wrote an amazingly short (6 word) LED flasher program that you can use with this circuit: LIST P=16C84 MOVLW 0 TRIS 6 OPTION LOOP SLEEP INCF 6,F GOTO LOOP END The program is written for MPASM (Microchip's free assembler available from http://www.microchip.com). To use the program you'll need to extract it from this file using a text editor (DOS EDIT is fine), save it to another file (LIGHTS.ASM for example) then assemble it with MPASM (using the command "MPASM LIGHTS.ASM") to produce a hex file LIGHTS.HEX which can then be downloaded to the PIC using your programmer.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern