你在开发GZ32? 呵呵,我正在用GZ16,也是调试CAN,
这段代码也许有用,
;*****************************************************************************
; SETUP THE CAN MODULE
CBT: EQU $C749 ;%1100 0111 0100 1001 125kHz
;CBT: EQU $C349 ;%1100 0011 0100 1001 250kHz
LDA CMCR0 ;1 = MSCAN08 in soft reset state
LDA #$1
STA CMCR0 LACE CAN MODULE IN RESET
LDHX #CBT
STHX DATA0
STX CBTR1
LDA DATA0
STA CBTR0
CLRA
STA CTCR
LDA #$FF
STA CIDMR0
STA CIDMR1
STA CIDMR2
STA CIDMR3 ;SET UP MODULE TO RECEIVE ALL MESSAGES
CLRA
STA TXD00 ;STANARD ID (0 VALUE)
STA TXD01
STA TXD0D ;SET STATUS MESSAGE REGISTERS
LDA #$01
STA TXD0C ;SINGLE BYTE STATUS MESSAGE
LDA CMCR0
CLRA
STA CMCR0 ;TAKE CAN MODULE OUT OF RESET
LDA #%10000001
STA CRIER
LDA CMCR0
AND #%00010000
CANSYNCH:
BEQ * ;SYNCHRONIZE MODULE WITH CAN BUS
CLI |