I need to run 2 stepper motor for my project. I am using Atmega328P and L293d to do so.
I used to AVR446 to run the motor and its works fine for 1st motor. I geenrate interupt using TIMER1_COMPA_vect. and its work fine
as both the motor needs to be run at different speed, so i think to use TIMER1_COMPB_vect for Motor 2.
But on digging datasheet i have found ". In CTC mode the counter is cleared to zero when the counter value (TCNT1)
matches either the OCR1A (WGM13:0 = 4) or the ICR1(WGM13:0 = 12)"
TCNT1 become zero once it matches with OCR1A, so my question is
1) How i can use the TIMER1_COMPB_vect in CTC mode, I feel it should be clear once its match with the bigger OCR1x counter
and if not soo, what is the use of TIMER1_COMPB_vect.
2) How i can use single timer to run two motors at different speed. in which mode ??
Code attached.. I didnt run the TIMER1_COMPB_vect yet but code added