📄 ecanregdoublerw.asm
字号:
;; C callable assembly function for performing a double-read or double-write:
; Retunrs read value in memory (pointed by XAR5)
.global _CanDoubleRead
_CanDoubleRead:
; XAR4 -> StorePtr
; XAR5 -> RegPtr
PUSH ST1 ; Save status register on stack
SETC INTM ; Disable interrupts
MOVL ACC,*XAR5 ; Read CAN Register
SBF _CanDoubleRead10,NEQ ; Test If Zero (Comment to disable second-read)
MOVL ACC,*XAR5 ; If Zero, Read Again (Comment to disable second-read)
_CanDoubleRead10:
MOVL *XAR4,ACC ; Store value
POP ST1 ; Restore status register
LRETR
.global _CanDoubleWrite
_CanDoubleWrite:
; XAR4 -> RegPtr
; XAR5 -> LoadPtr
PUSH ST1 ; Save status register on stack
SETC INTM ; Disable interrupts
MOVL ACC,*XAR5 ; Load ACC with value to write
MOVL *XAR4,ACC ; Store value in register twice
NOP ; Writes to the MBR by the CAN module takes 4 cycles.
NOP ; The 4 NOPs are needed to ensure that the consecutive
NOP ; writes do not fall within this 4-cycle period.
NOP
MOVL *XAR4,ACC ; Store value in register twice (Comment to disable second-write)
POP ST1 ; Restore status register
LRETR
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -