Converts number to a 16-bit signed integer presented as 2 bytes. An input for the the conversion should be between -32768.00 and 32767.00.
number-to-i16
@/number-to-i16
Converts number to a 16-bit signed integer presented as 2 bytes. An input for the the conversion should be between -32768.00 and 32767.00.
B0byte
Least significant byte
B1byte
Most significant byte
node {
void evaluate(Context ctx) {
int16_t input = getValue<input_IN>(ctx);
uint8_t b1 = input >> 8;
uint8_t b0 = input;
emitValue<output_B0>(ctx, b0);
emitValue<output_B1>(ctx, b1);
}
}
IN | B1 | B0 |
32767.00 | 7Fh | FFh |
-32768.00 | 80h | 00h |
00h | 0.00 |
-1.00 | FFh |