Go to Post And whether or not we are awarded in the course of the season, at its end our team will look back, and we’ll look at one another, and we will wonder how we were able to accomplish what we did. - John Wanninger [more]
Home
Go Back   Chief Delphi > Other > FIRST Tech Challenge
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 28-05-2006, 01:24
gblake's Avatar
gblake gblake is offline
6th Gear Developer; Mentor
AKA: Blake Ross
no team (6th Gear)
Team Role: Mentor
 
Join Date: May 2006
Rookie Year: 2006
Location: Virginia
Posts: 1,940
gblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond repute
Arrays in Vex Programming Kit EasyC?

I want to declare and then use a C-lanuage array in a program written using the EasyC Version 1.1 that came with my Vex Programming kit.

Am I out of luck or can it be done?

If it can be done, I would appreciate seeing a code snippet.

Thanks in advance
__________________
Blake Ross, For emailing me, in the verizon.net domain, I am blake
VRC Team Mentor, FTC volunteer, 5th Gear Developer, Husband, Father, Triangle Fraternity Alumnus (ky 76), U Ky BSEE, Tau Beta Pi, Eta Kappa Nu, Kentucky Colonel
Words/phrases I avoid: basis, mitigate, leveraging, transitioning, impact (instead of affect/effect), facilitate, programmatic, problematic, issue (instead of problem), latency (instead of delay), dependency (instead of prerequisite), connectivity, usage & utilize (instead of use), downed, functionality, functional, power on, descore, alumni (instead of alumnus/alumna), the enterprise, methodology, nomenclature, form factor (instead of size or shape), competency, modality, provided(with), provision(ing), irregardless/irrespective, signage, colorized, pulsating, ideate
Reply With Quote
  #2   Spotlight this post!  
Unread 28-05-2006, 11:04
artdutra04's Avatar
artdutra04 artdutra04 is offline
VEX Robotics Engineer
AKA: Arthur Dutra IV; NERD #18
FRC #0148 (Robowranglers)
Team Role: Engineer
 
Join Date: Mar 2005
Rookie Year: 2002
Location: Greenville, TX
Posts: 3,078
artdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond repute
Re: Arrays in Vex Programming Kit EasyC?

Yes, arrays will work in EasyC ver 1 without anything special - all you need to use are the "User Code" blocks. The following code should work for using a variable as an array.
Code:
#include "Main.h"

void main ( void )
{
      int example_array; 

      int example_array[4];
      example_array[0] = whatever you want;
      example_array[1] = whatever you want;
      example_array[2] = whatever you want;
      example_array[3] = whatever you want;
}
And here is a screenshot:
__________________
Art Dutra IV
Robotics Engineer, VEX Robotics, Inc., a subsidiary of Innovation First International (IFI)
Robowranglers Team 148 | GUS Robotics Team 228 (Alumni) | Rho Beta Epsilon (Alumni) | @arthurdutra

世上无难事,只怕有心人.
Reply With Quote
  #3   Spotlight this post!  
Unread 30-05-2006, 22:24
gblake's Avatar
gblake gblake is offline
6th Gear Developer; Mentor
AKA: Blake Ross
no team (6th Gear)
Team Role: Mentor
 
Join Date: May 2006
Rookie Year: 2006
Location: Virginia
Posts: 1,940
gblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond repute
Re: Arrays in Vex Programming Kit EasyC?

Art,

You show the variable example_array being declared twice. I don't think that is necessary (I also don't think that it is necessarily harmful, but it can lead to confusion). Was that done on purpose, or was it accidental?

Blake
__________________
Blake Ross, For emailing me, in the verizon.net domain, I am blake
VRC Team Mentor, FTC volunteer, 5th Gear Developer, Husband, Father, Triangle Fraternity Alumnus (ky 76), U Ky BSEE, Tau Beta Pi, Eta Kappa Nu, Kentucky Colonel
Words/phrases I avoid: basis, mitigate, leveraging, transitioning, impact (instead of affect/effect), facilitate, programmatic, problematic, issue (instead of problem), latency (instead of delay), dependency (instead of prerequisite), connectivity, usage & utilize (instead of use), downed, functionality, functional, power on, descore, alumni (instead of alumnus/alumna), the enterprise, methodology, nomenclature, form factor (instead of size or shape), competency, modality, provided(with), provision(ing), irregardless/irrespective, signage, colorized, pulsating, ideate
Reply With Quote
  #4   Spotlight this post!  
Unread 30-05-2006, 23:19
artdutra04's Avatar
artdutra04 artdutra04 is offline
VEX Robotics Engineer
AKA: Arthur Dutra IV; NERD #18
FRC #0148 (Robowranglers)
Team Role: Engineer
 
Join Date: Mar 2005
Rookie Year: 2002
Location: Greenville, TX
Posts: 3,078
artdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond repute
Re: Arrays in Vex Programming Kit EasyC?

Quote:
Originally Posted by 1885.Blake
Art,

You show the variable example_array being declared twice. I don't think that is necessary (I also don't think that it is necessarily harmful, but it can lead to confusion). Was that done on purpose, or was it accidental?

Blake
I'm not sure if it is necessary in EasyC 2.0, but I know in EasyC 1 I would sometimes get errors when trying to use something like some_variable[1][3] in an assignment because that variable had not been previously declared in the Variable dialog window. (Also, since the variable was not declared in the Variable window, it would not show up in the drop down menus in the popup window wizards.)

It will work with only one line of code (the one where it defines the array), but I used two just to make it easier later on when I was using that array in the popup windows.
__________________
Art Dutra IV
Robotics Engineer, VEX Robotics, Inc., a subsidiary of Innovation First International (IFI)
Robowranglers Team 148 | GUS Robotics Team 228 (Alumni) | Rho Beta Epsilon (Alumni) | @arthurdutra

世上无难事,只怕有心人.
Reply With Quote
  #5   Spotlight this post!  
Unread 11-09-2006, 16:54
sedim sedim is offline
SeDiM
no team
 
Join Date: Sep 2006
Location: NJ
Posts: 3
sedim is an unknown quantity at this point
Re: Arrays in Vex Programming Kit EasyC?

Hi all,
I have tried defining:

int example_array[4]; //Works!
//and
int example_array[55]; //Works!
//but!!!!!!!!
int example_array[56];// Or greater does not work!!!!!!!!

//I get a complier error
"C:\vex\Guidance\Main.c:12:Error [1300] stack frame too large

Any ideas??
Reply With Quote
  #6   Spotlight this post!  
Unread 11-09-2006, 17:08
thegathering's Avatar
thegathering thegathering is offline
Angry Troll Lurking in the MUD
AKA: Ben
FRC #1885 (Robocats)
Team Role: Programmer
 
Join Date: Jul 2006
Rookie Year: 2006
Location: Look around you. What do you see?
Posts: 333
thegathering is a splendid one to beholdthegathering is a splendid one to beholdthegathering is a splendid one to beholdthegathering is a splendid one to beholdthegathering is a splendid one to beholdthegathering is a splendid one to behold
Send a message via AIM to thegathering
Re: Arrays in Vex Programming Kit EasyC?

Quote:
Originally Posted by sedim
Hi all,
I have tried defining:

int example_array[4]; //Works!
//and
int example_array[55]; //Works!
//but!!!!!!!!
int example_array[56];// Or greater does not work!!!!!!!!

//I get a complier error
"C:\vex\Guidance\Main.c:12:Error [1300] stack frame too large

Any ideas??
Arrays are limited by the amount of memory that can be allocated to them. 1300 blocks of memory for a single array is an extremely large amount, even more so for that little vex bot.

I would suggest if you absolutely have to use an array, you make parallel arrays, perhaps several arrays of 10 or even two dimensional arrays (an array holding references to multiple arrays) to break up the locations that the array can be stored.

If that does not work, then you may just not have enough memory to store large arrays. If that is the case, then you may be out of luck and will have to work around it or trim down your variable usage to free space. :\

Hope that helps somewhat.
__________________

*2006 Champion Rookie All Star Award.
*2 x 2006 Regional Rookie All Star Awards.

