📄 interrupts.asm
字号:
#include "Talkthrough.h"
/*****************************************************************************
Function: Sport0_RX_ISR
Description: This ISR is executed after a complete frame of input data
has been received. The new samples are stored in
Channel0LeftIn, Channel0RightIn respectively. Then the function
Process_Data is called in which user code can be executed.
After that the processed values are copied from the
variables Channel0LeftOut, Channel0RightOut into the dma
transmit buffer.
******************************************************************************/
//--------------------------------------------------------------------------//
// Global variables //
//--------------------------------------------------------------------------//
.extern _iChannel0LeftIn;
.extern _iChannel0RightIn;
.extern _iChannel0LeftOut;
.extern _iChannel0RightOut;
.extern _rx_buf;
.extern _tx_buf;
// in file Process_data.asm
.extern _Process_Data;
.section program;
_SPORT0_RX_ISR:
[--SP] = i1;
[--SP] = rets;
[--SP] = astat;
[--SP] = lc0;
[--SP] = lt0;
[--SP] = lb0;
[--SP] = ( R7:0, P5:0 );
// Confirm interrupt
// Clear DMA_DONE bit in DMA1 status register
P0.L = LO(DMA3_IRQ_STATUS);
P0.H = HI(DMA3_IRQ_STATUS);
R1.L = W[ P0 ];
BITSET(R1,0);
W[ P0 ] = R1.L;
// copy input data from dma input buffer into variables
P1.L = _rx_buf;
P1.H = _rx_buf;
P0.H = _iChannel0LeftIn;
P0.L = _iChannel0LeftIn;
R0 = [ P1 + INTERNAL_ADC_L0 ];
[ P0 ] = R0;
P0.H = _iChannel0RightIn;
P0.L = _iChannel0RightIn;
R0 = [ P1 + INTERNAL_ADC_R0 ];
[ P0 ] = R0;
// call function that contains user code
call _Process_Data;
// copy processed data from variables into dma output buffer
P1.L = _tx_buf;
P1.H = _tx_buf;
P0.H = _iChannel0LeftOut;
P0.L = _iChannel0LeftOut;
R0 = [ P0 ];
[ P1 + INTERNAL_DAC_L0 ] = R0;
P0.H = _iChannel0RightOut;
P0.L = _iChannel0RightOut;
R0 = [ P0 ];
[ P1 + INTERNAL_DAC_R0 ] = R0;
( R7:0, P5:0 ) = [SP++];
lb0 = [SP++];
lt0 = [SP++];
lc0 = [SP++];
astat = [SP++];
rets = [SP++];
i1 = [SP++];
_SPORT0_RX_ISR.end:
.global _SPORT0_RX_ISR;
RTI;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -