Home > Back-end >  51 single-chip microcomputer and define a global variable int type, assign any value, the result is
51 single-chip microcomputer and define a global variable int type, assign any value, the result is

Time:03-07

51 single-chip microcomputer and define a global variable int type, assign any value, the result is 4541, is this why? The code is as follows:
Int num1.
U8 buffer_ [4].
Void main (void)
{
Num1=23;
While (1)
{
Buffer_ [0]=num1 & gt;> 16.
Buffer_ [1]=num1 & gt;> 8;
Buffer_ [2]=num1;
Buffer_ [3]=judge_digits (num1);//statistics num1 digits
U2_send_bytes (buffer_, 4);//use a serial port to send buffer_
}
}
Serial debugging assistant num1 is received 11 bd (decimal is 4541), calculated num1 digits is 4 (no problem) in 4541, the statistical figures function, is whatever value for num1 fu, is the result, don't know where is wrong? Give advice or comments please!