⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ecanregdoublerw.asm

📁 自己编写的几个小程序,大家看看,希望能对大家有帮助.
💻 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 + -