at89c2051 dc motor speed control

Status
Not open for further replies.

cai2

Member level 2
Joined
Nov 30, 2006
Messages
50
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
1,618
AT89C2051

can someone help me use AT89C2051 apply it to a dc motor control?...I just don't know how to set-up it......I'd like to do it as a project proposal...
 

AT89C2051

try this code to setup your controller, this code doesn't deal with your issue "Dc motor" but take it as an intro.

;***************************************************************************
;* *
;* *
;* LED Blinker *
;* Iguana Labs *
;* 4/1/97 *
;* *
;* *
;***************************************************************************
;

#INCLUDE "8051EQU.INC" ;include predefined constants
;
;**************************************************************************
;
; VARIABLES AND CONSTANTS
;
;
;**************************************************************************
;
; RESET ;reset routine

.ORG 0H ;locate routine at 00H
AJMP START ;jump to START
;
;**************************************************************************
;
; INTERRUPTS (not used) ;place interrupt routines at appropriate
;memory locations
.ORG 03H ;external interrupt 0
RETI
.ORG 0BH ;timer 0 interrupt
RETI
.ORG 13H ;external interrupt 1
RETI
.ORG 1BH ;timer 1 interrupt
RETI
.ORG 23H ;serial port interrupt
RETI
.ORG 25H ;locate beginning of rest of program
;
;**************************************************************************
;
INITIALIZE: ;set up control registers
;
MOV TCON,#00H
MOV TMOD,#00H
MOV PSW,#00H
MOV IE,#00H ;disable interrupts
RET
;
;**************************************************************************
;
; Real code starts below. The first two routines are for delays so we
; can slow down the blinking so we can see it. (Without a delay, it
; would blink so fast it would look like it was always on.
;
;**************************************************************************
;
DELAYMS: ;millisecond delay routine
; ;
MOV R7,#00H ;put value of 0 in register R7
LOOPA:
INC R7 ;increase R7 by one (R7 = R7 +1)
MOV A,R7 ;move value in R7 to Accumlator (also known as A)
CJNE A,#0FFH,LOOPA ;compare A to FF hex (256). If not equal go to LOOPA
RET ;return to the point that this routine was called from
;
;**************************************************************************
;
DELAYHS: ;half second delay above millisecond delay
; ;
MOV R6,#00H ;put 0 in register R6 (R6 = 0)
MOV R5,#002H ;put 2 in register R5 (R5 = 2)
LOOPB:
INC R6 ;increase R6 by one (R6 = R6 +1)
ACALL DELAYMS ;call the routine above. It will run and return to here.
MOV A,R6 ;move value in R6 to A
JNZ LOOPB ;if A is not 0, go to LOOPB
DEC R5 ;decrease R5 by one. (R5 = R5 -1)
MOV A,R5 ;move value in R5 to A
JNZ LOOPB ;if A is not 0 then go to LOOPB.
RET
;
;**************************************************************************
;
START: ;main program (on power up, program starts at this point)
ACALL INITIALIZE ;set up control registers
LOOP:
CPL P1.0 ;ComPLement (invert) P1.0 (this makes LED change)
ACALL DELAYHS ;go to above routine that causes a delay
AJMP LOOP ;go to LOOP(always jump back to point labeled LOOP)
.END ;end program
 

Re: AT89C2051

what are you going to control???
speed or direction??:?:
 

Re: AT89C2051

both direction and speed...
 

Re: AT89C2051

For direction control you can use H Bridge for ex : L293D, and for speed control you can use PWM signal.
 

Re: AT89C2051

blueroomelectronics said:
The SN754410 works like a charm with small DC motors.
**broken link removed**

I like this module, but this is not available here in our country, can you make a four wheel drive version of this?
 

Re: AT89C2051

The Tamiya gearbox should be available mail order. It's made in Japan and there is a Tamiya Philippines.
**broken link removed**
 

Re: AT89C2051

what if i want to control a three phase induction motor, will it still be the same with the dc motor control?...:?:
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…