sorry, look like i din state clearly..
so many question, which to answer 1st ?
k, servo motor, as i know. a servo motor is a close loop system.
when u send a square wave, it will compare to actual position.
the diff then been amplified use to drive the motor. normal range of servo betwen 0.5ms to 2.5ms +-.. let say u input a 2ms square wave, and the motor is now on 1ms. then the diff will be amplified and start drive the motor. so the motor will move from 1ms and increasing. when move to 2ms, there is no diff and motor will stop. unless the servo is been hacked, then i not sure how..
refer this:
https://en.wikipedia.org/wiki/Servo_motor
https://www.societyofrobots.com/actuators_servos.shtml
2, PWM
am i mention i use matlab, not mplab, sorry for the typing error.
this is part of program:
LIST p=16f877a
include<p16f877a.inc>
org 0x00
__config 0x3f3a
start
call initial
movlw 0x02
movwf CCPR1L
main
movlw 00h
movwf PORTC
goto $
initial
bsf STATUS, 5
movlw 00h
movwf TRISC
bcf STATUS, 5
movlw 0x0c
movwf CCP1CON
bsf STATUS, 5
movlw 0x06
movwf PR2
BCF STATUS,5
movlw 0x07
movwf T2CON
clrf CCPR1L
return
end
if use mplab simultor, the RC2 is chancing 1-0 repeatly.
when i program it to chips and use oscillascope on RC2..
it show always high..
another question i gonna attach some drawing but fail.
now sleepy, here now is 3am..i want sleep. tomorrow try make a reply.
ty ikalogic