Page 1 of 1

EEPROM Storage

Posted: Thu Jan 10, 2008 7:01 pm
by Gnu
Is it possible to store the 10-bit output from the ADC in a 16F88 in its EEPROM, using Flowcode, perhaps by storing 5 bits in two separate locations ? If so, what is the neatest way of getting the number out again ?

Regards

IRH

Posted: Fri Jan 11, 2008 10:25 am
by Benj
Hello

The easiest way is to use a full two bytes. eg 16-bits.

Firstly you will have your 16-bit integer variable, we will call this int_var.

So to convert int_var into two bytes we do the following.

byte1 = int_var
byte2 = int_var >> 8

The two bytes can now be written to the EEPROM or the RS232 etc.

To convert the number back simply reverse the calculations.

int_var = byte1
int_var = int_var + ( byte2 << 8 )

Posted: Fri Jan 11, 2008 10:36 am
by Gnu
Thanks Ben.

Regards

Gnu