EEPROM Storage

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
Gnu
Posts: 20
Joined: Mon Apr 16, 2007 6:59 pm
Location: UK
Contact:

EEPROM Storage

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Post 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 )

Gnu
Posts: 20
Joined: Mon Apr 16, 2007 6:59 pm
Location: UK
Contact:

Post by Gnu »

Thanks Ben.

Regards

Gnu

Post Reply