Maxim Integrated 19-4
MAX31782 User’s Guide
Revision 0; 8/11
19.3.4 Moving Values Between Registers of Different Sizes
Before covering some transfer scenarios that might arise, a special register must be introduced that will be used in
many of these cases. The 16-bit General Register (GR) is expressly provided for performing byte singulation of 16-bit
words. The high and low bytes of GR are individually accessible in the GRH and GRL registers respectively. A read-
only GRS register makes a byte-swapped version of GR accessible and the GRXL register provides a sign-extended
version of GRL.
8-bit destination ← low byte (16-bit source)
The simplest transfer possibility would be loading an 8-bit register with the low byte of a 16-bit register. This transfer
does not require use of GR and requires a prefix only if the destination or source register are outside of the single cycle
write or read regions, 0–7h and 0–Fh, respectively.
move OFFS,LC[0] ;copythelowbyteofLC[0]totheOFFSregister
move IMR,@DP[1] ;copythelowbyte@DP[1]totheIMRregister
move WDCN,LC[0] ;assemblesto: movePFX[2],#00h
; move(WDCON-80h),LC[0]
8-bit destination ← high byte (16-bit source)
If, however, we needed to load an 8-bit register with the high byte of a 16-bit source, it would be best to use the GR
register. Transferring the 16-bit source to the GR register adds a single cycle.
move GR,LC[0] ;moveLC[0]totheGRregister
move IC,GRH ;copythehighbyteintotheICregister
16-bit destination ← concatenation (8-bit source, 8-bit source)
Two 8-bit source registers can be concatenated and stored into a 16-bit destination by using the prefix register to hold
the high-order byte for the concatenated transfer. An additional cycle may be required if either source byte register
index is greater than 0Fh or the 16-bit destination is greater than 07h.
move PFX[0],IC ;loadhighordersourcebyteICintoPFX
move @++SP,AP ;store@DP[0]theconcatenationofIC:AP
;16-bitdestinationsub-index:dst=08h
;8-bitsourcesub-indexes:
;high=10h,low=11h
move PFX[1],#00h;
move PFX[3],high;PFX=00:high
move dst,low ;dst=high:low
Low (16-bit destination) ← 8-bit source
To modify only the low byte of a given 16-bit destination, the 16-bit register should be moved into the GR register such
that the high byte can be singulated and the low byte written exclusively. An additional cycle is required if the destina-
tion index is greater than 0Fh.
move GR,DP[0] ;moveDP[0]totheGRregister
move PFX[0],GRH ;getthehighbyteofDP[0]viaGRH
move DP[0],#20h ;storethenewDP[0]value
;16-bitdestinationsub-index:dst=10h
;8-bitsourcesub-index:src=11h
move PFX[1],#00h;
move GR,dst ;readdstwordtotheGRregister
move PFX[5],GRH ;getthehighbyteofdstviaGRH
move dst,src ;storethenewdstvalue
Comentários a estes Manuais