tinit0.c

来自「CHP 2 - Real-Time Digital Signal Process」· C语言 代码 · 共 37 行

C
37
字号
// 
//  Project: Experiment 2.10.3 DSP Timer - Chapter 2 
//  File name: c_tint0.c   
//  Function(s): c_tint0()        
//
//  Description: This timer ISR is the DSP timer interrupt service routine (ISR)
//
//  For the book "Real Time Digital Signal Processing: 
//                Implementation and Application, 2nd Ed"
//                By Sen M. Kuo, Bob H. Lee, and Wenshun Tian
//                Publisher: John Wiley and Sons, Ltd
//
//  Tools used: CCS v.2.12.07
//              TMS320VC5510 DSK Rev-C
//

#include "timer.h"

#pragma DATA_SECTION(time,       ".bss:example:timer0");
#pragma CODE_SECTION(c_tint0,    ".text:example:timer0");

C55xTimer time;              // Define timer variable

interrupt void c_tint0(void)
{      
  time.us += 10;             // Each interrupt is 10us  
  if (time.us == 1000)
  {
    time.us = 0;  
    if (time.ms++ == 1000)
    {
      time.ms = 0;
      time.s++;
    }
  }    
}

⌨️ 快捷键说明

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