Storing constant data in program memory

From Mech
Revision as of 15:06, 26 January 2008 by Lynch (talk | contribs)
Jump to navigationJump to search

Original Assignment

Your PIC has a relatively large amount of program memory (32 Kbytes) but relatively little data memory (1536 bytes). For some applications, we want to have lookup tables or calibration data stored on our PIC, but we don't want it hogging data memory. This project is to demonstrate how to write a program that stores constant data in program memory. Test your ability to do this by creating a look-up table for the sin function. This is a 1-d array with integer index corresponding to an angle (e.g., numbers 0 to 359 if the index is in degrees). Depending on your choice of int8, int16, or float to represent the number, what angle resolution can you use for the index before you reach the limits of program memory?

See p. 43 of the PIC MCU C Compiler book.

Overview

Circuit

Code