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


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

Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Fri May 07, 2004 3:04 am     Reply with quote

One quick thing: I strongly recommend you to define these two functions and use them instead:


void my_write_eeprom(byte Adress, byte Value)

byte my_read_eeprom(byte Adress)
    return read_eeprom(Adress);

Now if you use my_write_eeprom() and my_read_eeprom() your code will be MUCH smaller.

PostPosted: Sat Jul 16, 2005 1:50 pm     Reply with quote

// ->> ! My english is bad so I hope you understand me. <<- !

I'm have little experience with C , but I almost learnt the basics of C, so here is and my sugestion ;)

Why you don't use bit fields and write the struct at onse ?


struct sometype {

int num;
char ch;


and something similar to fread(structname, sizeof(structname), 1, fd);

this reads size_t -> sizeof bytes from fd ... and keep them in structname and you have (default) 8 bits num and 8 bits ch -> 2 bYtes (16bits).

And if you have number like 20 -> 2^2 -> i.e 2 bits and you don't need the whole 8 bits Smile you can use bit fields and in this way to small the used memory at all.

And in main program (program ROM) and when writing the struct in EEPROM.

for example

int num : 2
int char : 7

now you saved almost 1 byte 6+1 = 7 bits of ram Smile just example.

when you read / write to EEPROM this saves time and ram
when you make the main program and write it to program RAM you save space/ memory again.

I hope you understand me , of course is posible i have some misunderstand and the whole my idea is wrong , but "you have to try" Smile

Good luck !

if you have to contact me ;)

the [dot] real [dot] maniac [at] gmail [dot] com
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