Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What is the length of unsigned int in an 8-bit microcontroller?
What is the length of unsigned int in an 8-bit microcontroller?

Writing programs in C has nothing to do with the number of microcontrollers in the microcontroller itself. You define an int data, and memory is allocated to it with two bytes. So int data are all 16 bits. The unsigned int data is an unsigned integer, and the highest bit does not represent a sign, so from 0000,0000,0000,0000B------1111,1111,1111,1111B. That is, from 0x0000----0xffff. If converted into decimal, it is 0---65535. If it is only int type data, the highest bit represents the sign bit, 0 is a positive number, and 1 is a negative number. At this time, this data represents from. 0x8000---0x7fff (note that the highest bit is the sign flag) after converting to decimal. -32768---+32767. You can refer to standard C language books for the length of other data. For example, a char type data is generally 8 bits. A long int type data is generally 32 bits. etc. These have nothing to do with the number of microcontrollers themselves.