![]() On the other hand, the short int type is guaranteed to occupy at least 2 bytes on any platform. That's a problem because it 's impossible to make 4 bytes fit into 2 bytes, isn't it?! Something we have to clear up first is that the int type on modern platforms is 4 bytes long. How do I convert an int to two bytes and two bytes to an int again using C/C++ ? Answer: I will also need to convert these two bytes to an integer value again. ![]() For this, I need to convert this int value to byte type, but since they are 10 bits if I convert to just one byte I will lose information, so I need to convert the int to two bytes so that I can transmit one byte at a time by serial port. ![]() I store the data in a variable of type int (32 bits), and I need to send this data via serial communication. I get data from a temperature sensor on a microcontroller that has a 10-bit AD converter. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |