1. While configuring for analog comparator pin how to configure analog pin. I have used Pinmux utility to generate code. It generated code "GPIOPinConfigure(GPIO_PC7_C0-);" , byt code gives error that GPIO_PC7_C0- is not defined.
2. Page 1217, showed comp+ input pin has three pins: +ve input,+ve input (alternate),reference input.
What is +ve input (alternate) here. is it same as +ve input?
3. While using comparator, is it necessary to put to it output also? I dont want to consume external pin, just want to generate interrupt.
4. Below is my code, is below sequence is correct for configuring it.
void comp0_isr(void)
{
/* clear comparator int */
ComparatorIntClear(COMP_BASE , 0U);
/* toggle led */
RED_LED_INVERT();
}
void configure_uart(void)
{
uint32_t ready_count;
/* enable comp0 */
SysCtlPeripheralDisable(SYSCTL_PERIPH_COMP0);
SysCtlPeripheralReset(SYSCTL_PERIPH_COMP0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_COMP0);
ready_count = 2000U;
while( (!(SysCtlPeripheralReady(SYSCTL_PERIPH_COMP0))) && (--ready_count));
if(0U == ready_count) /* if periph not ready take action */
{
}
/* configure pins co- */
SysCtlGPIOAHBEnable(SYSCTL_PERIPH_GPIOC);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
ready_count = 2000U;
while( (!(SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOC))) && (--ready_count));
if(0U == ready_count) /* if periph not ready take action */
{
}
// GPIOPinConfigure(GPIO_PC7_C0-);
GPIOPinTypeComparator(GPIO_PORTC_AHB_BASE, GPIO_PIN_7);
/* disable comparator int */
ComparatorIntDisable(COMP_BASE , 0U);
ComparatorIntClear(COMP_BASE , 0U);
/* set ref & configure comparator */
ComparatorRefSet(COMP_BASE , COMP_REF_2_371875V);
ComparatorConfigure(COMP_BASE , 0U , COMP_TRIG_NONE | COMP_INT_RISE | COMP_ASRCP_REF | COMP_OUTPUT_NORMAL);
/* wait for 10us delay as mentioned in datasheet after configuring comprator */
wait_delay_us(10U);
/* register & enable interrupt */
ComparatorIntRegister(COMP_BASE , 0U , comp0_isr);
ComparatorIntEnable(COMP_BASE , 0U);
while(1);
}