CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

typemod -no joy- can't get sample code to work

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
peteD



Joined: 22 May 2006
Posts: 5

View user's profile Send private message

typemod -no joy- can't get sample code to work
PostPosted: Mon May 22, 2006 5:49 pm     Reply with quote

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;

}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon May 22, 2006 8:56 pm     Reply with quote

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 ;
peteD



Joined: 22 May 2006
Posts: 5

View user's profile Send private message

Thanks
PostPosted: Tue May 23, 2006 12:04 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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