微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > MCU和DSP > TMS320F206中断技术及其实现

TMS320F206中断技术及其实现

时间:06-27 来源:互联网 点击:


中断INT2/3服务程序(intp2)如下:

Intp2 setc intm ;进入INT2,INT3中断服务程序。
…… ;根据控制字判断是进入频率
测试子程序还是进入相位测试
子程序
bond intp23,tc
b intp21
intp23: in 60h,0fffech ;读控制字ICR
bit 60h,13
sst #1h,62h
bit 62h,4 ;判断是INT2还是INT3
bcnd intp22,tc 中断
b intp31
intp22: splk #0002h,60h ;INT2服务程序
out 60h,0ffech ;开INT3中断
splk #0c29h,63h
out 63h,0fff8h ;启动定时器
splk #0002h,ifr ;清INT2/INT3的标志位
clrc intm ;开中断
ret
intp31: setc intm ;INT3服务程序
splk #0412h,64h
out 64h,0fff8h ;停止定时器
splk #0002h,ifr ;清INT2/INT3的标志位
clrc intm
ret
in 65h,0fffah ;读定时器的时间
…… ;计算相位
intp21: setc intm ;判断中断次数,第一次开
…… ;定时器,第二次关定时器
bcnd stoptimerl,ntc
out 63h,0fff8h ;启动定时器
splk #0002h,ifr ;清除INT2/3标志
clrc intm ;开中断
ret
stoptimer1: splk #0412h,64h
out 64h,0fff8h ;关定时器
…… ;计算频率
b $ ;等待 定时器中断服务程序(timer)流程图如图6所示。


Timer: lacl 73h ;定时器中断服务程序
…… ;据控制字判断是进入频率测试子程序还是进入相位测试子程序。
Cmpr 0
Bcnd timer2,tc
b timer1
timer1: lacl 69h ;频率定时器服务子程序
add #1h
sacl 69h
splk #4h,ifr ;清除定时器标志
clrc intm
ret
timer2: lacl 69h ;相位定时器服务子程序
add #1h
sacl 69h
splk #4h,ifr ;清定时器的标志位
clrc intm
ret ;中断返回

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top