EasyManuals Logo

Microchip Technology PICkit 3 User Manual

Microchip Technology PICkit 3
102 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #88 background imageLoading...
Page #88 background image
PICkit™ 3 Starter Kit User’s Guide
DS41628B-page 88 2012 Microchip Technology Inc.
FIGURE 3-19: TABLE POINTER USED TO READ ONE BYTE OF DATA –
ANSWER IS REFLECTED IN ‘TABLAT’
3.13.7 Assembly Language
3.13.7.1 ENHANCED MID-RANGE
There are three methods of accessing constants in program memory:
1. Computed goto
2. Indirect Addressing
3. Table Reads
The code will implement 3 different ways to utilize these methods:
1. Computed goto
a) Program Counter
b) BRW instruction
2. Indirect Addressing
a) FSR/INDF
3. Table Reads
a) EECON/EEDAT/EEADR SFRs
The third method can return the full 14 bits of the program memory words while the first
two only return an 8-bit byte. This lesson demonstrates all three methods, but utilizes
only the lower 8-bits of the data retrieved by method three.
3.13.7.1.1 Program Counter
Calling the look-up table has a limitation: if the table falls across a 256-byte page
boundary, or the index into the table exceeds the table bounds, then it will jump to a
location out of the table.
Good programming practices dictate a few additional instructions for our example: first,
since the table is only sixteen entries, make sure a number no larger than 16 is passed
in. The simplest way to do this is to logically AND the contents of WREG before modi-
fying PCL:
More complex error recovery schemes may be appropriate, depending on your appli-
cation.
In addition, there are some nuances to be aware of, should the table cross a 256-word
boundary. The Program Counter is 15 bits wide, but only the lower eight bits are repre-
sented in PCL. The remaining five bits are stored in PCLATH. However, an overflow of
ANDLW 0x0F

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Microchip Technology PICkit 3 and is the answer not in the manual?

Microchip Technology PICkit 3 Specifications

General IconGeneral
BrandMicrochip Technology
ModelPICkit 3
CategoryComputer Accessories
LanguageEnglish

Related product manuals