In this code, the value of the variable "adcval" does not change
But 1023 remains as you can see in the picture
There is definitely something missing in the code
Please Help
Thank you all
Code: Select all
#include "HC595.h"
unsigned adcval = 0;
void main (void)
{
DDRA.B0 = 0; /// channel 0 from adc port as input
DDRC.B0 = 1; /// output for display
DDRC.B1 = 1; /// output for display
DDRC.B2 = 1; /// output for display
PORTC.B0 = 0; /// output for display
PORTC.B1 = 0; /// output for display
PORTC.B2 = 0; /// output for display
adc_init ();
while (1)
{
adcval = adc_read (0);
Display_HC595 (adcval, 0);
}
}
[/img]
[/img]
[/img]