2019-01-27 08:11 AM
I am using in adruino declaration
uint16_t x;
.
.
.
byte lowerByte = lowByte(x);
byte upperByte = highByte(x);
Wire.beginTransmission(0x23); //Slave Address
Wire.write(lowerByte);
Wire.write(upperByte);
Wire.endTransmission();
to send bigger numbers over I2C and it works fine
when I use byte to declare number in Keil it does not recognize it .
is there anyway to make the same in Keil ?
2019-01-27 08:33 AM
// overly verbose, but the compiler will optimize out
uint8_t lowerByte = (uint8_t)((x >>0) & 0xFF);
uint8_t upperByte = (uint8_t)((x >>8) & 0xFF);
2019-01-27 09:44 AM
check the definition of byte, lowByte() and highByte() which is not shown here.
Then you can check if there are any compiler dependent issues.