I think the error message means that I can’t declare a const there because only automatic local variables are allowed. If only I could add a User Code block between Globals and Begin in Main! Guess it’s time to read the manual.
I think you have a total of 254 chars, including the ones you use in your program. I just seem to remember this number. I could be completely off the mark.
rom const unsigned char LUT4[256] = {000,003,006,009,012,014,017,020,023,025,028,030,033,035,038,040,042,044,047,049,051,053,055,057,059,061,063,065,067,069,070,072,074,076,077,079,080,082,083,085,086,088,089,090,092,093,094,095,096,098,099,100,101,102,103,104,105,106,107,108,108,109,110,111,111,112,113,114,114,115,116,116,117,117,118,118,119,119,120,120,121,121,121,122,122,122,123,123,123,124,124,124,124,125,125,125,125,125,125,126,126,126,126,126,126,126,126,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,128,128,128,128,128,128,128,128,129,129,129,129,129,129,130,130,130,130,131,131,131,132,132,132,133,133,133,134,134,135,135,136,136,137,137,138,138,139,140,140,141,142,143,143,144,145,146,146,147,148,149,150,151,152,153,154,155,156,158,159,160,161,162,164,165,166,168,169,171,172,174,175,177,178,180,182,184,185,187,189,191,193,195,197,199,201,203,205,207,210,212,214,216,219,221,224,226,229,231,234,237,240,242,245,248,251,255};
Still didn’t work for me, but maybe I don’t have the code in the right part of the project. Where should the code go? Seems like it can’t be in a User Function, and there is no way to enter it in Main…Globals and there is no way to add User Code to Main. I’m sure I could get it to work in MPLAb, but Easyc Pro is fighting me.
One way that works with easyC Pro to use the new C source file feature that was just added this year.
Create a source file (go into the project tab, right click “Source Files” and create a file). In there put the definition of the array with the initialization:
rom const unsigned char L3[2] = {000,001};
Then edit the file UserInclude.h and insert an extern declaration for the array like this:
extern rom const unsigned char L3];
Now you can use references to the L3 array in assignment statements or other expressions throughout your block-based easyC program. The only problem is that the array will not show up in the list of variables when you are creating expressions.