DM240002 Microchip Technology, DM240002 Datasheet - Page 36

BOARD DEV EXPLORER 16 44-PIN

DM240002

Manufacturer Part Number
DM240002
Description
BOARD DEV EXPLORER 16 44-PIN
Manufacturer
Microchip Technology
Series
Explorer 16 44-pinr
Type
MCUr
Datasheet

Specifications of DM240002

Contents
Explorer 16 Dev Board, PIC24FJ64GA004 and dsPIC33FJ32GP204 PIM Modules
Processor To Be Evaluated
PIC24FJ128GA010, dsPIC33FJ256GP710
Processor Series
PIC 24, dsPIC33
Data Bus Width
32 bit
Interface Type
RS-232
Silicon Manufacturer
Microchip
Core Architecture
PIC, DsPIC
Core Sub-architecture
PIC24, DsPIC33
Silicon Core Number
PIC24F, DsPIC33F
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
dsPIC30, dsPIC33, PIC32, PIC24FJ, PIC24HJ
Lead Free Status / Rohs Status
Lead free / RoHS Compliant

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
DM240002
Manufacturer:
Microchip Technology
Quantity:
135
Part Number:
DM240002
Manufacturer:
MICROCHIP
Quantity:
12 000
44-Pin Demo Board User’s Guide
DS41296B-page 32
3.2.12
Lesson 8 introduced function calls. Lesson 12 shows how function calls and calculated
modification of the Program Counter may be used to implement a look-up table (see
Example 3-11).
It is sometimes useful to implement a table to convert from one value to another.
Expressed in a high-level language it might look like this:
That is for every value of x, it returns the corresponding y value.
Look-up tables are a fast way to convert an input to meaningful data because the trans-
fer function is pre-calculated and “looked up” rather than calculated on the fly.
PIC microcontrollers implement these by directly modifying the Program Counter (PC).
An example might be a function that converts hexadecimal numbers to the ASCII
equivalent. Each digit’s individual nibble can be pulled out of the number and used as
the index to the look-up table. The index advances the PC to the appropriate RETLW
instruction to load WREG with the corresponding constant and returns to the calling
program.
EXAMPLE 3-11:
If the table falls across a 256 byte program memory boundary, or if somehow the
look-up table is called with an out of bounds index value, it will jump to a location out of
the table.
Good programming practices dictate a few additional instructions. First, since the table
has only sixteen entries, make sure a number no larger than 16 is passed in. The sim-
plest way to do this is to logically AND the contents of WREG before modifying PCL:
ANDLW 0x0F. More complex error recovery schemes may be appropriate, depending
on the application.
In addition, there are some nuances to be aware of should the table cross a 256 word
boundary. The Program Counter is 13 bits wide, but only the lower 8 bits are repre-
sented in PCL (see Figure 3-12). The remaining 5 bits are stored in PCLATH. However,
an overflow of the lower 8 bits is not automatically carried over into PCLATH. Instead,
be sure to check for and handle that case in the code. See the PCL and PCLATH
section in the PIC16F882/883/884/886/887 Data Sheet (DS41291) for more details of
how PCLATH is used.
;Enter with index in Wreg
LookupTable
y = function(x);
ADDWF
RETLW
RETLW
...
RETLW
Lesson 12: Look-up Table (ROM Array)
LOOK-UP TABLE
PCL,f
'0'
'1'
'F'
;jump to
;index 0
;index 1
;index 15
© 2007 Microchip Technology Inc.

Related parts for DM240002