FAHIM REAZA
Newbie level 3
- Joined
- Jan 26, 2013
- Messages
- 4
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- Dhaka, Bangladesh.
- Activity points
- 1,319
Dear,
I have a problem to interfacing DGS05NF STD servo motor with ATmega32. I want to move "Robotic Claw - MKII" using "DGS05NF STD servo motor" with ATmega32. I have complete a program for this purpose. But there is a problem. My program execute in PROTEUS correctly. In practical , the motor rotate in 0 to 180 degree , only one when i power in. Here i used while loop, but it don't repeat the action. Actually it does not follow my instruction.
Anybody can help me ??? Please.................
Here is the link of the motor and claw.......
Servo : https://www.sparkfun.com/products/10333
Claw : https://www.sparkfun.com/products/11524
Here is my code :
In my code, i want , while i pressed a switch, then the servo rotate a direction (until i pressed the switch). Similarly while i pressed another switch, the the servo rotate opposite direction.
I have a problem to interfacing DGS05NF STD servo motor with ATmega32. I want to move "Robotic Claw - MKII" using "DGS05NF STD servo motor" with ATmega32. I have complete a program for this purpose. But there is a problem. My program execute in PROTEUS correctly. In practical , the motor rotate in 0 to 180 degree , only one when i power in. Here i used while loop, but it don't repeat the action. Actually it does not follow my instruction.
Anybody can help me ??? Please.................
Here is the link of the motor and claw.......
Servo : https://www.sparkfun.com/products/10333
Claw : https://www.sparkfun.com/products/11524
Here is my code :
In my code, i want , while i pressed a switch, then the servo rotate a direction (until i pressed the switch). Similarly while i pressed another switch, the the servo rotate opposite direction.
Code dot - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 #include<avr/io.h> #include<util/delay.h> #include<stdio.h> #include<avr/interrupt.h> int main(void); void init_timer0(void); int main(void) { DDRD &= (~((1 << DDD0)|(1 << DDD1))); // Pins as input (push buttun for survo directon) DDRD |= (1 << DDD4) | (1 << DDD5); //PWM Pins as Output init_timer1(); // Initialize timer1 while(1) { if(PIND & ((1 << PORTD0))) // If switch_1 pressed { OCR1A = OCR1A+10 ; //increase duty cycle _delay_ms(10); } if(PIND & ((1 << PORTD1))) // If switch_2 pressed { OCR1A = OCR1A-10 ; //decease duty cycle _delay_ms(10); } }//while(1) ends here return 0; } void init_timer1(void) { //Configure TIMER1 TCCR1A|=(1<<COM1A1)|(1<<COM1B1)|(1<<WGM11); // NON Inverted PWM TCCR1B|=(1<<WGM13)|(1<<WGM12)|(1<<CS11)|(1<<CS10); //PRESCALER=64 MODE 14(FAST PWM) ICR1=4999; //fPWM=50Hz (Period = 20ms Standard). }
Last edited by a moderator: