@@ -62,8 +62,8 @@ int main(void)
6262
6363 //====DDR
6464
65- //PWM HS> (pin 9 in ArduinoUNO) OCR1A PB1
66- //PWM LS> (pin 10)
65+ //PWM HS> (pin 10 in ArduinoUNO) OCR1B PB2
66+ //PWM LS> (pin 9 in ArduinoUNO) OCR1A PB1
6767 DDRB |= 1 << PINB1 | 1 << PINB2 ;
6868 PORTB |= 1 << PINB2 ;
6969 //HS en PD 3,5,7 LS en PL 2,4,6
@@ -195,7 +195,7 @@ void Timer1_config(void){
195195 TCCR1B |= 1 << WGM12 | 1 << WGM13 ; //fast mode ICR1 = PWM period
196196 ICR1 = TIMER_PWM_PERIOD ;
197197 Current_PWM_DutyCycle = MIN_PWM_DUTYCYCLE ; // Initial Duty cycle
198- OCR1A = Current_PWM_DutyCycle ;
198+ OCR1B = Current_PWM_DutyCycle ;
199199 TCCR1A |= 1 << COM1A1 ; // clear at compare
200200 TIMSK1 |= 1 << TOIE1 ; // Timer1 overflow interrupt enabled
201201}
@@ -222,12 +222,12 @@ ISR(TIMER1_OVF_vect){
222222 //to prevent overflow
223223 if (Current_PWM_DutyCycle > (TIMER_PWM_PERIOD - 1 ))
224224 {
225- OCR1A = (TIMER_PWM_PERIOD - 1 );
225+ OCR1B = (TIMER_PWM_PERIOD - 1 );
226226
227227 }
228228 else
229229 {
230- OCR1A = Current_PWM_DutyCycle ;
230+ OCR1B = Current_PWM_DutyCycle ;
231231 }
232232
233233 PWM_Update_Counter = 0x0 ;
@@ -258,7 +258,7 @@ ISR(TIMER1_OVF_vect){
258258 }
259259
260260 // Update PWM duty cycle values
261- OCR1A = Current_PWM_DutyCycle ;
261+ OCR1B = Current_PWM_DutyCycle ;
262262 }
263263}
264264void Start_ADC_Conversation (void ){
0 commit comments