Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

motor program

Status
Not open for further replies.

pootr33_maloo

New Member
hi,

anybody know program for motor(2 direction) especially with AT89C2051,i use it for line follower robot. thank for your replies :lol:
 
yes , i know .

this is my code which I write for controlling DC motor .
This code is written in Assembler ,you can complie it by software reads51
This code make robot follow the white line .I use 2 sensors to make robot
detect the while line.

this is my code

; ------------- READS51 generated header --------------
; module : E:\CHUONGTRINHROBOT\ROBOT\chuongtrinh1.asm
; created : 01:39:19, Sunday, November 21, 2004
; -----------------------------------------------------
; ------------- READS51 generated header --------------
; module : E:\CHUONGTRINHROBOT\chuongtrinh1\Chuongtrinh1.asm
; created : 04:53:35, Wednesday, November 17, 2004
; -----------------------------------------------------
; --- 8051 registers ---
ACC data 0xE0
B data 0xF0
DPH data 0x83
DPL data 0x82
IE data 0xA8
IP data 0xB8
P0 data 0x80
P1 data 0x90
P2 data 0xA0
P3 data 0xB0
PCON data 0x87
PSW data 0xD0
SBUF data 0x99
SCON data 0x98
SP data 0x81
TCON data 0x88
TH0 data 0x8C
TH1 data 0x8D
TL0 data 0x8A
TL1 data 0x8B
TMOD data 0x89

; --- 8051 register bit fields ---
; IE
EA bit 0xAF
ES bit 0xAC
ET1 bit 0xAB
EX1 bit 0xAA
ET0 bit 0xA9
EX0 bit 0xA8
; IP
PS bit 0xBC
PT1 bit 0xBB
PX1 bit 0xBA
PT0 bit 0xB9
PX0 bit 0xB8
; P3
RD bit 0xB7
WR bit 0xB6
T1 bit 0xB5
T0 bit 0xB4
INT1 bit 0xB3
INT0 bit 0xB2
TXD bit 0xB1
RXD bit 0xB0
; PSW
CY bit 0xD7
AC bit 0xD6
F0 bit 0xD5
RS1 bit 0xD4
RS0 bit 0xD3
OV bit 0xD2
P bit 0xD0
; TCON
TF1 bit 0x8F
TR1 bit 0x8E
TF0 bit 0x8D
TR0 bit 0x8C
IE1 bit 0x8B
IT1 bit 0x8A
IE0 bit 0x89
IT0 bit 0x88
; SCON
SM0 bit 0x9F
SM1 bit 0x9E
SM2 bit 0x9D
REN bit 0x9C
TB8 bit 0x9B
RB8 bit 0x9A
TI bit 0x99
RI bit 0x98

; P0.1 left sensor
;P0.0 right sensor
;P1.0, P1.1 right motor
;P1.2 ,P1.3 left motor

ORG 0000H
MOV P0,#0FFH
MOV P1,#0FFH

QUAY:
CLR P1.0
SETB P1.1
CLR P1.2
SETB P1.3


QUAY1:
MOV P0,#0FFH
JB P0.0,QUAY2
LJMP DUNG_DC1

QUAY2:
MOV P0,#0FFH
JB P0.1,QUAY1
LJMP DUNG_DC2
LJMP QUAY1

DUNG_DC1:
SETB P1.0
KT: MOV P0,#0FFH
JNB P0.0,KT
RET

DUNG_DC2:
SETB P1.2
KT2:MOV P0,#0FFH
JNB P0.1,KT2
RET



END
 
Status
Not open for further replies.

Latest threads

Back
Top