Google

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

No comments: