putvector.dsp

来自「本程序为ad的dsp21990控制芯片程序,其功能是通过传统的PI控制算法来实现」· DSP 代码 · 共 25 行

DSP
25
字号
/*  PUT Interrupt Vector  Subroutine
    INPUTS:     MR0 = desired vector
              	I4  = address where desired vector will go
				DMPG2 must be equal to zero
			    destroyed registers: ar, af, ax0, ay0, SR, PX */


.section/pm	seg_pmcode;
.global PUT_VECTOR;

PUT_VECTOR:    // dis int;            		// disable interrupts
                ar = I4;
				ar = mr0 - ar;				// calculate offset for jump instruction
				sr=LSHIFT ar BY 2 (LO);  	// SR0 contains 14 bits in [15:2] and SR1 contains 2 MSBs of vector in [1:0]
                ax0 = sr1;
				sr = LSHIFT sr0 by 10 (LO);	// SR0 contains 4 bits in [15:12], SR1 contains 10 Bits of vector in [9:0], ax0 contains 2MSBs
                ay0= 0x1C00;				// opcode bits for PC relative jump
				af = sr1 or ay0;    		// af contains upper 16 bits of instruction word
				sr = LSHIFT sr0 by -8 (LO); // sr0 contains 4 bits in [7:4] 
				ar = sr0 or ax0;
				PX=ar;						// Now PX contains 8 LSBs of instruction word
				ar = pass af;
                PM(I4,M4)=ar;        		// replaces instruction at I4
               // ena int; 					// enable interrupts
                RTS;

⌨️ 快捷键说明

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