|
|
View previous topic :: View next topic |
Author |
Message |
john.adw
Joined: 28 Jul 2014 Posts: 1
|
Using ROM for Look Up Table "Too many subscripts" |
Posted: Mon Jul 28, 2014 6:50 am |
|
|
Hello everyone !
I have got a problem and I don't know how to fix it (I use CCS V4.024)
I would like to use ROM in order to save data (array) as Look up table.
In my program, I use a function to copy a part of this Look up table in a smaller array.
I have the following errors : "Too many subscripts" and I don't understand why.
Code: | #include "33EP512MU810.h"
#DEVICE ICD = true, ICD = 3
#FUSES NOPROTECT, NOWRT, NOGSSK, NOAPLK, NOWDT, noPUT,HS, CKSFSM, PLLWAIT, NOIOL1WAY, noIESO, NOJTAG,debug
double tab2[1][2]={0,0};
void fun(rom *tab1, double tab2[1][2]){
int j;
for(j=0;j<2;j++){
tab2[0][j]=tab1[0][j];
}
}
void main(){
double const tab1[2][2]={{1.2,2.2},{1.7,5.7}};
double tab2[1][2]={0,0};
fun(tab1,tab2);
}
|
I don't do more subscripts because I want a smaller array.
Thanks for your help ! |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon Jul 28, 2014 11:11 am |
|
|
To find out what's wrong you could even simplify the code further, but one major problem you are having is that compiler version 4.024 is so very bad that I'm sure you will run into problems that can't be fixed.
CCS has the habit that with every new release they bring out a lot of 'test' versions but forget to tell you this is for test purposes only. Only from around 4.074 the compiler started to work again. With the old age of your compiler I suggest you upgrade to one of the newer and proven reliable releases. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Mon Jul 28, 2014 12:27 pm |
|
|
Other problems:.
A rom pointer needs a type (in this case double). Otherwise it doesn't know how large the objects it points to 'are'.
A single dimensional pointer, can't access a multi dimensional array (this is what it is complaining about).
However the odds of it working with 4.024 are basically zero.
Have just checked back on older versions, and use of pointers to ROM, is _not_ documented in 4.027 (the earliest V4 compiler I have), and is not in the readme. It first appears about 20 versions later, and didn't work properly for about the same number of versions after this. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|