定点DSP的准确计时

技术分类: 微处理器与DSP  | 2007-07-30
来源:电子工程世界 | 作者:南昌航空工业学院计算机系 叶水生 南昌航空工业学院测控系 周日贵

  4 DSP程序实现

  splk #0412h,64h

  out 64h,0fff8h ;停止DSP定时器

  in 65h,tim ;读tim寄存器的数值

  in 67h,tcr ;计算tcr中psc的值

  lacl 67h

  and #03c0h ;与03c0h获得psc的值

  sacl 67h ;左移10位

  lacc 67h,10

  sach 67h

  lacl #9

  sub 67h

  sacl 67h ;存psc中剩下的值(即使用了的)

  lacl #07cfh

  sub 65h

  sacl 68h ;存prd-tim的值

  lt 68h

  mpy #10 ;TDDR+1

  pac

  sacl 68h

  lacl 68h

  add 67h

  sacl 68h

  lt 68h ;*0.1

  lar ar1;#temptddr ;temptddr=0.1

  mar *,ar1

  mpy *

  pac

  add #1,14

  sach 68h,1

  lacl 68h

  sfr

  sacl 68h ;存定时器最后一次的时间单位为μs

  lt 69h

  lar ar2;#temptddr1 ;temptddr1=定时器的周期

  mar *,ar2

  mpy *

  pac

  add 68h ;加定时器最后一次的时间

  sacl 68h ;存定时器总的所耗时间(占时间的多数)

  lt 69h

  lar ar2,#temptddr2 ;temptddr2=0.5*32767

  mar *,ar2

  mpy * ;计算定时器中断服务程序执行时间

  pac

  add #1,14

  sach 67h,1

  lacl 68h

  add 67h ;加定时器中断服务程序执行时间

  sacl 68h ;存总的时间

0
0
(请您对文章做出评价)
1】【2
加载中

对文章的评论

更多评论

剩余字数:  

相关在线研讨会

我要参加

泰克串行数据网络分析

时间:2008-09-18 10:00:00-12:00:00
简介:泰克串行数据网络分析在线研讨会,为您提供通用、省时、经济的串行数据网络分析解决方案.

浏览该文章的用户还看过...

  • 文 章

  • 论 坛

  • 博 客

  • 小 组

设计资源与分销