PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Mar 28, 2006 4:49 pm |
|
|
Store the array in ROM instead of RAM. Tell the compiler to do this
by using the "const" qualifier in your array declaration. See the
example below:
Code: |
#include <18F452.h>
#fuses XT,NOWDT,PUT,BROWNOUT,NOPROTECT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
int8 const STA013_UpdateData[] =
{
0x3a, 0x01, 0x2a, 0x04, 0x28, 0x00, 0x29, 0x00, 0x20, 0x00,
0x21, 0x00, 0x22, 0x00, 0x23, 0x00, 0x24, 0x00, 0x25, 0x00,
0x26, 0x00, 0x27, 0x00, 0x28, 0x01, 0x28, 0x02, 0x21, 0x8f,
0x28, 0x03, 0x21, 0x00, 0x28, 0x04, 0x28, 0x05, 0x28, 0x06,
0x28, 0x07, 0x28, 0x08, 0x28, 0x09, 0x28, 0x0a, 0x28, 0x0b
// etc.
};
//=================================
void main()
{
int16 i; // Use 16-bit index
int8 value;
// Display the first ten bytes of the array.
for(i = 0; i < 10; i++)
{
value = STA013_UpdateData[i];
printf("%x, ", value);
}
while(1);
} |
|
|