📄 dualadcint.asm
字号:
;;*****************************************************************************
;;*****************************************************************************
;; FILENAME: DUALADCINT.asm
;; Version: 2.1, Updated on 2003/11/18 at 15:00:17
;; Generated by PSoC Designer ver 4.1 b931 : 21 January, 2004
;;
;; DESCRIPTION: DualADC Interrupt Service Routines.
;;
;;-----------------------------------------------------------------------------
;; Copyright (c) Cypress MicroSystems 2001-2003. All Rights Reserved.
;;*****************************************************************************
;;*****************************************************************************
include "m8c.inc"
include "DUALADC.inc"
;-----------------------------------------------
; Global Symbols
;-----------------------------------------------
export _DUALADC_CNT1_ISR
export _DUALADC_CNT2_ISR
export _DUALADC_PWM16_ISR
export DUALADC_cCounter1U
export DUALADC_cCounter2U
export _DUALADC_iResult1
export DUALADC_iResult1
export _DUALADC_iResult2
export DUALADC_iResult2
export _DUALADC_bfStatus
export DUALADC_bfStatus
export DUALADC_bSampC
;-----------------------------------------------
; Variable Allocation
;-----------------------------------------------
AREA bss(RAM)
DUALADC_cCounter1U: BLK 1 ;The Upper byte of the Counter
DUALADC_cCounter2U: BLK 1 ;The Upper byte of the Counter
_DUALADC_iResult1:
DUALADC_iResult1: BLK 2 ;A/D value
_DUALADC_iResult2:
DUALADC_iResult2: BLK 2 ;A/D value
_DUALADC_bfStatus:
DUALADC_bfStatus: BLK 1 ;Data Valid Flag
DUALADC_bSampC: BLK 1 ;# of times to run A/D
;@PSoC_UserCode_INIT@ (Do not change this line.)
;---------------------------------------------------
; Insert your custom declarations below this banner
;---------------------------------------------------
;------------------------
; Constant Definitions
;------------------------
;------------------------
; Variable Allocation
;------------------------
;---------------------------------------------------
; Insert your custom declarations above this banner
;---------------------------------------------------
;@PSoC_UserCode_END@ (Do not change this line.)
;-----------------------------------------------
; EQUATES and TABLES
;-----------------------------------------------
; Constant Definitions
LowByte: equ 1
HighByte: equ 0
AREA UserModules (ROM, REL)
.LITERAL
DUALADCMaxNegX4Table:
; Bits 7 8 9 10 11 12 13
DB FFh, FEh, FCh, F8h, F0h, E0h, C0h
DUALADCMaxPosX4Table:
IF (DUALADC_DATA_FORMAT)
; Bits (signed) 7 8 9 10 11 12 13
DB 01h, 02h, 04h, 08h, 10h, 20h, 40h
ELSE
; Bits (unsigned) 7 8 9 10 11 12 13
DB 02h, 04h, 08h, 10h, 20h, 40h, 80h
ENDIF
.ENDLITERAL
;-----------------------------------------------------------------------------
; FUNCTION NAME: _DUALADC_CNT1_ISR (Counter8 Interrupt)
;
;
; DESCRIPTION:
; Increment the upper (software) half on the counter whenever the
; lower (hardware) half of the counter underflows. This counter
; should start out at the most negative value (0xFF).
;
;-----------------------------------------------------------------------------
;
_DUALADC_CNT1_ISR:
inc [DUALADC_cCounter1U]
;@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.
;---------------------------------------------------
; Insert your custom code above this banner
;---------------------------------------------------
;@PSoC_UserCode_END@ (Do not change this line.)
reti
;-----------------------------------------------------------------------------
; FUNCTION NAME: _DUALADC_CNT2_ISR (Counter8 Interrupt)
;
;
; DESCRIPTION:
; Increment the upper (software) half on the counter whenever the
; lower (hardware) half of the counter underflows. This counter
; should start out at the most negative value (0xFF).
;
;-----------------------------------------------------------------------------
;
_DUALADC_CNT2_ISR:
inc [DUALADC_cCounter2U]
;@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
;-----------------------------------------------------------------------------
; FUNCTION NAME: _DUALADC_PWM16_ISR (PWM16 Interrupt)
;
; DESCRIPTION:
; This ISR is called when the ADC has completed and integrate cycle.
; The ADC value is calculated and stored in a global location before
; the end of the ISR.
;
;-----------------------------------------------------------------------------
;
_DUALADC_PWM16_ISR:
and reg[DUALADC_bCounter1_CR0], ~DUALADC_fDBLK_ENABLE ; Disable Counter
and reg[DUALADC_bCounter2_CR0], ~DUALADC_fDBLK_ENABLE ; Disable Counter
IF DUALADC_NoAZ
or reg[DUALADC_bfADC1cr2], DUALADC_fAutoZero ; Put Integrator in AutoZero
or reg[DUALADC_bfADC2cr2], DUALADC_fAutoZero ; Put Integrator in AutoZero
ENDIF
or reg[DUALADC_bfADC1cr3],DUALADC_fFSW0 ; Put Integrator in reset
or reg[DUALADC_bfADC2cr3],DUALADC_fFSW0 ; Put Integrator in reset
; Enable interrupts for a short period of time just in case.
; Make sure we didn't have a counter interrupt ready to fire
M8C_EnableGInt
nop ; Wait a couple cycles
M8C_DisableGInt ; Disable interrupt, read to complete processing
push A ; Save the Accumulator
; Get ADC1 result
mov A,reg[DUALADC_bCount1] ; Read counter value (Bogus read puts value in Period register)
mov A,reg[DUALADC_bCompare1] ; Read counter value
dec A ; Decrement by one to make sure we didn't miss a count
cpl A ; Invert the value
jnc DUALADC_INT_CALCV1 ; if carry, then inc MSB as well
inc [DUALADC_cCounter1U]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -