8051 MICROCONTROLLER BASED EXPERIMENT (SIMPLE CONTROL APPLICATIONS)
STEPPER MOTOR
AIM:
To write an assembly language program to run a stepper motor at different speed using 8051.
APPARATUS REQUIRED:
8051 kit, power chord
ALGORITHM:
1. Start the program.
2. Move the address location to DPTR.
3. Move the content of DPTR to A.
4. PUSH the higher and lower byte address to DPH and DPL.
5. Move immediate data to respective register.
6. Give the delay signal to run the motor.
7. Move the content of A TO dptr.
8. POP the higher and lower byte address to DPH and DPL.
9. Increment the DPTR.
10. End the program.
PROGRAM:
ADDRESS | LABEL | OPCODE | MNEMONICS | OPERAND |
4100 | START | 90,45,00 | MOV | DPTR, #4500 |
4103 | | 78,04 | MOV | R0,#04 |
4105 | | E0 | MOVX | A,@DPTR |
4106 | | C0,83 | PUSH | DPH |
4108 | | C0,82 | PUSH | DPL |
410A | | 90,FF,C0 | MOV | DPTR, #FFC0 |
410D | | 7A,01 | MOV | R2, #04 |
410F | | 79,22 | MOV | R1, #0FF |
4111 | DLY1 | 7B,FF | MOV | R3, #0FF |
4113 | DLY | DB,FF | DJNZ | R3,DLY |
4115 | | D9,FC | DJNZ | R1,DLY1 |
4117 | | DA,FA | DJNZ | R2,DLY1 |
4119 | | F0 | MOVX | @DPTR,A |
411A | | D0,82 | POP | DPL |
411C | | D0,83 | POP | DPH |
411E | | A3 | INC | DPTR |
411F | | D8,E4 | DJNZ | R0,J0 |
4121 | | 80,DD | SJMP | START |
4123 | | | END | |
4500 | 09,05,06,0A |
FORWARD DATA: 09, 05, 06,0A
REVERSE DATA: 0A, 06, 05, and 09.
FAST DATA: 0F, 0A, 01, 02.
RESULT:
Thus the stepper motor is observed to be rotating in different speed.
0 comments:
Post a Comment