Last edited by thegathering : 11-09-2006 at 17:12.
Reply With Quote
  #7   Spotlight this post!  
Unread 11-09-2006, 17:30
sedim sedim is offline
SeDiM
no team
 
Join Date: Sep 2006
Location: NJ
Posts: 3
sedim is an unknown quantity at this point
Re: Arrays in Vex Programming Kit EasyC?

Thanks for the Array Clarification. I am only defining 56 locations the moment I define one more it fails as in:
int example_array[55]; //Works!
int another_array[0];//does not work!!!!!!!!

//Still Gives me
"C:\vex\Guidance\Main.c:12:Error [1300] stack frame too large

The error # [1300] as defined in the C 18 Manual is as follows:

"1300: stack frame too large
The size of the stack frame has exceeded the maximum addressable size.
Commonly caused by too many local variables allocated as 'auto' storage
class in a single function."

When I change the "Default Storage Class" to from "Auto to "Overlay" or "Static" using MPLAB IDE, the linker gets me in trouble with the following:

MPLINK 3.90, Linker
Copyright (c) 2004 Microchip Technology Inc.
Error - could not find definition of symbol '__Wait:0' in file 'C:\vex\Guidance\Main.o'.
Errors : 1

So I comment out the Wait function and now the others start giving me the same problem:

as in:

//Wait (1000);
printf("hello all\n");

Error is now :

MPLINK 3.90, Linker
Copyright (c) 2004 Microchip Technology Inc.
Error - could not find definition of symbol '__printf:0' in file 'C:\vex\Guidance\Main.o'.
Errors : 1


Any Ideas folks?
Reply With Quote
  #8   Spotlight this post!  
Unread 11-09-2006, 23:32
foobert foobert is offline
Registered User
no team
 
Join Date: May 2005
Location: oakland, ca
Posts: 87
foobert is a jewel in the roughfoobert is a jewel in the roughfoobert is a jewel in the rough
Re: Arrays in Vex Programming Kit EasyC?

perhaps if you declared the array static you could get it off the stack.

but remember alls you gets is a meager 2k for everything.
Reply With Quote
  #9   Spotlight this post!  
Unread 12-09-2006, 07:04
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,860
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Arrays in Vex Programming Kit EasyC?

You are running into defined limits on how many bytes of global or local variables are available within any one project file or within any one routine.
It's not your one array of [56], but the sum of all the variables you've declared. For instance, if you have a couple of other variables declared, like so:

int a,b,c;
int example_array[55];

then

// int a,b,c;
int example_array[58];

would work for you.

The magic number is 256 bytes (or 128 int's).
  • 256 bytes of global variables (outside any routine or static) in any one project file (block).
  • 120 bytes of local variables declared within any single routine (not static)
but you should test the limits as you've been doing.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 12-09-2006 at 10:31.
Reply With Quote
  #10   Spotlight this post!  
Unread 12-09-2006, 17:05
sedim sedim is offline
SeDiM
no team
 
Join Date: Sep 2006
Location: NJ
Posts: 3
sedim is an unknown quantity at this point
Re: Arrays in Vex Programming Kit EasyC?

Thank you all for your contributions. Indeed, Mark McLeod's post is confirmed. I have also found out that we can utilize the "overlay" Storage class which acts as a static class but is initialized upon entry to the function. The maximums achieved are:

int array0[60];
overlay int array1[128];//But there are consequences

in the same function.

Best
Sedim
Reply With Quote
Reply


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
vex programming kit Alex Burman FIRST Tech Challenge 1 30-03-2006 18:30
Pre-Load Arrays in EasyC, Possible? Chris_Elston Programming 6 22-02-2006 10:25
EasyC 2.0 for VEX Robotics Kit jeffmorris Programming 7 26-01-2006 10:21
Vex programming kit finally available?? rswsmay General Forum 20 27-09-2005 22:08
White Paper Discuss: VEX / intelitek easyC programming document dez250 Extra Discussion 3 15-09-2005 15:20


All times are GMT -5. The time now is 18:23.

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