SETHIGH16  v, data
Purpose To assign the upper 16-bit of a signed 32-bit integer variable v to data. The lower 16-bit of v is unaffected. This can be used to construct the value of a 32-bit integer data using two 16-bit data obtained from either the EEPROM or the DM[n].
Examples A = DM[2]
SETHIGH16 A,DM[1]

Note1: If you are constructing the value of a 32-bit variable from two 16-bit data, then SETHIGH16 should be executed only after the lower 16-bit has been assigned to the 32-bit variable, as shown in the above example. If you were to execute A = DM[2] after the SETHIGH16 A, DM[1] statement, the SETHIGH16 operation  would have been lost since the assignment statement itself overwrites all previous operation  (including SETHIGH16) on variable A.

Note2: All variables in TRiLOGI are signed, so the upper 16 bits will determine the sign of the resulting variable, which is A in the above example. If DM[1] is negative, then A will be negative, otherwise A will be positive. DM[2] can be positive or negative, but it won't have any effect on the resulting sign of A since it resides in the lower 16 bits of A.

See Also GETHIGH16( )

backbutton.gif (507 bytes)  Basic to TBASIC Reference Manual