Hi,
Use bit shift:
uint16_t sensor_val = 3245;
uint8_t sensor_val_low, sensor_val_high;
sensor_val_low = (sensor_val & 0xFF);
sensor_val_high = (sensor_val >> 8);
buffer[0]= sensor_val_low;
buffer[1]= sensor_val_high;
And the other way round on the other site.
uint16_t sensorout;
uint8_t getdata_low, getdata_high;
getdata_low = buffer[0];
getdate_high = buffer[1];
sensorout = (getdata_high << 8);
sensorout |= getdata_low;
Regards
Daniel