sudarshann
Junior Member level 2
Hi
i need to control the speed of 2 dc motors with a joystick connected through pc
i have all the stuff working but i have the problem with pwm. i am using atmega16 as pwm source.
pwm values are updated as equivalents of joystick
below are my details of pwm intialization. Problem is when both OCR1AL and OCR1BL are 0% it stops
when both are 50% its in max speed . when both are in 100% it runs in some speed.
when both are in alternate one 100% and other 0% , 0% stops and 50% runs full speed . when the same is reversed bot runs at some speed. what could be the problem please help me.
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: 7.813 kHz
// Mode: Fast PWM top=0x00FF
// OC1A output: Inverted
// OC1B output: Non-Inv.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0xE1;
TCCR1B=0x0D;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
Thanks in advance
i need to control the speed of 2 dc motors with a joystick connected through pc
i have all the stuff working but i have the problem with pwm. i am using atmega16 as pwm source.
pwm values are updated as equivalents of joystick
below are my details of pwm intialization. Problem is when both OCR1AL and OCR1BL are 0% it stops
when both are 50% its in max speed . when both are in 100% it runs in some speed.
when both are in alternate one 100% and other 0% , 0% stops and 50% runs full speed . when the same is reversed bot runs at some speed. what could be the problem please help me.
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: 7.813 kHz
// Mode: Fast PWM top=0x00FF
// OC1A output: Inverted
// OC1B output: Non-Inv.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0xE1;
TCCR1B=0x0D;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
Thanks in advance