Specifications
Program Examples
B-26
;==============================================================================
* File name : REM_REQ.asm *
* Description : PROGRAM TO TRANSMIT A REMOTE FRAME REQUEST IN THE CAN OF 240x *
* The two CAN modules must be connected to each other with appropriate *
* termination resistors. Transmission of a remote frame by MBX3 and reception *
* of the data frame in MBX0. To be used along with REM_ANS.asm *
* PERIPHERAL CODE : A, TEST CODE : 0 After successful completion of *
* this program, the value A000 must be present in 3A0h (DM) *
* Error code:A001 –– Error in initialization/ communication *
;==============================================================================
.title ”REM_REQ” ; Title
.include 240x.h ; Variable and register declaration
.include vector.h ; Vector label declaration
;–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
; Other constant definitions
;–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
DP_PF1 .set 0E0h ; Page 1 of peripheral file (7000h/80h
DP_CAN .set 0E2h ; Can Registers (7100h)
DP_CAN2 .set 0E4h ; Can RAM (7200h)
;–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
; M A C R O – Definitions
;–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
KICK_DOG .macro ; Watchdog reset macro
LDP #00E0h
SPLK #05555h, WDKEY
SPLK #0AAAAh, WDKEY
LDP #0h
.endm
;==============================================================================
; M A I N C O D E – starts here
;==============================================================================
.text
START: SETC INTM ; Disable interrupts
LDP #DP_PF1
SPLK #0010h,SCSR1 ; Enable clock to CAN module
SPLK 06Fh,WDCR ; Disable Watchdog
KICK_DOG
LDP #7h ; Write error code to start with
SPLK #0A001h,020h ; at 3A0h in B1 memory
LDP #225
SPLK #00C0H,MCRB ; Configure CAN pins
LAR AR0,#7204h ; AR0 => MBX0
LAR AR1,#300h ; AR1 => B0 RAM
LAR AR2,#3h ; AR2 => Counter
LAR AR3,#721ch ; AR3 => MBX3










