Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to store 10 digit number in 8 bit eerpom

Status
Not open for further replies.

raman00084

Full Member level 6
Full Member level 6
Joined
Nov 29, 2010
Messages
375
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Visit site
Activity points
4,076
i want to store 10 digit number in pic inbuilt eeprom using long integer, but i can store only 32,767 by doing the following

(long int) value=32767

(long int)low_bites=value & 0xff

(long int)high_bites= (value>>8) & 0xff

eeprom_write address_4= low_bites

eeprom_write address_5= high_bites

eeprom_read adress_4= (long int) a
eeprom_read adress_5= (long int) b
(long int) total=a+(b<<8)
lcd_print= total

by doing this i can get only 32767
how to increase to 10digit number for long int the max value is 2147483647
how to store this value how much eeprom memory i must take please send sample program

regards
kalyan
 

The internal EEPROM stores only bytes, you usually store long int (int32) in four consecutive eeprom bytes.

Many embedded C compilers have examples or built-in functions to handle numbers in EEPROM.

You previously said to use CCS C. I guess you never came across the internal_eeprom.c utility functions in the CCS C /Drivers directory?
 

hello


to store a long value (32 bits)
you need to use 4 Eeprom adresses locations !

32767 could not be a long , it could be an signed or unsigned int ..
unsigned long, Maximum value is 4294967295 = 0xFFFFFFFF


try this

Code:
unsigned int value;
unsigned char Low_bites,High_bites;


 value=32767;  // coul be up to 65535 !
low_bites=value & 0x00ff
high_bites= (value>>8) & 0x00ff
eeprom_write address_4= low_bites
eeprom_write address_5= high_bites

be carrefull to the order to save value , when using back (Eeprom reading) with your application
LSB then MSB
or
MSB then LSB
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top