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

📄 dmx512rxint.asm

📁 高亮度LED驱动程序 C51 由原厂提供
💻 ASM
字号:
;;*****************************************************************************
;;*****************************************************************************
;;  FILENAME: `@INSTANCE_NAME`INT.asm
;;  Version: 1.0, Updated on 2007/05/29 at 14:57:46
;;  `@PSOC_VERSION`
;;
;;  DESCRIPTION:  DMX512Rx Interrupt Service Routine's.
;;-----------------------------------------------------------------------------
;;  Copyright (c) Cypress Semiconductor 2007. All Rights Reserved.
;;*****************************************************************************
;;*****************************************************************************

include "m8c.inc"
include "memory.inc"
include "`@INSTANCE_NAME`.inc"


export _`@INSTANCE_NAME`_RX_ISR
export _`@INSTANCE_NAME`_PWD_ISR
export  `@INSTANCE_NAME`_CurntSlotID
export  `@INSTANCE_NAME`_pUserBuffer
export  `@INSTANCE_NAME`_StartSlotID
export  `@INSTANCE_NAME`_NumOfSlots
export  `@INSTANCE_NAME`_bBusActivity
export  `@INSTANCE_NAME`_bSlotActivity

AREA InterruptRAM(RAM,REL,CON)

`@INSTANCE_NAME`_CurntSlotID:    blk   2
`@INSTANCE_NAME`_pUserBuffer:    blk   2
`@INSTANCE_NAME`_StartSlotID:    blk   2
`@INSTANCE_NAME`_NumOfSlots:     blk   1
`@INSTANCE_NAME`_bBusActivity:   blk   1
`@INSTANCE_NAME`_bSlotActivity:  blk   1

;@PSoC_UserCode_INIT@ (Do not change this line.)
;---------------------------------------------------
; Insert your custom declarations below this banner
;---------------------------------------------------

;------------------------
; Includes
;------------------------

;------------------------
;  Constant Definitions
;------------------------

;------------------------
; Variable Allocation
;------------------------

;---------------------------------------------------
; Insert your custom declarations above this banner
;---------------------------------------------------
;@PSoC_UserCode_END@ (Do not change this line.)

AREA UserModules (ROM, REL)

;-----------------------------------------------------------------------------
;  FUNCTION NAME: _`@INSTANCE_NAME`_RX_ISR
;  DESCRIPTION: DMX512 Data recieving routine
;-----------------------------------------------------------------------------
_`@INSTANCE_NAME`_RX_ISR:
   push  A
   mov   A, reg[`@INSTANCE_NAME`_RX_CONTROL_REG]
   and   A, `@INSTANCE_NAME`_RX_OVERRUN_ERROR | `@INSTANCE_NAME`_RX_FRAMING_ERROR
   jz    .RXDataOK
   mov   reg[`@INSTANCE_NAME`_RX_CONTROL_REG], 0x00
   jmp   .EndISR

.RXDataOK:
   mov   A, [`@INSTANCE_NAME`_CurntSlotID + 1]
   sub   A, [`@INSTANCE_NAME`_StartSlotID + 1]
   push  A
   mov   A, [`@INSTANCE_NAME`_CurntSlotID + 0]
   sbb   A, 0
   sub   A, [`@INSTANCE_NAME`_StartSlotID + 0]
   jz    .ChkUpLimit
   mov   A, reg[`@INSTANCE_NAME`_RX_BUFFER_REG]
   pop   A
   jmp   .EndISR
   
.ChkUpLimit:
   pop   A
   push  A
   sub   A, [`@INSTANCE_NAME`_NumOfSlots]
   jc    .CaptureRXData
   mov   A,reg[`@INSTANCE_NAME`_RX_BUFFER_REG]
   pop   A
   jmp   .EndISR

.CaptureRXData:
   cmp   A, 0xFF
   jnz   .SkipSetSlotAct
   mov   [`@INSTANCE_NAME`_bSlotActivity], 1
   mov   reg[`@INSTANCE_NAME`_RX_CONTROL_REG], 0x00
   
.SkipSetSlotAct:
   pop   A
   push  X
   add   A, [`@INSTANCE_NAME`_pUserBuffer + 1]
   mov   X, A
IF ( SYSTEM_LARGE_MEMORY_MODEL )
   REG_PRESERVE IDX_PP
   RAM_PROLOGUE RAM_USE_CLASS_3
   mov   A, [`@INSTANCE_NAME`_pUserBuffer + 0]
   mov   reg[IDX_PP], A
ENDIF
   mov   A,reg[`@INSTANCE_NAME`_RX_BUFFER_REG]
   mov   [X], A
IF ( SYSTEM_LARGE_MEMORY_MODEL )
   REG_RESTORE   IDX_PP
ENDIF
   pop   X
   
.EndISR:
   inc   [`@INSTANCE_NAME`_CurntSlotID + 1]
   adc   [`@INSTANCE_NAME`_CurntSlotID + 0], 0x00
   pop   A

   ;@PSoC_UserCode_BODY@ (Do not change this line.)
   ;---------------------------------------------------
   ; Insert your custom code below this banner
   ;---------------------------------------------------
   ;   NOTE: interrupt service routines must preserve
   ;   the values of the A and X CPU registers.

   ;---------------------------------------------------
   ; Insert your custom code above this banner
   ;---------------------------------------------------
   ;@PSoC_UserCode_END@ (Do not change this line.)
   
   reti


;-----------------------------------------------------------------------------
;  FUNCTION NAME: _`@INSTANCE_NAME`_PWD_ISR
;  DESCRIPTION: DMX512 "Space For Break" detection handler
;-----------------------------------------------------------------------------
_`@INSTANCE_NAME`_PWD_ISR:
   mov   [`@INSTANCE_NAME`_CurntSlotID + 0], 0x00
   mov   [`@INSTANCE_NAME`_CurntSlotID + 1], 0x00
   mov   reg[`@RX_CONTROL_0`], 0x01
   mov   [`@INSTANCE_NAME`_bBusActivity], 1
   
   ;@PSoC_UserCode_BODY@ (Do not change this line.)
   ;---------------------------------------------------
   ; Insert your custom code below this banner
   ;---------------------------------------------------
   ;   NOTE: interrupt service routines must preserve
   ;   the values of the A and X CPU registers.

   ;---------------------------------------------------
   ; Insert your custom code above this banner
   ;---------------------------------------------------
   ;@PSoC_UserCode_END@ (Do not change this line.)
   
   reti


; end of file `@INSTANCE_NAME`INT.asm

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -