Low Pin Count Demo Board User’s Guide
DS51556A-page 12 © 2005 Microchip Technology Inc.
NOTES:
LOW PIN COUNT DEMO BOARD
USERS GUIDE
© 2005 Microchip Technology Inc. DS51556A-page 13
Chapter 3. LPC Demo Board Lessons
3.1 INTRODUCTION
The following lessons cover basic LPC Demo Board features. Refer to applicable
documents as needed. Any updates to the applicable documents are available on
Microchip’s web site.
The code and hex files are installed in C:\Microchip\PICkit 2 Lessons\. They
may also be found on the PICkit™ 2 CD-ROM under directory \PICkit 2 Lessons\.
3.2 LPC DEMO BOARD LESSONS
Lesson 1: Hello World (Light a LED)
Lesson 2: Delay Loop (Blink a LED)
Lesson 3: Rotate (Move the LED)
Lesson 4: Analog-to-Digital
Lesson 5: Variable Speed Rotate
Lesson 6: Switch Debounce
Lesson 7: Reversible Variable Speed Rotate
Lesson 8: Function Calls
Lesson 9: Timer0
Lesson 10: Interrupts
Lesson 11: Indirect Data Addressing
Lesson 12: Look-up Table (ROM Array)
Low Pin Count Demo Board User’s Guide
DS51556A-page 14 © 2005 Microchip Technology Inc.
3.2.1 Lesson 1: Hello World (Light a LED)
The first lesson shows how to turn on a LED. This is the PICmicro
®
microcontroller
version of “Hello World” and discusses the I/O pin structures.
New Instructions
BSF Bit set
BCF Bit clear
The LEDs are connected to I/O pins RC0 through RC3. When one of these I/O pins
drive high, the LED turns on. The I/O pins can be configured for input or output. On
start-up, the default is input. The TRIS bits use the convention of0’ for output and ‘1
for input. We want digital output so these must be configured.
EXAMPLE 3-1: PICkit 2, LESSON 1: “HELLO WORLD”
Now lets look at the program that makes this happen.
; Starts a comment. Any text on the line following the semicolon
is ignored.
#include Brings in an include file defining all the Special Function
Registers available on the PIC16F690. Also, it defines valid
memory areas. These definitions match the names used in the
device data sheet.
__Config Defines the Configuration Word. The labels are defined in the
p16F690.inc file. The labels may be logically ANDed
together to form the word.
Org 0 Tells the assembler where to start generating code. Code may
be generated for any area of the part. Mid-range PICmicro
®
microcontroller devices start at address ‘0, also called the
Reset vector.
BCF TRISC,0 Tells the processor to clear a bit in a file register. TRISC is the
Tri-state register for pin 0 of PORTC. A ‘1’ in the register
makes the pin an input; a 0’ makes it an output. We want to
make it an output, so the bit must be cleared.
BSF PORTC,0 Tells the processor to set pin 0 of PORTC. This will force the
I/O pin to a high condition turning on the LED.
GOTO $ Tells the processor to go to the current instruction.
For more information, refer to the I/O Ports Section of the PIC16F685/687/689/690
Data Sheet (DS41262).
; PICkit 2 Lesson 1 - 'Hello World'
;
#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF &
_MCLRE_OFF & _CP_OFF & _BOD_OFF & _IESO_OFF & _FCMEN_OFF)
org 0
Start
BSF STATUS,RP0 ;select Register Page 1
BCF TRISC,0 ;make I/O Pin C0 an output
BCF STATUS,RP0 ;back to Register Page 0
BSF PORTC,0 ;turn on LED C0
GOTO $ ;wait here
end

DM164120-1

Mfr. #:
Manufacturer:
Microchip Technology
Description:
Development Boards & Kits - PIC / DSPIC PICkit 2 Low Pin Cnt Demo Board
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet