Tutorial Microcontroller MCS-51 ATMEL ISP

Microcontroller Kits
Programmer and Target 89s51

Simple Mikrokontroller 89s51 Trainer


Standart
Mikrokontroller 89s51 Trainer


Super Mikrokontroller Trainer 89s51

+

All Item Include

Programmer
Via USB

 

 

BACK NEXT

2.7.2. Directing your step wise with push button

The other way to drive step wise of motor stepper is by using a swicht push button, for example, in this lesson we can try to rotate stepper motor in clockwise if we push the button and counter clockwise if we do not push the button.



Figure 2.7.2.1. Driving motor stepper wise step with swicht push button

 

Step 1st
Build the circuit as shown in figure 2.7.2.1. As you seen on figure 2.7.2.1. P0.4 trough P0.7 is connected to driver motor stepper and one push button is connected to P2.0. Remember, that all we want to do with this lesson is to drive clock wise or counter clock wise of motor stepper with push button.

Step 2nd
In this step, you must tipe the assembly program to make your stepper motor run, we assume that you have already known the editor, we used MIDE-51 to edit the program. ( Download File : exp272.zip , Download Complete Circuit File : StepperMotor.PDF )

       org 0h
start: jb P2.0,CW
call StepCCW
sjmp start
CW: call StepCW
sjmp start
;
StepCW:
mov P0,#11101111b; Turn on driver 1
call delay ; call delay time
mov P0,#11011111b; Turn on driver 2
call delay ; call delay time
mov P0,#10111111b; Turn on driver 3
call delay ; call delay time
mov P0,#01111111b; Turn on driver 4
call delay ; call delay time
ret
;
StepCCW:
mov P0,#01111111b; Turn on driver 1
call delay ; call delay time
mov P0,#10111111b; Turn on driver 2
call delay ; call delay time
mov P0,#11011111b; Turn on driver 3
call delay ; call delay time
mov P0,#11101111b; Turn on driver 4
call delay ; call delay time
ret ; delay: mov R0,#0
delay1:mov R2,#0fh
djnz R2,$
djnz R0,delay1
ret end

Step 3rd
Safe your assembly program above, and name it with stepper2.asm (for example) Compile the program that you have been save by using MIDE-51, see the software instruction.

Step 4th
Download your hex file ( stepper2.hex ) into the microcontroller by using Microcontroller ATMEL ISP software, see the instruction.After download this hex file you'll see the action of Stepper Motor ( of course if your cable connection and your program are corrected ).

2.g.3. Directing your step wise with push button

With refers to lesson 2.g.2., in this lesson you can try how to drive stepper motor with two swicht, that's mean you can direct step wise with two push button, and each push button controls one direction as shown in figure 2.23.

Figure 2.23. Driver stepper motor stepper wise with two push button

Comments, questions and discussion about this topic

BACK NEXT