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
EEPROM Storage
- 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:
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 )
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 )
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel