Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[Moved] A problem : pic16f877a with servo motor

Status
Not open for further replies.

Ibrahim El Ayas

Newbie level 2
Joined
Sep 23, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Mansoura - Egypt
Activity points
1,292
Alsalamo Alykom

hi

i want to make a servo motor rotates by an angle
the PWM code is

Code:
while (1)
{
          portc.f0=1;

         delay_us(2000);

          portc.f0=0;
        delay_us(18000);

}

you must change these values to gain an angle

i want to know for 1 degree how much Hi period does it take ...

Thank you ...
 

enjunear

Advanced Member level 3
Joined
Dec 21, 2010
Messages
960
Helped
309
Reputation
618
Reaction score
303
Trophy points
1,343
Location
USA, midwest
Activity points
9,749
Re: A problem : pic16f877a with servo motor

Look at the specs for your servo. The manufacturer should give you information regarding max/min pulse widths for max/min angles of rotation.
 

Ibrahim El Ayas

Newbie level 2
Joined
Sep 23, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Mansoura - Egypt
Activity points
1,292
thanks enjunear for your help :)

but my problem is that the delay function did not work .. i am thinking about timers ...
 

cubanflyer

Full Member level 5
Joined
Jul 31, 2010
Messages
255
Helped
75
Reputation
152
Reaction score
71
Trophy points
1,308
Location
UK
Activity points
2,499
What you need to do is take the normal rotation of a servo which is 180 degree.

Now take the pulse width for the rotation which is normally 1ms. ( the 2 ends are 1ms and 2ms).

So from the 1ms position to move 1 degree the pulse needs to (1*(1/180))+1ms = 1.006ms approx (1006us).

These calcs are based on a normal RC servo.

HTH
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top