Code Examples
D-7C2xLP Migration Guidelines
D.4 Code Examples
D.4.1 Boot Code for C28x operating mode initalization
Note: The following code fragment must be placed in your code just after
reset. This code will place the device in the proper operating mode to execute
C2xLP converted code:
Code Explanation
SETC OBJMODE ;C28OBJ = 1 enable 28x object mode
CLRC PAGE0 ;PAGE0 = 0 not relevant for 28x mode,
;cleared to zero
SETC AMODE ;AMODE = 1 enable C2xLP compatible
;addressing mode
SETC SXM ;SXM = 1 for C2xLP at reset, SXM = 0
;for 28x at reset
SETC C ;Carry bit =1 for C2xLP at reset,
;Carry bit = 0 for 28x at reset
SPM 0 ;Set product shift mode zero, that
is PM bits = 001 compatible to
;C2xLP PM reset;mode
D.4.2 IER/IFR Code
Table D−1. Code to Save Contents Of IMR (IER) And Disabling Lower Priority Interrupts At
Beginning Of ISR
C2xLP C28x
INTx: .
MAR *,AR1
LDP #0
LACL IMR
SACL *+
AND #~INT_MASK
SACL IMR
.
.
INTx: .
AND IER,#~INT_MASK
.
Note: C28x saves IER as part of auto-
matic context save operation and dis-
ables the current interrupt automati-
cally to prevent recursive interrupts.
Table D−2. Code to Disable an Interrupt
C2xLP C28x
SETC INTM
LDP #0
LACL IMR
AND #~INTx
SACL IMR
CLRC INTM
AND IER,#~INTx
;operation is atomic and
;will not be interrupted.