as I can make a servo motor 90 sg move to the angle I want?
Yes, with a PWM by changing its compare value (duty cycle).
Attached some useful servo design and operation info.
Note servos can even be modified into servo motor operation
where the angle can exceed 360 degrees.
A driver for the motor (named H-Bridge)
A gear to reduce the motor speed to something practical like 0.2s for a complete revolution
A device that captures toe actual position of the motor, usually a potentiometer, but could be a shaft encoder, too.
A controlling device like a PSoC Pioneer board.
There are complete servos containing the first three items in one housing on the market used for hobby modells which have got a defined interface like a 1 to 2 ms pulse input.
You can get those comparably cheap and connect your pioneer controller directly to the inputs of the servo. Easiest and fastest solution.
One caution when using a servo, they use a lot of current and create
a lot of noise on power supply line. So bypassing critical and board
layout. Attached some ap notes on this subject.
/* Style Definitions */
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";
http://www.cypress.com/?rID=39677 AN57821 - PSoC® 3, PSoC 4, and PSoC 5LP Mixed Signal Circuit Board Layout Considerations
http://www.cypress.com/?rID=40247 AN58827 - PSoC® 3 and PSoC 5LP Internal Analog Routing Considerations
change the duty cycle but still turning servo if stop, I can not understand is that the references speak me time in ms and psoc me speaks of 0-255.
Yes a PWM has two key values for servo work, their period or frequency,
and their duty cycle control. The PWM has an input clock, and that divided
by period value ( 0 - 255 for 8 bit PWM) creates the period of the output
waveform. The high and low times are set by the compare value. So for example
if clock was 10 KHz, period value was 100, compare value was 20, then the
PWM output would be 100 Hz ( 10 mS ), and the duty cycle would be 20% , the waveform
high time 2 mS, low time 8 mS.
Keep in mind if you wanted wireless control of the PWM Cypress
has a new bluetooth offering that would make that pretty simple.
ohh you now if I went dana are excellent, thanks
the problem was that had put a 12 MHz clock
Note clock frequency controls the resolution of the angle step
in the PWM, so you would raise it, and compare and period values,
to increse the resolution.
To control pulse width you would use software API is shown in data sheet
to control the compare value, hence pulse width.
void PWM_WriteCompare(uint8/16 compare)
Description: Writes the compare values for the compare output when the PWM Mode parameter is set toDither mode, Center Aligned mode, or One Output mode.Parameters: uint8/16: Compare valueReturn Value: NoneSide Effects: Using the PWM_WriteCompare() API when the PWM is running will cause the comparison touse the new compare value immediately and that result will propagate to the output terminalon the next clock. A change in the PWM output also triggers deadband logic if DeadbandMode is enabled.
Typical servo ranges from - 60 degrees (1 mS) to + 60 degrees (2 mS).
Overall period 20 mS or 50 Hertz.
If you want to use a 8 bit pwm then consider a clock of 5 Khz, then period
value of PWM would be 100, which corresponds to a resolution of 200 uS.
So compare value would range from 1mS / .2 mS = 5 to 2mS / .2 mS = 10.
Then the range of 120 degrees / 5 steps in compare value = 24 degrees/step.
If you want more resolution then use 16 bit PWM, multiply all PWM values by 100,
and you would get .24 degrees/step of compare value. Clock would then be 500 Khz.
Note there is an intrinsic limiting resolution set by servo, that you cannot effectively
exceed, so check its datasheet.