
It deals with the communication of my ESP8266 with a PLC. From the PLC the value of an integer type variable is taken, which is 16 bits. The reading on the serial monitor was ok, until I wanted to display negative numbers. Wanting to check the number of bits, I rigidly typed -1 into the variable and after displaying it in binary form, I noticed that the variable of type INT has 32 bits. This is a big problem for me because when I have a -1 on the PLC, the microcontroller reads it as 65535.
I tried to declare the variable as int16_t, but the effect is the same. I am using the Settimino.h library to connect to the PLC, it is covered there:
Code: C / C++
What is the problem? I know that the ESP8266 is 32-bit, but I need, to have a 16-bit variable