![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
peteD
Joined: 22 May 2006 Posts: 5
|
typemod -no joy- can't get sample code to work |
Posted: Mon May 22, 2006 5:49 pm |
|
|
I am trying hard to convert from hitech c to ccs and am stuck setting up my eeprom tables.
My intention is to have a couple of arrays in eeprom which contain variables that are occassionally changed. One array for example contains a table of a-to-d conversion values. Another array contains pointers to the default values in the first table while a third array contains pointers to the user's selected values. (low voltage, high voltage, etc).
I have been trying to get TYPEMOD to work for this. Even using the example on page 75 of the October 2005 manual, verbatim, I get an error as soon as I try to declare a variable using the defined typemod. (Forget arrays... just individual variables.
Here is the code and I inserted the error message on the line that generates it. I can't make sense of error 36 in this context. (I tryed using int16 instead of int32 to no avail). Chip is a 12F683 as declared in the code. MPLAB 7.31, compiler is latest release.
As I have wasted a week on this problem, creating simpler and simpler examples... any clues would be greatly appreciated.
#device PIC12F683
// DIRECTLY FROM PAGE 75 of OCTOBER 2005 Manual
void DataEE_Read(int32 addr, int8 * ram, int bytes) {
int i;
for(i=0;i<=bytes;i++,ram++,addr++)
*ram=read_eeprom(addr);
}
void DataEE_Write(int32 addr, int8 * ram, int bytes) {
int i;
for(i=0;i<=bytes;i++,ram++,addr++)
write_eeprom(addr, *ram);
}
typemod <,DataEE_Read,DateEE_Write,5,0xff>DataEE ;
void main()
{
int DataEE test; // *** Error 36 Line 27(12,16): Expecting a ; or ,
int x,y;
x=12; //
test =x;
y=test;
} |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon May 22, 2006 8:56 pm |
|
|
The problem is that the CCS manual has typos, and so does your code.
The manual is missing the '_' in the first parameter:
Quote: | typemod <,DataEEread,DataEE_write,5,0xff>DataEE; |
Your code has the 2nd parameter misspelled:
Quote: | typemod <,DataEE_Read,DateEE_Write,5,0xff>DataEE ; |
|
|
![](templates/subSilver/images/spacer.gif) |
peteD
Joined: 22 May 2006 Posts: 5
|
Thanks |
Posted: Tue May 23, 2006 12:04 pm |
|
|
Well shiver me timbers! Amazing what you can't see when you look really hard for a long time. And none of the CCS support folks caught this either.
THANK YOU! compiles just fine with that one fix. Error message sure did not help any.
Pete |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|