/*
* main.c
*/
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <driverlib/sysctl.h>
#include <driverlib/gpio.h>
#include <driverlib/adc.h>
#include <inc/hw_adc.h>
#include <inc/hw_sysctl.h>
#include "inc/hw_memmap.h"
#include "driverlib/interrupt.h"
#include <inc/hw_ints.h>
uint32_t adc_value;
void ADC3_Hanlder(void)
{
ADCIntClear(ADC0_BASE,3);
ADCSequenceDataGet(ADC0_BASE, 3, &adc_value);
}
int main(void) {
SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ); //配置系统时钟
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); //使能adc0
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); //使能gpio E
ADCClockConfigSet(ADC0_BASE,ADC_CLOCK_SRC_PLL|ADC_CLOCK_RATE_FULL,8); //配置ADC时钟
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3); //配置引脚adc功能
ADCSequenceConfigure(ADC0_BASE,3,ADC_TRIGGER_ALWAYS,0); //序列设置,选择序列3 ,始终触发,优先级0
ADCSequenceStepConfigure(ADC0_BASE, 3, 0,ADC_CTL_END | ADC_CTL_CH0); //采样通道0
ADCSequenceEnable(ADC0_BASE, 3); //序列3使能
ADCIntClear(ADC0_BASE,3); // 清除序列3中断
// ADCIntEnable(ADC0_BASE,3); // 序列3 中断使能
ADCIntRegister(ADC0_BASE,3,ADC3_Hanlder); // 注册序列3中断 函数
ADCIntEnable(ADC0_BASE,3); // 开启adc中断
IntMasterEnable(); //开启总中断
while(1)
{
}
}
我想每次ADC0触发的时候都能进入中断,但是一次都进不去, 试了好久了 , 实在想不出来哪儿还有问题了, 希望大家帮帮我。谢谢呢
