📄 isr_adc12.s
字号:
;START_HEADER
;
; dsPIC30F6014 Demo Source File
; (c) Copyright 2005 Microchip Technology, All rights reserved
;
; --------------------------------------------------------------------------
; File Revision History:
; --------------------------------------------------------------------------
;
; $Log: isr_adc12.s,v $
; Revision 1.3 2005/04/04 23:44:09 VasukiH
; Updates to comments in file header
;
; Revision 1.2 2005/04/04 23:15:40 VasukiH
; Updates for MPLAB C30 v1.30 compatiblity
;
; Revision 1.1.1.1 2003/08/23 00:38:32 VasukiH
; First import of demo source into CVS Repository
;
;
;
; --------------------------------------------------------------------------
;
; Software and Development Tools Info:
; --------------------------------------------------------------------------
; Tool Version
; --------------------------------------------------------------------------
; MPLAB IDE 7.0
; MPLAB C30 Toolsuite 1.30
; dsPICDEM(TM) Processor Board 1.10
; --------------------------------------------------------------------------
;
; File Notes:
;
; 1. In this project the ADC is used twice - once to collect 256 samples
; on AN3 and the second time to collect 1 sample each from AN4, AN5, AN6
; and AN8.
; 2. In this ADC ISR, 256 samples are collected from AN3
;
;END_HEADER
.include "p30fxxxx.inc"
.include "common.inc"
.global ANxInputSignalPtr
.global ADCDataAvailable
.section .ndata, data, near
.align WORD
ADCDataAvailable: .hword 0x0000
ADCSamplesCount: .hword 0x0000
ANxInputSignalPtr: .hword ANxInputSignal
.global __ADCInterrupt
.section .text
__ADCInterrupt:
push.d w0 ;Save w0, w1 onto stack
mov #ADCBUF0, w0
mov ANxInputSignalPtr, w1 ;Set up pointer to the input buffer
repeat #15 ;Copy 16 conversion results from
mov [w0++], [w1++] ;ADCBUFx to the Input buffer
mov w1, ANxInputSignalPtr ;Update the Input buffer pointer
mov ADCSamplesCount, w0 ;Update the counter that reflects
add w0, #16, w0 ;the number of ADC samples converted
mov #FFT_SIZE, w1 ;Have "FFT_SIZE" number of samples
cp w0, w1 ;been collected? If so then jump to
bra z, exit2_ADC_Int ;special exit else simply clear the
mov w0, ADCSamplesCount ;A/D Interrupt flag and exit
exit1_ADC_Int:
bclr IFS0, #ADIF
pop.d w0 ;Restore w0, w1
retfie ;Return from interrupt
exit2_ADC_Int:
setm ADCDataAvailable ;Set the flag indicating FFT_SIZE number
;of ADC data samples are available
clr ADCSamplesCount ;Reset the Sample counter to 0
mov #ANxInputSignal, w0 ;Reset the input buffer pointer to the
;beginning
btsc FilterType, #1 ;If no digital filtering is chosen set
mov #FilteredOutput, w0 ;the input buffer pointer to point to
mov w0, ANxInputSignalPtr ;the filter-output buffer
bclr IFS0, #ADIF ;Clear the A/D Interrupt flag
pop.d w0 ;Restore w0, w1
retfie ;Return from Interrupt
.end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -