0
\$\begingroup\$

I know the principles of servo motor and programming it, I already done it with FPGA and adjusted the PWM like I wanted. But with 8051 assembly, I can't do the PWM or generate the 20 ms for the motors. I can't do it with assembly.

\$\endgroup\$
  • \$\begingroup\$ Its a college thing, its a project related to the semester and I don't know how to do it although I have studied assembly but still don't understand how to do it \$\endgroup\$ – Amr Heil Jun 6 '18 at 0:55
  • \$\begingroup\$ The idea of this project is fine, but the question is "too broad" to fit a stack exchange site. Rules require that you actually make some effort. The 8051 has two timers; study them. Also do some web searches. A pure-code, execution-delay approach may also be possible. \$\endgroup\$ – Chris Stratton Jun 6 '18 at 1:18
  • \$\begingroup\$ omg I did I said before I already studied and wrote a code but it didn't work I don't know what is wrong in my code and why it wont work. here is the code: \$\endgroup\$ – Amr Heil Jun 6 '18 at 10:16
  • \$\begingroup\$ $INCLUDE(.\MOTOR2.h) $INCLUDE (AT89S52.inc) THERE: MOV R2,#10 THERE_2: MOV R3,#130 MAIN: MOV TMOD,#01H MOV TL0,#0CDH MOV TH0,#0FFH LOOP: SETB P2.1 SETB TR0 HERE: JNB TF0,HERE CLR TR0 CLR TF0 DJNZ R2,MAIN XXX: MOV R1,#190 MAIN_2: MOV TMOD,#01H MOV TL0,#0CDH MOV TH0,#0FFH LOOP2: CLR P2.1 SETB TR0 HERE_2: JNB TF0,HERE_2 CLR TR0 CLR TF0 DJNZ R1,MAIN_2 MOV A,R2 CJNE A,#14,YYY SJMP THERE YYY: INC R2 SJMP THERE_2 END \$\endgroup\$ – Amr Heil Jun 6 '18 at 10:16
  • 1
    \$\begingroup\$ That should be an edit to your question. And no one is going to look at it unless you put in some comments that explain how it is attempting to meet your goal, and specifically explain how it failed. \$\endgroup\$ – Chris Stratton Jun 6 '18 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.