比较器怎么开始单次比较?或者开启100次转换(每次带一定间隔),CompA0ISR已经注册在startup_ccs.c中
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "driverlib/comp.h"
#include "driverlib/interrupt.h"
int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_1|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_COMP0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeComparator(GPIO_PORTC_BASE, GPIO_PIN_7);
GPIOPinTypeComparator(GPIO_PORTC_BASE, GPIO_PIN_6);
ComparatorConfigure(COMP_BASE,0,COMP_TRIG_NONE|COMP_INT_BOTH|COMP_OUTPUT_NORMAL);
ComparatorIntEnable(COMP_BASE,0);
IntMasterEnable();
while(1)
{
}
}
void CompA0ISR(void)
{
ComparatorIntClear(COMP_BASE,0);
}
