Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - how to convert integer to byte and viceversa

(you are viewing a thread; or go back to list of threads)

how to convert integer to byte and viceversa (by simon)
Hi
I need to convert integer to byte to save on eeprom and convert byte to integer to read from eeprom .
I need help

Thank you
Tue Aug 2 2011, 17:11:23
(no subject) (by Jonathan Westhues)
I'm not sure what you're trying to do. LDmicro supports a "make persistent" operation, which will cause a variable to be saved to EEPROM whenever it changes; but that operation already works on integer variables, so there's no need to do any conversion.
Sat Aug 6 2011, 21:25:08
(no subject) (by simon)
Hi Jonathan
Thank you for response. I have a project that uses a diferent compiler , not using LDmicro ,and is imposible to save values bigger than 255 . I have no ideea how to save value bigger than 255 . I am using floating point and integer, and integer is bigger than 1023 .

Thank you
Sun Aug 7 2011, 14:56:21
(no subject) (by esa)
I use a EEPROM to save word in EEPROM
You must transfert in two byte to read and write the value.
For Float, you must use 4 byte.
Above, my sub routine
Regards
ERic


int16 transfer (int16 data, int8 RW)
{
int8 datah,datal;
datah=data/256;
datal=data-256*datah;
if (RW==LOAD_EEPROM)
{
datal=read_ext_eeprom(cellule);
cellule++;
datah=read_ext_eeprom(cellule);
cellule++;
}
else
{
write_ext_eeprom(cellule,datal);
cellule++;
write_ext_eeprom(cellule,datah);
cellule++;
}
data=datah*256+datal;
return(data);
}
Mon Aug 8 2011, 01:17:43
(no subject) (by simon)
Thank you Esa . I will test your ideea.
Tue Aug 9 2011, 08:27:14
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):