I am trying to control a hobby servo motor using two ATmega32 microcontrollers. I am using all the default configurations, with the internal default 1 MHz clock and TIMER2 to generate a fast PWM control signal for the servo. The corresponding UART pins TX and RX of both microcontrollers are connected on different breadboards, but are very close to each other. The servo is controlled using a potentiometer, whose amount of rotation also proportionately rotates the servo. The potentiometer is connected to the ADC0 pin. Baud rate is 9600 bps. The PWM output is from OC0A pin.
My problem is, whenever I turn the potentiometer, there is about 0.5 second delay in the servo rotation. So, if I keep on rotating the potentiometer from one direction to the other, the servo does not turn as smoothly as it should, and instead turns in 1 second intervals.
I tried the program on a single ATmega32, without the UART communication, and the servo reciprocated the movement of the potentiometer instantly.
So, why is it not doing through UART? Do I need to mess around with the fuse bits to increase the clock speed to 8 MHz? Or do I need to add an external crystal - something I am trying to avoid due to additional cost.
Please advice...
My problem is, whenever I turn the potentiometer, there is about 0.5 second delay in the servo rotation. So, if I keep on rotating the potentiometer from one direction to the other, the servo does not turn as smoothly as it should, and instead turns in 1 second intervals.
I tried the program on a single ATmega32, without the UART communication, and the servo reciprocated the movement of the potentiometer instantly.
So, why is it not doing through UART? Do I need to mess around with the fuse bits to increase the clock speed to 8 MHz? Or do I need to add an external crystal - something I am trying to avoid due to additional cost.
Please advice...