i am trying to use code memory space to store some constants patterns. to do this, i have defined an array in code memory space as follows: unsigned char code A[]={0x00,0x3F,0x50,0x90,0x50,0x3F,0xAA}; it doesn't work at all or sometimes i get unpredicted results. but when i define the array in data memory and initialize the array as follows. can anyone help me? thanks A[1] = 0x00; A[2] = 0x3F; . A[6] = 0xAA
The array defined with initializers is initialized by the runtime startup code, whereas the other way is by explicit assignment in your program. Are you including the runtime startup in your project? http://www.keil.com/support/man/docs/c51/c51_ap_startup.htm
"Are you including the runtime startup in your project?" It shouldn't be necessary to explicitly include it - if you don't explicitly include it, you should automatically get the default.