Hi, the problem is that the compiler uses MOVX instead of MOVC when I'm reading the rom, of course it doesn't work. There's no problem to write the flash. I don't want to add an assembly routine. Is there any other solution? I'm using Silabs C8051F020.
Thanks.
You're right, but first I need to write a string in rom, and then read one character at a time. If I declare "char code string[5]", as instance, I can't write in it, even if I use a xdata pointer. So I did this:
unsigned char xdata vector[10]; unsigned char code *pflashread;
unsigned char xdata *pflashwrite;
pflashread = 0xbbbb;
pflashwrite = pflashread;
write_flash(pflashwrite,vector);
var_2 = pflashread[0]; //here I read directly
Don't think I haven't try a few things before this.