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
Have you verified the hardware?
What voltage range does the circuit show that the ADC input should have?
What voltage range have you measured on the ADC input?
What reading does the data sheet say that your ADC should return for such input voltages and with the voltage reference that your board is using?
I have already verified the volage with UART. In hexadecimal as maximal value I become 0b0000001111111111
That means no hardware problem. Any suggestions?