English
Language : 

MC9S12XD256MAL Datasheet, PDF (291/1348 Pages) Freescale Semiconductor, Inc – Freescale’s Scalable Controller Area Network
6.9 Initialization and Application Information
Chapter 6 XGATE (S12XGATEV2)
6.9.1 Initialization
The recommended initialization of the XGATE is as follows:
1. Clear the XGE bit to suppress any incoming service requests.
2. Make sure that no thread is running on the XGATE. This can be done in several ways:
a) Poll the XGCHID register until it reads $00. Also poll XGDBG and XGSWEIF to make sure
that the XGATE has not been stopped.
b) Enter Debug Mode by setting the XGDBG bit. Clear the XGCHID register. Clear the XGDBG
bit.
The recommended method is a).
3. Set the XGVBR register to the lowest address of the XGATE vector space.
4. Clear all Channel ID flags.
5. Copy XGATE vectors and code into the RAM.
6. Initialize the S12X_INT module.
7. Enable the XGATE by setting the XGE bit.
The following code example implements the XGATE initialization sequence.
6.9.2 Code Example (Transmit "Hello World!" on SCI)
SCI_REGS
SCIBDH
SCIBDL
SCICR2
SCISR1
SCIDRL
TIE
TE
RE
SCI_VEC
CPU S12X
;###########################################
;#
SYMBOLS
#
;###########################################
EQU $00C8
;SCI register space
EQU SCI_REGS+$00 ;SCI Baud Rate Register
EQU SCI_REGS+$00 ;SCI Baud Rate Register
EQU SCI_REGS+$03 ;SCI Control Register 2
EQU SCI_REGS+$04 ;SCI Status Register 1
EQU SCI_REGS+$07 ;SCI Control Register 2
EQU $80
;TIE bit mask
EQU $08
;TE bit mask
EQU $04
;RE bit mask
EQU $D6
;SCI vector number
INT_REGS
INT_CFADDR
INT_CFDATA
RQST
EQU
EQU INT_REGS+$07
EQU INT_REGS+$08
EQU $80
$0120
;S12X_INT register space
;Interrupt Configuration Address Register
;Interrupt Configuration Data Registers
;RQST bit mask
XGATE_REGS
XGMCTL
XGMCTL_CLEAR
XGMCTL_ENABLE
XGCHID
XGVBR
XGIF
EQU $0380
;XGATE register space
EQU XGATE_REGS+$00 ;XGATE Module Control Register
EQU $FA02
;Clear all XGMCTL bits
EQU $8282
;Enable XGATE
EQU XGATE_REGS+$02 ;XGATE Channel ID Register
EQU XGATE_REGS+$06 ;XGATE ISP Select Register
EQU XGATE_REGS+$08 ;XGATE Interrupt Flag Vector
MC9S12XDP512 Data Sheet, Rev. 2.21
Freescale Semiconductor
291