Hello, please help me write the code, the teacher gave the assignment, but after a long time searching for information on the Internet and trying to understand, I could not do anything. I don't need to flash anything, I just need the code to match the task.
Assignment: Create a schematic diagram and annotated C ++ program for an Atmel AVR ATmega16 8-bit microcontroller that implements the following algorithm:
1) MCU is clocked from the built-in generator, the clock frequency is 4 MHz.
2) The 10 kΩ potentiometer is connected to the ADC input (ADC3), operating in 8-bit mode, powered by the microcontroller voltage Vcc (5 V).
3) When the timer T0 interrupts with the same time period, the ADC conversion result is read and displayed on a strip of 8 LEDs connected to the C ports (time period 0.2 seconds).
4) When the button is pressed once (connected to PD3), the last measured value in the USART is displayed at 9600 baud without parity.
That is, the number of LEDs illuminated depends on the voltage, the higher the voltage, the more LEDs light up, if the voltage is 0, then the LEDs are off, if 5 - all the LEDs are on. It should look like an equalizer.
I made a diagram (I will attach it below), it seems to be correct, but I don’t know how to write the code, please help (preferably with comments).
A small clarification, maybe this is important, I am writing a project "GCC C ++ Executable Project" in Atmel studio.
Thanks