int1.c

来自「一个单片机实现DA转换程序,程序实现了一个温度控制的数摸转换,并添加了去抖动处理」· C语言 代码 · 共 52 行

C
52
字号
#include "iom16.h"
#include "ioavr.h"
#include "inavr.h"
#include "avr_macros.h"

#include "userdef.h"
#include "userfun.h"
#include "userram.h"
//#include "usertype.h"


#pragma vector=INT1_vect           //外部同步信号下降沿触发中断
__interrupt
void int1_isr(void)
{
   unsigned int i,n;
   n=855;                          //675us + 96*0.78125 + 3*0.78125 = 752.34375us
   for (i=0; i<n; i++);
   __no_operation();
   __no_operation();
   __no_operation();
   __no_operation();
   SY0_S0_T0_R0;

   n=3;                            //******************
   for (i=0; i<n; i++);            //   5 chips
   SY0_S0_T0_R1;                   //******************

   n=2523;                         //******************
   for (i=0; i<n; i++);            //
   __no_operation();               //
   __no_operation();               //  2209.375us
   __no_operation();               //
   __no_operation();               //
   SY0_S0_T0_R0;                   //******************

   n=2;                            //******************
   for (i=0; i<n; i++);            //   4 chips
   __no_operation();               //
   SY1_S1_T1_R0;                   //******************

   TCNT1L = 0x00;
   TCNT1H = 0x00;
   TCCR1B = 0x01;                  //start Timer  65536/8000000=8ms
}

#pragma vector=TIMER1_OVF_vect
__interrupt
void timer1_ovf_isr(void)
{
}

⌨️ 快捷键说明

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