How to use the direct command to make EV3 motor backward?
The LC0() macro treats the value as a signed 6-bit integer.

From bytecodes.h...

#define PRIMPAR_CONST_SIGN 0x20
#define PRIMPAR_VALUE 0x3F


PRIMPAR_VALUE is where the 6 bits come from. PRIMPAR_CONST_SIGN means that the 6th bit is the sign. This means it has a range of -32 to 31, inclusive.

We must also keep in mind that computers use the 2's complement for negative integer values, so we can't just use 0x34 (0x20 | 0x14) and expect it to be -20.

0x20 will be -32, which is the lowest number possible. So, to get -20, we would need -32 + 12 = -20. In 6-bit hex 0x20 + 0x0c = 0x2c. But, you don't actually have to use hex formatted number. We can let the compiler figure it out like this: (-20 &amp; PRIMPAR_VALUE). This trims the number -20 down to 6 bits. In fact, this is what the LC0() macro does internally, so we can just write LC0(-20).

If you need values larger than this range (e.g. -100 to 100), then you need to use the LC1() macro, which uses 8-bit signed integers. It has a range of -128 to 127. So, this will work too: LC1(-20).