Go to Post With one post, Mr. Miller joins the top 0.7% of Chief Delphi, reputation-wise. I think the community supports him. - Taylor [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 22-08-2007, 13:52
3dude_2231's Avatar
3dude_2231 3dude_2231 is offline
no one messes with a Thingy =|
AKA: Menscher,Ran Menscher =]
FRC #2231 (Onyxtronix)
Team Role: Leadership
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Shoham, Israel
Posts: 233
3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough
Send a message via MSN to 3dude_2231
servo PWM sampling-what Fosc should I use?

Hi.

my goal is to sample a servo pulse from an R/C receiver,
and I'm not sure what XTAL to use,
I mean, what is the minimum Fosc I should use?

if a 4MHz = 1MHz internal clock,
so with a 1:1 prescaler I should get 1 sample every 1 mS.
if I'm correct, a servo's pulse is between 0.9mS and 2.1 mS,
meaning I need something quicker, am I correct?

will a 20MHz XTAL be the answer?

thanks,
Ran.
__________________
Redefining the word "Rookie". (for 2 years now..)


Israeli Off Season Games: WINNERS!
check out this cool project I'm into..

  #2   Spotlight this post!  
Unread 22-08-2007, 14:51
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: servo PWM sampling-what Fosc should I use?

Quote:
Originally Posted by 3dude_2231 View Post
if a 4MHz = 1MHz internal clock,
so with a 1:1 prescaler I should get 1 sample every 1 mS.
if I'm correct, a servo's pulse is between 0.9mS and 2.1 mS,
meaning I need something quicker, am I correct?
You've got the right idea, but the wrong numbers.

First correction: a standard hobby servo signal has a pulse width that varies from 1 to 2 milliseconds. If you want to measure that range with eight bits of precision, you'll need a resolution of 256 counts per millisecond.

Second correction: with the clock running at 1MHz, each cycle is one microsecond. That's almost four times as fast as the task requires. If the processor you're using can measure pulses using the raw clock speed, you'll be fine with a 4MHz crystal.

(If you're indeed using a different servo standard with only a 200 microsecond range from end to end, a 1MHz clock will still give you more than 7 bits of resolution.)
  #3   Spotlight this post!  
Unread 22-08-2007, 15:11
3dude_2231's Avatar
3dude_2231 3dude_2231 is offline
no one messes with a Thingy =|
AKA: Menscher,Ran Menscher =]
FRC #2231 (Onyxtronix)
Team Role: Leadership
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Shoham, Israel
Posts: 233
3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough
Send a message via MSN to 3dude_2231
Re: servo PWM sampling-what Fosc should I use?

thank you very much!

__________________
Redefining the word "Rookie". (for 2 years now..)


Israeli Off Season Games: WINNERS!
check out this cool project I'm into..

  #4   Spotlight this post!  
Unread 22-08-2007, 16:20
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: servo PWM sampling-what Fosc should I use?

Depending on what processor you are using, you might be able to convince the hardware to do it for you, rather than polling it. This will let you run it with a different sample frequency AND lets you do other stuff while you are waiting.

On the PIC, I think it is called the "Input Compare" or "Input Capture Compare".

In any case, you are right in assuming that the resolution you can get is directly related to your crystal frequency.

What processor are you using?
  #5   Spotlight this post!  
Unread 22-08-2007, 16:41
3dude_2231's Avatar
3dude_2231 3dude_2231 is offline
no one messes with a Thingy =|
AKA: Menscher,Ran Menscher =]
FRC #2231 (Onyxtronix)
Team Role: Leadership
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Shoham, Israel
Posts: 233
3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough
Send a message via MSN to 3dude_2231
Re: servo PWM sampling-what Fosc should I use?

I'm using the PIC 16f690,
using the capture mode, I'm able to get the pulse's width

but, Alan Anderson really solved the problem for me

thanks anyway
__________________
Redefining the word "Rookie". (for 2 years now..)


Israeli Off Season Games: WINNERS!
check out this cool project I'm into..

  #6   Spotlight this post!  
Unread 22-08-2007, 22:51
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: servo PWM sampling-what Fosc should I use?

3dude__2231 .... what exaclty are you building anyways?!

</raging curiosity>

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #7   Spotlight this post!  
Unread 23-08-2007, 13:17
3dude_2231's Avatar
3dude_2231 3dude_2231 is offline
no one messes with a Thingy =|
AKA: Menscher,Ran Menscher =]
FRC #2231 (Onyxtronix)
Team Role: Leadership
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Shoham, Israel
Posts: 233
3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough
Send a message via MSN to 3dude_2231
Re: servo PWM sampling-what Fosc should I use?

actually, nothing too fancy.
(still working on the schematics, as the plan changes everyday).

but the main idea is this:
I'm transmitting to an R/C receiver,
that receiver puts out PWM signals (X and Y axis).
one PIC16f690 reads the X axis data,
sending the motors reverse bits directly to the motor driver.
and the forward bits to the second PIC16f690, that reads the Y data,
and decides whether to send "1" and "0", 2 "1"s, or 2 "0"s.

that's it

</hoping to satisfy curiosity>

Ran.
__________________
Redefining the word "Rookie". (for 2 years now..)


Israeli Off Season Games: WINNERS!
check out this cool project I'm into..

Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
What program should I use for website design? radioshackkid Website Design/Showcase 35 03-02-2007 22:12
Trying to use a new servo team1500 Electrical 1 20-02-2006 21:27
What size breaker should I use for the RC? Excelsior Electrical 4 18-01-2006 07:34
Did you use Auto Servo Mode? Greg Marra Programming 8 27-04-2005 15:35
What Motors Should I Use? dddriveman Motors 20 16-07-2003 21:19


All times are GMT -5. The time now is 10:10.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi