Hello Keil users,
I'm trying to display a ADC value on eval board. ( I already post a similar thread but this time is not the same).
The problem is that ADC displayed on board varies between 0 and 10. And I want it to vary between 0 and 1024.
Any idea ?
short AD_value = 0x00 void ADC_IRQ_Handler(void) { ADC->CR &= 0xFFFE; /* Clear STR bit (Start Conversion) */ ADC->CR &= 0x7FFF; /* Clear End of Conversion flag */ VIC0->VAR = 0; /* Acknowledge Interrupt */ VIC1->VAR = 0; AD_value = ADC->DR0 & 0x03FF; /* AD value for global usage (10 bit) */ ADConversation = TRUE; /* Signal, that AD-conversion has finished */ }
And the called function is
ADConversation = FALSE; ADC->CR |= 0x0403; /* Set STR bit (Start Conversion) */ while(!ADConversation) {} /* Wait until AD-conversation has finished */ lcd_init(); lcd_clear(); set_cursor(0,0); sprintf(text1,"Analog Value %5d",AD_value); lcd_print(text1);
ADConversation is a bool.
Thanks in advance. Adel