Hello!
I'm trying to make a single measure of ADC per 1 PWM pulse.
In fact, I use two chanel of ADC, and I need to make a single measure for each of them. But, I thick, it doesn't matter how much chanel I use.
On the picrure I showed the PWM. For ADC initialisation I use the chanel 1: time period - 2.5 ms; pulse width - 2450 ms.
The ADC has to be measured after rising edge once. The next measure is performed after next rising edge.
This is my code:
int main(void) { DDRB=(1<<PORTB7)|(1<<PORTB6); DDRE=(1<<PORTE5)|(1<<PORTE4); PWM_ini(); //Инициализация ШИМ UART0_Init(); //Инициализация порта на uART if (PORTE5>0) // PORTE5 is PWM chanel 1 { ADCInit(); //Инициализация АЦП } while(1) { } }
ADC, UART, PWM work, but not the way I want.
How to be sure, that ADC is measured correctry after rising adge?
And how to make the singe measure ADC, not a lot of time measures?
I'm sorry if the question is daft. I'm entry-level user