⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intp.c~

📁 使用avr--cc2420模块程序,需要原理图的联系 QQ:120304948
💻 C~
字号:
#include <mega128.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "typedef.h"

#include "app.h"

#include "rtc.h"
#include "serialdrv.h"
#include "timer.h"
#include "intp.h"

bit int_start = 0;
unsigned int int_data[STUDY_NO];
unsigned int int_data1[STUDY_NO];
unsigned int int_data2[STUDY_NO];
unsigned char int_num = 0;

void INTP_init(void)
{
// External Interrupt(s) initialization
// INT0: On
// INT0 Mode: Rising Edge
// INT1: Off
// INT2: On
// INT2 Mode: Falling Edge
// INT3: On
// INT3 Mode: Rising Edge
// INT4: Off
// INT5: Off
// INT6: Off
// INT7: Off
    EICRA=0xE3;
    EICRB=0x00;
    EIMSK=0x0D;     //0x0D  //0x01
    EIFR=0x0D;
}

// External Interrupt 2 service routine
interrupt [EXT_INT2] void ext_int2_isr(void)
{
// Place your code here

    if (int_start)
    {
//    	OCR3CL=0x30;    //0x30
        int_data[int_num++] = TCNT1;
    }
    else
    {
//    	OCR3CL=0x30;    //0x30
        TCNT1 = 0;
        int_start = 1;
        int_num = 0;
		timer_set_sp();
        wdr();
	    memset(int_data, 0x00, STUDY_NO);
    }
}

// External Interrupt 3 service routine
interrupt [EXT_INT3] void ext_int3_isr(void)
{
// Place your code here

    if (int_start)
    {
//    	OCR3CL=0x00;    //0x30  //0x00
        int_data[int_num++] = TCNT1;
    }
}

⌨️ 快捷键说明

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