Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help pls!!!

Status
Not open for further replies.

josak

Newbie level 1
Joined
Sep 21, 2010
Messages
0
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,280
Location
chennai
Activity points
1,280
can any one give me the assembly level program for controlling the servo motor!!!!!:roll:
 

use 89s52, connect servo at p1.0. tested with hitech servo motors


$NOMOD51
$INCLUDE (89S52.MCU)

;(c) elabz.in
; free8051projects.blogspot.com

LED EQU P2.0

SERVO1 EQU P1.0
;SERVO2 EQU P2.2


ORG 0H
JMP MAIN

ORG 0BH
JMP TIMERZERO

ORG 30H
MAIN:
CALL INIT
AGAIN:
CLR LED
CALL ZEROD

CALL DELAY
SETB LED
CALL NINED
; CALL DELAY
; CALL ONE8D
CALL DELAY
JMP AGAIN


ZEROD:
MOV R0,#15
AG1: MOV TH1,#0F8H;THVALUE ;0F8H
MOV TL1,#0CDH;TLVALUE ;0CDH
SETB TR1
SETB SERVO1
; CLR LED
;CLR SERVO2
JNB TF1,$
CLR TR1
CLR TF1;
MOV TH1,#0C7H
MOV TL1,#0FFH
SETB TR1
CLR SERVO1
; SETB LED
;SETB SERVO2
JNB TF1,$
CLR TR1
CLR TF1
DJNZ R0,AG1
;CLR SERVO2
RET
NINED:
MOV R0,#15
AN1: MOV TH1,#0FAH;THVALUE ;0FBH
MOV TL1,#09AH;TLVALUE ;09AH
SETB TR1
SETB SERVO1
; SETB UDSERVO
JNB TF1,$
CLR TR1
CLR TF1
MOV TH1,#0B7H
MOV TL1,#0FFH
SETB TR1
CLR SERVO1
; CLR UDSERVO
JNB TF1,$
CLR TR1
CLR TF1
DJNZ R0,AN1

RET

ONE8D:
MOV R1,#30
AG2:
MOV TH1,#0FEH ;0FCH
MOV TL1,#047H ;067H
SETB TR1
SETB SERVO1
; CLR LED
;CLR SERVO2
JNB TF1,$
CLR TR1
CLR TF1
MOV TH1,#0C7H
MOV TL1,#0FFH
SETB TR1
CLR SERVO1
; SETB LED
;SETB SERVO2
JNB TF1,$
CLR TR1
CLR TF1
DJNZ R1,AG2
;CLR SERVO2
RET
INIT:

SETB LED
SETB ET0
; SETB EA
CLR TF1
MOV TH0,#0B7H
MOV TL0,#0FEH
MOV TMOD,#11H
; SETB TR0
RET

DELAY:
MOV R7,#2D
L2: MOV R6,#100D
L1:
CALL DEL
DJNZ R6,L1
DJNZ R7,L2
RET

DEL:
CLR CPRL2
CLR CT2
MOV TL2,#7CH
MOV TH2,#0FCH
SETB TR2
JNB TF2,$
CLR TR2
CLR TF2
RET;
TIMERZERO:
CLR TR0
CLR TF0
MOV TH0,#0B7H
MOV TL0,#0FEH
;CALL DELAY
;CPL LED1
SETB TR0

RETI
END
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top