Ttelmah Guest
|
|
Posted: Wed Sep 13, 2006 5:18 am |
|
|
16 bit data, is just two 8 bit bytes (this is how the processor stores it anyway). Look at the make8, and make16 functions (which allow the bytes to be seperated and rejoined).
An example of a generic 'bigger I/O' function, would be:
Code: |
void write_eeprom_block(int16 ROM_addr, int8 * addr, int8 number_of_bytes) {
int8 ctr;
for (ctr=0;ctr<number_of_bytes;ctr++) {
write_eeprom(ROM_addr++,*(addr++));
}
}
//For your 'int16' volume value, call with:
write_eeprom_block(0x00,&volume,sizeof(volume));
|
The nice thing about this, is that the same function, will handle int32, int16, float etc..
Best Wishes |
|