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

📄 interruption.c

📁 Ultrasonor captor with Microchip dsPIC33F
💻 C
字号:
////////////////////////////////////////////////////////////////
//                     interruption.c                         //
////////////////////////////////////////////////////////////////

//Include fichiers Microchip
#include "p30f4011.h"
#include "timer.h"
#include "adc10.h"

//Include fichiers du projet
#include "constantes.h"
#include "variables_globales.h"
#include "prototypes.h"

void __attribute__((__interrupt__,auto_psv)) _ADCInterrupt(void)
{
	unsigned char temp;
	
	IFS0bits.ADIF = 0;		//Clear du flag

	LATDbits.LATD2 = !LATDbits.LATD2;

	//Calcul SBPA
	temp = (reg&0x100)>>8 ^ (reg&0x400)>>10;
	reg = reg << 1;
	reg = reg | temp&1;
	
	PINs = temp;
	
	if((idx >= idx_adc_deb) && (idx >= idx_adc_fin))
	{
		echentillonnage[idx_ech++] = (char)((ReadADC10(0))>>2);
		if(idx_ech > NB_MAX_ECHANTILLONS) 
		{
			idx_ech = 0;
			fin_ech=1;
		}
	}
	idx++;
}

⌨️ 快捷键说明

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