Go to Post Some of them look like phone numbers... LETS START CALLING THEM ALL! - akoscielski3 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 15-02-2007, 17:55
oddjob oddjob is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Earth
Posts: 118
oddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to behold
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};
There is a compile error "local 'L3' in program memory can not be auto". This is just a test before I use larger arrays - what's wrong with the code?
  #2   Spotlight this post!  
Unread 15-02-2007, 19:45
oddjob oddjob is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Earth
Posts: 118
oddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to behold
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.
  #3   Spotlight this post!  
Unread 15-02-2007, 22:12
Branden Ghena's Avatar
Branden Ghena Branden Ghena is offline
Previously: tawnos23
FRC #0240 (TEMPEST)
Team Role: College Student
 
Join Date: Nov 2005
Rookie Year: 2004
Location: Houghton, Michigan (MTU)
Posts: 303
Branden Ghena has a spectacular aura aboutBranden Ghena has a spectacular aura aboutBranden Ghena has a spectacular aura about
Re: const array - 'auto' compile error ?

I got the same error, I just removed the rom classification to make it work.
__________________
Branden Ghena - Michigan Tech Student and Team 240 Alumnus
Working Towards: Electrical Engineering and Computer Engineering Double Major

"All we have to decide is what to do with the time that is given to us." - Gandalf
  #4   Spotlight this post!  
Unread 15-02-2007, 22:43
whytheheckme's Avatar
whytheheckme whytheheckme is offline
Registered User
AKA: Jacob Komar
no team
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Providence, RI
Posts: 1,320
whytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond repute
Send a message via ICQ to whytheheckme Send a message via AIM to whytheheckme Send a message via MSN to whytheheckme Send a message via Yahoo to whytheheckme
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
  #5   Spotlight this post!  
Unread 15-02-2007, 23:19
oddjob oddjob is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Earth
Posts: 118
oddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to behold
Re: const array - 'auto' compile error ?

Quote:
Originally Posted by tawnos23 View Post
I got the same error, I just removed the rom classification to make it work.
Removing the word rom, and with an array of length 256 (unsigned char) I get this error:

stack frame too large

So I don't think that is creating the array in program space? Smaller arrays do compile.
  #6   Spotlight this post!  
Unread 16-02-2007, 01:26
whytheheckme's Avatar
whytheheckme whytheheckme is offline
Registered User
AKA: Jacob Komar
no team
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Providence, RI
Posts: 1,320
whytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond repute
Send a message via ICQ to whytheheckme Send a message via AIM to whytheheckme Send a message via MSN to whytheheckme Send a message via Yahoo to whytheheckme
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
  #7   Spotlight this post!  
Unread 16-02-2007, 13:47
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: const array - 'auto' compile error ?

This will not work:

Code:
 rom const unsigned char L3[] = {000,001};
This will work:

Code:
 rom const unsigned char L3[2] = {000,001};
You have to tell the compiler the size of the array in ROM data space.

Mike
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #8   Spotlight this post!  
Unread 16-02-2007, 14:19
oddjob oddjob is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Earth
Posts: 118
oddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to behold
Re: const array - 'auto' compile error ?

Quote:
Originally Posted by Mike Betts View Post
This will work:

Code:
 rom const unsigned char L3[2] = {000,001};
You have to tell the compiler the size of the array in ROM data space.

Mike
I changed my code:
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};
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.
  #9   Spotlight this post!  
Unread 16-02-2007, 18:19
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
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.
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #10   Spotlight this post!  
Unread 17-02-2007, 01:22
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
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};
Then edit the file UserInclude.h and insert an extern declaration for the array like this:
Code:
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.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #11   Spotlight this post!  
Unread 17-02-2007, 01:36
oddjob oddjob is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Earth
Posts: 118
oddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to behold
Re: const array - 'auto' compile error ?

Thanks Brad. That did the trick.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Array Syntax Error Andrew Blair Programming 7 05-02-2006 14:11
stupid Array error: Error [1300] stack frame too l Validius Programming 7 27-01-2006 10:53
compile error Chuck Merja Programming 3 17-02-2005 15:02
InterruptVectorLow error when we compile Redneck Programming 5 02-02-2005 22:57
Compile error blindguyinanorg Programming 4 12-02-2004 19:49


All times are GMT -5. The time now is 00:31.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi