📄 lptx5pol.asm
字号:
* PROGRAM TO CHECK THE CAN OF 24x/240x DSP *
* LPTX5POL - Transmit loop using Mailbox 5 *
* MBX5 used for TRANSMISSION MBX0 used for RECEPTION *
* This program TRANSMITS data to another CAN module using MAILBOX5. *
* ECRX0POL program should be running on the remote CAN module. The *
* receiving CAN module, after receiving the data packets, will echo the *
* same data back to the transmitting module which then verifies the *
* Xmitted and Received data. The program terminates if there is an error*
* Else it loops forever. *
* COMMENTS :
; This program, in conjunction with ECRX0POL, provides a quick and easy way
; to determine if two 24x/240x DSPs are able to communicate via the CAN bus.
; This program does not use any interrupts and employs POLLING. Hence, it
; can be run anywhere in Program memory.
; This program employs message filtering.
.title "LPTX5POL" ; Title
.include "240x.h" ; Variable and register declaration
.include "vector.h" ; Vector table (takes care of dummy password)
.global START
;-------------------------------------------------------------------
; Other constant definitions
;-------------------------------------------------------------------
DP_PF1 .set 0E0h ; Page 1 of peripheral file (7000h/80h)E0
DP_CAN .set 0E2h ; CAN Registers (7100h)
DP_CAN2 .set 0E4h ; CAN RAM (7200h)
KICK_DOG .macro ; Watchdog reset macro
LDP #00E0h
SPLK #05555h, WDKEY
SPLK #0AAAAh, WDKEY
LDP #0h
.endm
.text
START: KICK_DOG
SPLK #0,60h
OUT 60h,WSGR ; Set waitstates for external memory (if used)
SETC INTM ; Disable interrupts
LDP #DP_PF1 ; Set PLL to x4 and enable clock to CAN module
SPLK #0010h,SCSR1 ; '240xA only - Comment out for '24x
SPLK 06Fh,WDCR ; Disable watchdog
LDP #MCRB>>7
LACL MCRB
;5432109876543210
AND #1111111110111111B
SACL MCRB
LDP #PCDATDIR>>7
LOOP1: LACL PCDATDIR
;5432109876543210
OR #0100000000000000B
AND #1111111110111111B
SACL PCDATDIR
CALL DELAY_SHORT
CALL DELAY_SHORT
CALL DELAY_SHORT
CALL DELAY_SHORT
CALL DELAY_SHORT
LACL PCDATDIR
OR #0000000001000000B
SACL PCDATDIR
CALL DELAY_SHORT
CALL DELAY_SHORT
CALL DELAY_SHORT
CALL DELAY_SHORT
CALL DELAY_SHORT
B LOOP1
DELAY_SHORT: ;20MHz DELAY 1uS
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
RET
GISR1:
GISR2:
GISR3:
GISR4:
GISR5:
GISR6:
PHANTOM: RET
.end
How filtering is achieved :
---------------------------
; Note: The CAN node in which this program is running is referred as "Xmitting" node
MSGID-MBX5: 0 1110 0001 0101 1101 1100 0011 0101 (Xmit MBX of Xmitting node)
MSGID-MBX0: 0 0111 0011 0101 1001 0100 0101 1001 (Rcv MBX of Receiving node)
LAM0: 0 1101 1010 0010 1100 1000 1110 1101 (LAM0 of Receiving node)
; Note that wherever there is a zero in the LAM, the bits of the transmitted
; MSGID and the MSGID of the Receive MBX are identical. The corresponding
; bits of transmit and receive MSGIDs could differ only if the corresponding
; LAM bit is a 1. The MSGID of the receive Mailbox is overwritten with the MSGID
; of the received message. Hence, filtering happens only for the first receive.
; Whenever the program on either node is terminated, the contents of memory
; location 300h should be the same (or +/- 1).
/* CANayzer config file: 50k80spRx.cfg */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -