Google
Showing posts with label interface stepper motor. Show all posts
Showing posts with label interface stepper motor. Show all posts

Nov 24, 2008

Assembly program to inerface a switch using 8255 IC

PA, PB, PC -- OO If switche closes
In this initially all the ports are initialized as inputs at 1100 and 1110 locations using DB command " switch open" and switch close are defined. INT AC command is used to clear the screen. In this case if the switch is off then it gives outputs else it gives outputs as all is. Here all the ports A, B,C are short circuited. So the output at port c is loaded into AL and then it is compared with FF, if the switch is ON the AL contains FF and BX is made to point to location 1100 and display " switch open" if switch location is off then AL contains 00 and BX is made to point location 1110 and display SWITCH CLOSE. Here INT AB is used for carriage return purpose i.e. to return the cursor to the start position.

Assembly program to inerface a switch using 8255 IC

MOV DX, 8807 : DX IS LOADED WITH CWR
MOV AL,9B
OUT DX,AL
MOV DX,8805
INT AC
AGAIN: INT AL,DX : INPUT THE DATA INTO AL
CMP AL,FF
JZ: DOWN(0109)
INT AF
INT AB
JMP: AGAIN(100B)
DOWN: MOV BX,1100 : MEMORY LOCATION (1100) WITH MESSAGE
JMP 1013: JUMP TO DISPLAY MESSAGE PRESENT IN BX

1100: DB " SWITCH OPEN" OD, 0A, 03
1110 : DB " SWITCH CLOSE" 0D,0A,03

You might also be interested in:

:: How to add two binary numbers without carry
::How to choose a MicroController

Oct 15, 2008

Program to interface stepper motor with 8086 and rotate with anti clock wise direction in full stepping

The following program is to interface stepper motor with 8086 and rotate with anti clock wise direction in full stepping. The purpose of this is to observe and control the stepping action of the motor using assembly language code. The code is also practically illustrated with two live demonstrations on how speed of the motor varies if one of the instruction codes is changed to a new value.

Code:

MOV DX,8807 : Load DX with control word register address of 8255
MOV AL,80 : load control word 80 into AL
OUT DX,AL: Contents of AL are loaded into control word register of 8255
MOV DX,8801: Load PortA address of 8255 into DX
MOV AL,33: Load value 33 into AL
Again OUT DX,AL: Contents of AL are loaded into control word register of 8255
MOV CX,0100: set counter to delay
Loop Again
ROL AL,1 : Rotate left by 1
JMP Again : Unconditional jump to label again

Following is the practical illsutration of the output for the above given code.



The instruction MOV CX,0100 can be changed to a new value in order to vary the speed.
So, for instance lets say MOV CX,7000. Following is the video demonstration of how the speed varies if the value is changed in the above instruction


Thus by changing the instruction the speed of the stepper motor can be varied according with interfacing it to an 8086 microprocessor for full stepping

Related posts:
Interfacing a stepper motor with an AVR Microprocessor

Interfacing a stepper motor with pic micro controller

Interfacing a stepper motor to 8086 using 8255