| ??? 04/17/10 11:07 Read: times |
#175099 - Servo motor PWM on AT89S52 |
Hi,
I currently have a servo with rated specification 0.6ms to 2.2ms for 0 to 180 deg @ 20ms. Now this is the PWM code (servopwm.txt) I wrote for a 45 degree angle; but the servo motor always goes to a random angle ~ 150 deg (and keeps vibrating there). I am using an AT89S52.
ORG 000H
START: SJMP START1
ORG 050H
START1:
BACK:
ACALL _45DEG
SJMP BACK
_45DEG: SETB P1.0
MOV R2, #22 ;22 cycles for 1ms
_ABC1: NOP
NOP
DJNZ R2, _ABC1
CLR P1.0
ACALL DELAY_20MS
RET
DELAY_20MS: MOV R0,#4607 ;4607 cycles for 20 ms
_ABCD: NOP
NOP
DJNZ R0, _ABCD
RET
Kindly let me know what the error could be. I am using an external 4.91V power supply. Also, how can I control multiple servos on Port 1? (I have to individually control 8 servos) Thanks in advance |
| Topic | Author | Date |
| Servo motor PWM on AT89S52 | 01/01/70 00:00 | |
| Search function? | 01/01/70 00:00 | |
| Thanks, but what about the code? | 01/01/70 00:00 | |
| Ask yourself this | 01/01/70 00:00 | |
to debug the code | 01/01/70 00:00 |



