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 support@ccsinfo.com

byte allocation for numbers in EEPROM

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



Joined: 06 Mar 2007
Posts: 92
Location: Pune,India

View user's profile Send private message AIM Address Yahoo Messenger

byte allocation for numbers in EEPROM
PostPosted: Wed Jun 04, 2008 1:07 am     Reply with quote

Dear sir,
Here i am using 16f913 device, & compiler 4.073 v
So if i want to store numbers < 255 I have to allocate 1 byte of EEPROM.
Then if i want to store number 60000 or above how much byte i have to allocate to store this number in EEPROM.
Because 1 location will store 1 byte of data,so data range is 0 to 255
& if i am using 2nd location data range is 256 to 512 or till 65535.
please clear my knowledge.
_________________
Thank You,
With Best Regards,
Deepak.
Ttelmah
Guest







PostPosted: Wed Jun 04, 2008 2:13 am     Reply with quote

Look in the help file. Contents - Data definitions - Basic types. What does it show that you can hold in an unsigned int16?.
Now do a search here, and you will find lots of threads about how to store these larger types (particularly about floats, but the same answers apply for int16), into the EEPROM.
Hopefully, you can find what you need from these sources. Come back if you have trouble.

Best Wishes
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Wed Jun 04, 2008 2:19 am     Reply with quote

I wonder how many people will have ignored this question. This is basic progamming knowledge you should already know.

Basically it is the number of bits that determin the size of the value you can store.
8 bits (1 byte) = 0 to 255
16 bits (2 bytes) = 0 to 65535
32 bits (4 bytes) = 0 to 4294967295

basically 2^bits is the size but the range is 0 to (2^bits - 1)
2^8 = 256 but 0 is counted as 1 so you can store a value from 0 to 255.

Hope this helps.
deepakomanna



Joined: 06 Mar 2007
Posts: 92
Location: Pune,India

View user's profile Send private message AIM Address Yahoo Messenger

byte allocation in EEPROM
PostPosted: Wed Jun 04, 2008 3:10 am     Reply with quote

Actually my question is,
If i want store number at "00 location" max number is 255,OK
& if i want to store number at " 00 & 01 location" max number can be possible is " 512 or 65535."
_________________
Thank You,
With Best Regards,
Deepak.
Ttelmah
Guest







PostPosted: Wed Jun 04, 2008 3:23 am     Reply with quote

Your question has already been answered.....
As Wayne says, it is very 'basic', which is why I said 'read the manual'....
He has put the answer in his reply.
Think of it like a calculator display. If somebody said 'my calculator can display 8 digits, what is the biggest number it can display', the reply would be 'count them'. Mathematically, the answer is (10^8)-1. This is exactly how it works with binary values (and the bytes normally used to hold them). (2^NumberOfbits)-1.

Best Wishes
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