![]() |
const array - 'auto' compile error ?
I have this User Code in OperatorControl immediately after the Variable block:
Code:
rom const unsigned char L3[] = {000,001}; |
Re: const array - 'auto' compile error ?
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.
|
Re: const array - 'auto' compile error ?
I got the same error, I just removed the rom classification to make it work.
|
Re: const array - 'auto' compile error ?
Wouldn't this make it be stored in RAM, not ROM? I think the purpose of putting it in ROM is because there isn't enough room in RAM....
Just speculating, haven't actually tried it. Jacob |
Re: const array - 'auto' compile error ?
Quote:
stack frame too large So I don't think that is creating the array in program space? Smaller arrays do compile. |
Re: const array - 'auto' compile error ?
mmmm....
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. Jacob |
Re: const array - 'auto' compile error ?
This will not work:
Code:
rom const unsigned char L3[] = {000,001};Code:
rom const unsigned char L3[2] = {000,001};Mike |
Re: const array - 'auto' compile error ?
Quote:
Code:
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}; |
Re: const array - 'auto' compile error ?
I did not realize you are using easyC. I am not sure how to work in that environment.
In MPLAB, it would go before the first function call in the file. |
Re: const array - 'auto' compile error ?
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: Code:
rom const unsigned char L3[2] = {000,001};Code:
extern rom const unsigned char L3[]; |
Re: const array - 'auto' compile error ?
Thanks Brad. That did the trick.
|
| All times are GMT -5. The time now is 04:55. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi