What does #high(434) actually mean I know it is some value but how do you compute the value when I debug the command mov r7,#high(434) I get 1 in register 7 why ?
1 Answer
You mention 8051, which is a 8 bit machine. 8 bits can directly express values from -128 to +127 when signed, and 0 to 255 when unsigned.
Sometimes you want to use multiple bytes to store numbers outside this range. However, the machine still only works on one byte at a time. The #high (and presumably #low) functions give you the individual byte values of a 16 bit number.
In your example, you are working with the number 434. That is 1B2 in hexadecimal. To store that in two bytes, the high byte is set to 1, and the low byte to B2h (= 178 decimal). The #high function returns the high byte value, so 1.
As another example, consider #high(22135). 22135 = 5677h. The high byte value is 56h = 86, and the low byte 77h = 119. #high(22135) would therefore return 86.