PWM using timer 0 of ATmega16 Hi,
I tried the above suggestions of adding F_CPU before the delay.h header and increased the delay to 250 ms and noticed the same results. However, I noticed 2 very important...
Wednesday, 2 January 2013 - 18:16
PWM using timer 0 of ATmega16 Quote:Make sure the pwm pin (OCR0) is set to output.
I'm doing that already:
DDRB |= (1<<PB3);
Monday, 31 December 2012 - 18:56
PWM using timer 0 of ATmega16 Quote:And those 3 servos work as expected?
Yes they work fine...I'm having trouble driving the servos using timer0
Monday, 31 December 2012 - 10:29
PWM using timer 0 of ATmega16 Hi guys,
I know that with an 8-bit timer you get a lower resolution to drive the servo...but has anybody actually driven a servo using timer0 or timer2 as shown in the code above...
Monday, 31 December 2012 - 10:27
PWM using timer 0 of ATmega16 Although i have used a variable called brightness, I have modified the code originally used to dim an LED, to drive a servo as mentioned by the folks replying to this thread :)...
Thursday, 27 December 2012 - 17:41
PWM using timer 0 of ATmega16 Here is the entire program:
#include
#include
#define F_CPU 16000000L
//prototypes
void InitPWM(void);
void SetPWMOutput(uint8_t duty);
void Wait(void);
int main(void)
{...
Thursday, 27 December 2012 - 17:22
PWM using timer 0 of ATmega16 Quote:??? So are you using the code you posted above, or some other code with 15 and 31 only?
This is what I did, if you refer to the code I have pasted in my first post:...
Thursday, 27 December 2012 - 07:13
PWM using timer 0 of ATmega16 I tried the code above, but still I see the same issue. The servo moved from left and then it stayed stuck at some position and started twitching continuously. After some time the...
Wednesday, 26 December 2012 - 18:51
PWM using timer 0 of ATmega16 So that's what I'm doing right? I am varying the servo pulses between 1 ms and 2 ms as seen in the for loop in my above post.
Tuesday, 25 December 2012 - 18:42
PWM using timer 0 of ATmega16 So based on the above, I changed my code as follows:
for(brightness = 15; brightness...
Tuesday, 25 December 2012 - 17:55
PWM using timer 0 of ATmega16 Hi,
Timer resolution = Prescaler/Input frequency
= 1024/16 MHz
= 64 us
Since delay = 1 ms, the timer needs to count
1 ms/64 us = 15.625 timer...
Tuesday, 25 December 2012 - 17:50
PWM using timer 0 of ATmega16 Quote:You can use only range from OCR0=15 (1 ms) to OCR0=31 (2 ms)
Can you please explain how you arrived at these figures?
Thanks,
Sumair
Hi, I tried the above suggestions of adding F_CPU before the delay.h header and increased the delay to 250 ms and noticed the same results. However, I noticed 2 very important...
Quote:Make sure the pwm pin (OCR0) is set to output. I'm doing that already: DDRB |= (1<<PB3);
Quote:And those 3 servos work as expected? Yes they work fine...I'm having trouble driving the servos using timer0
Hi guys, I know that with an 8-bit timer you get a lower resolution to drive the servo...but has anybody actually driven a servo using timer0 or timer2 as shown in the code above...
Although i have used a variable called brightness, I have modified the code originally used to dim an LED, to drive a servo as mentioned by the folks replying to this thread :)...
Here is the entire program: #include #include #define F_CPU 16000000L //prototypes void InitPWM(void); void SetPWMOutput(uint8_t duty); void Wait(void); int main(void) {...
Quote:??? So are you using the code you posted above, or some other code with 15 and 31 only? This is what I did, if you refer to the code I have pasted in my first post:...
I tried the code above, but still I see the same issue. The servo moved from left and then it stayed stuck at some position and started twitching continuously. After some time the...
So that's what I'm doing right? I am varying the servo pulses between 1 ms and 2 ms as seen in the for loop in my above post.
So based on the above, I changed my code as follows: for(brightness = 15; brightness...
Hi, Timer resolution = Prescaler/Input frequency = 1024/16 MHz = 64 us Since delay = 1 ms, the timer needs to count 1 ms/64 us = 15.625 timer...
Quote:You can use only range from OCR0=15 (1 ms) to OCR0=31 (2 ms) Can you please explain how you arrived at these figures? Thanks, Sumair
Pages