I'd like to put a constant array in program memory of PIC16F877, like below (see enclosure too):
Code: Select all
#include <htc.h>
#include <stdio.h>
#include <string.h>
void main(void)
{
char a[5];
const unsigned char buffer[]={'0','1','0','1','0'};
const unsigned char* p ;
p=&buffer;
for (char cur = 0; cur < 5; p+=1, cur++)
{
a[cur]=*p;
}
while(1==1);
}
If I place instead the array in Data memory, that is I remove const in declaration, the values in *main@p during debug are as expected ('0','1','0','1').
Thank you in advance for a clarification, if any.
Regards