LOW PIN COUNT DEMO BOARD
USERS GUIDE
© 2005 Microchip Technology Inc. DS51556A-page 9
Chapter 2. Mid-Range PICmicro
®
Architectural Overview
2.1 INTRODUCTION
This chapter describes the Mid-range PICmicro
®
Architectural Overview for the LPC
Demo Board.
FIGURE 2-1: SIMPLIFIED MID-RANGE PICmicro
®
BLOCK DIAGRAM
Flash
Program
Memory
13
Data Bus
8
14
Program
Bus
Instruction Reg
Program Counter
RAM
File
Registers
Direct Addr
7
RAM Addr
9
Addr MUX
Indirect
Addr
FSR Reg
Status Reg
MUX
ALU
W Reg
Instruction
Decode and
Control
Timing
Generation
OSC1/CLKI
OSC2/CLKO
8
8
8
3
8-Level Stack (13-bit)
256 bytes
4k x 14
INT
Internal
Oscillator
Block
Low Pin Count Demo Board User’s Guide
DS51556A-page 10 © 2005 Microchip Technology Inc.
2.2 MEMORY ORGANIZATION
PICmicro
®
microcontrollers are designed with separate program and data memory
areas. This allows faster execution as the address and data busses are separate and
do not have to do double duty.
Data Memory is held in file registers. Instructions referring to file registers use 7 bits,
so only 128 file registers can be addressed. Multiple file registers are arranged into
“pages”. Two extra bits RP0 and RP1 (in the Status register) allow accessing multiple
pages. These two bits effectively become the top two bits of the file register address.
The additional pages may or may not be implemented, depending on the device.
Mid-range devices reserve the first 32 addresses of each page for Special Function
Registers (SFRs). SFRs are how the program interacts with the peripherals. The
controls and data registers are memory mapped into the SFR space. Addresses above
0x20 to the end of each page are General Purpose Registers (GPRs), where program
variables may be stored.
Some frequently used registers may be accessed from any bank. For example, the
Status register is always available no matter which bank is selected via the RP bits. The
last 16 bytes (0x70-0x7F) may also be accessed from any bank.
Program Memory is accessed via a 13-bit Program Counter (PC). The lower 8 bits are
accessible via SFR (PCL), and the upper 5 are at a PCLATH. See the
PIC16F685/687/689/690 Data Sheet’s (DS41262) Section on PCL and PCLATH for
more details on the PC. PCLATH becomes important when program memory size
exceeds 1k instructions, and also for the table look-up in Lesson 12.
Mid-range PICmicro
®
MCUs may be clocked by a number of different devices. Unless
otherwise noted, the lessons in this manual use the Internal Oscillator running at 4 MHz.
2.3 INSTRUCTION FORMATS
Most instructions follow one of three formats: Byte oriented instructions, Bit oriented
instructions and Literal instructions.
Byte instructions contain 7-bit data address, a destination bit, and 6-bit op code. The
data address plus the RP0 and RP1 bits create a 9-bit data memory address for one
operand. The other operand is the Working register (called W or Wreg). After the
instruction executes, the destination bit (d) specifies whether the result will be stored in
W or back in the original file register. For example:
ADDWF data,f
adds the contents of Wreg and data, with the result going back into data.
Bit instructions operate on a specific bit within a file register. They contain 7 bits of data
address, 3-bit number and the remaining 4 bits are op code. These instructions may
set or clear a specific bit within a file register. They may also be used to test a specific
bit within a file register. For example:
BSF STATUS,RP0
set the RP0 bit in the Status register.
Literal instructions contain the data operand within the instruction. The Wreg becomes
the other operand. Calls and GOTOs use 11 bits as a literal address.
MOVLW'A'
Moves the ASCII value of ‘A’ (0x41) into Wreg.
Mid-Range PICmicro
®
Architectural Overview
© 2005 Microchip Technology Inc. DS51556A-page 11
2.3.1 Assembler Basics
Numbers in the Assembler
Unless otherwise specified, the assembler assumes any numeric constants in
the program are hexadecimal (base 16). Binary (base 2), Octal (base 8), Decimal
(base 10), and ASCII coding are also supported.
Hexadecimal: 12 or 0x12 or H'12'
Decimal .12 or D'12'
Octal O'12'
Binary B'00010010'
ASCII A'c' or 'c'
Org
(Origin)
Org tells the Assembler where to start generating code. Normally we start coding
at address0000’, but it could be anywhere. Baseline devices have a Reset
vector at the last location in program memory, so it’s good practice to have a
GOTO instruction pointing to the beginning of the program.
End
End tells the assembler to stop assembling. There must be one at the end of the
program. It does not necessarily have to be at the end of the file, but nothing after
the end statement will be assembled.
Defining Data Memory Locations
There are three ways to name a location (see Example 2-1).
EXAMPLE 2-1: DEFINING DATA MEMORY
Unless there is a reason to want a name to a specific location, the cblock/endc
method is preferred. The advantage is that as variables come and go through the
development process, the cblock keeps the block to a minimum. Using one of the other
methods, you may have to go back and find an unused location.
#define Length 0x20 ;c-like syntax
Length equ 0x20 ;equate 0x20 with the symbol
cblock 0x20 ;start a block of variables
Length ;this will be at address 0x20
Width ;this will be at address 0x21
Area:2 ;this is 2 bytes long, starting at
;address 0x22
Girth ;this will be at address 0x24
endc

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