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

📄 adc10int.asm

📁 sypress psoc express 驱动led发光的应用程序.
💻 ASM
字号:
;;*****************************************************************************
;;*****************************************************************************
;;  ADC10INT.asm
;;  Version: 1.0, Updated on 2005/08/19 at 11:13:41
;;  Generated by PSoC Designer ???
;;
;;  DESCRIPTION: ADC10 User Module ISR implementation file for the
;;               21xxx PSoC family of devices.
;;*****************************************************************************
;;*****************************************************************************

include "m8c.inc"
include "memory.inc"
include "ADC10.inc"

export _ADC10_ADC_ISR
export _ADC10_CNT_ISR

export  ADC10_bTempMSB
export _ADC10_iResult
export  ADC10_iResult
export _ADC10_bfStatus
export  ADC10_bfStatus

AREA InterruptRAM (RAM, REL)
   ADC10_bTempMSB:      BLK   1
  _ADC10_iResult:
   ADC10_iResult:       BLK   2  ;A/D value
  _ADC10_bfStatus:
   ADC10_bfStatus:      BLK   1  ;Data Valid Flag
AREA UserModules (ROM, REL)

_ADC10_ADC_ISR:
; ISR ,including jmptable takes 156 cpu cycles.)
   tst  reg[ADC10_CNTClrIntReg],ADC10_CNTMask
   jz NoPendingInterrupt;  Make sure counter has been serviced
   inc  [ADC10_bTempMSB]
   and  reg[ADC10_CNTClrIntReg],~(ADC10_CNTMask)
NoPendingInterrupt:
   push A
   tst  reg[ADC10_ADC_CR],80h
   jz   .InRange

; Read Counter
.OverRange:
   mov  [ADC10_iResult],ffh
   mov  [ADC10_iResult + 1],ffh
   jmp  .Done

.InRange:
   mov  [ADC10_iResult],[ADC10_bTempMSB]
   mov  A,reg[ADC10_CNT_DR0]
   mov  A,reg[ADC10_CNT_DR2]   ;A contains next prev value
   cpl  A
   mov  [ADC10_iResult+1],A
.Done:
   and  reg[ADC10_CNT_CR0], ~ADC10_ON 
   mov  reg[ADC10_CNT_DR1], 0xFF
   or   reg[ADC10_CNT_CR0], ADC10_ON

   mov  [ADC10_bfStatus],01h
   mov  [ADC10_bTempMSB], 00h

   ;@PSoC_UserCode_BODY_1@ (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.
         push   X

         ; If in large memory model, must make sure that the
         ; Index and current page registers are save and restored
         ; since the ADCScan function changes them.
         IF (SYSTEM_LARGE_MEMORY_MODEL)
            REG_PRESERVE IDX_PP
            REG_PRESERVE CUR_PP
         ENDIF
         
         mov    A,[ADC10_iResult]    ; Save MSB in A
         and    A,03h                ; Largest result is 3FFh
         mov    X,[ADC10_iResult+1]  ; Save LSB in X
         
         RAM_RESTORE_NATIVE_PAGING
         lcall   AdcScan
         RAM_CHANGE_PAGE_MODE( 0x00 )
         IF (SYSTEM_LARGE_MEMORY_MODEL)
            REG_RESTORE CUR_PP
            REG_RESTORE IDX_PP
         ENDIF
         pop    X
   ;---------------------------------------------------
   ; Insert your custom code above this banner
   ;---------------------------------------------------
   ;@PSoC_UserCode_END@ (Do not change this line.)

   pop A
   reti

_ADC10_CNT_ISR:
   inc [ADC10_bTempMSB]

   ;@PSoC_UserCode_BODY_2@ (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

⌨️ 快捷键说明

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