Wednesday, 18 March 2020

LED DISPLAY INTERFACE



Aim:
To display 8086 number in a four seven segment Common Anode LED display.
Hardware and Software Required:
8086 kit, LED Display Unit
Hardware Description:
Seven segment displays are important display units in Electronics and widely used to display numbers from 0 to 9. It can also display some character alphabets like A,B,C,H,F,E etc


There are two types of 7 segment displays: Common Anode and Common Cathode:
Common Anode: In this all the Negative terminals (cathode) of all the 8 LEDs are connected together (see diagram below), named as COM. And all the positive terminals are left alone.
Common Cathode: In this all the positive terminals (Anodes) of all the 8 LEDs are connected together, named as COM. And all the negative thermals are left alone.




A table has been given below for all the numbers while using Common Anode 7 segment.
Digit to Display
h g f e d c b a
Hex code
0
11000000
C0
1
11111001
F9
2
10100100
A4
3
10110000
B0
4
10011001
99
5
10010010
92
6
10000010
82
7
11111000
F8
8
10000000
80
9
10010000
90

Code:

                         OUTPUT 2500AD
                         ORG 2000H
         
                         MOV DX,FFE6H            ;Configure all 8255 ports
                         MOV AL,80H              ;as output.
                         OUT DX,AL

         LOOP4:  MOV SI,2100H            ;Initialise pointer
          
         LOOP3:  MOV CH,04H              ;4 charecters/group
         LOOP2:  MOV BL,08H              ;8 segments/charecter

                        MOV AL,[SI]             ;get the display code
                        INC SI                  ;Increment pointer
         LOOP1: ROL AL,1                ;get 1 data bit
                MOV DX,FFE2H
                OUT DX,AL               ;o/p bit to portb
                MOV AH,AL
                MOV AL,01H              ;o/p clock to
                MOV DX,FFE4H            ;shift register
                OUT DX,AL
                DEC AL
                OUT DX,AL
                MOV AL,AH
                DEC BL                  ;all bits over?
                JNZ LOOP1               ;no,continue
                DEC CH                  ;all charecters over?
                JNZ LOOP2               ;no,continue                              
                CALL DELAY
                                        ;all groups over?
                ;JNZ LOOP3               ;no,continue
                JMP SHORT LOOP4

DELAY:          MOV CX,0FFFFH
XX:                 DEC CX        
                              JNZ XX
                RET

;Display code table

                ORG 2100H
        STRING:  DB 080H,0C0H,080H,080H
              
                END



Traffic Light Interface





Program
2.TRAFFIC  LIGHTS

; TRAFFIC LIGHT CONTROLLER INTERFACE
; The interface is connected over J4 of of trainer
; Traffic system moves from one state to other after a fixed delay
; This program starts at 2000H location






   OUTPUT  2500AD

        ORG     2000H
START:  MOV     AL,80H                 ; Initialisation of 8255 Mode 0
        MOV     DX,0FFE6H
        OUT     DX,AL                  ; All ports as o/p ports
AGAIN:  MOV     SI,2038H               ; Table of port values
NEXTST: MOV     AL,[SI]
        MOV     DX,0FFE0H
        OUT     DX,AL                  ; PortA value
        INC     SI
        ADD     DX,2
        MOV     AL,[SI]
        OUT     DX,AL                  ; PortB value
        INC     SI
        ADD     DX,2
        MOV     AL,[SI]
        OUT     DX,AL                  ; PortC value
        INC     SI
        CALL    DELAY                  ; Calling Delay routine
        CMP     SI,2044H               ; Checking for the end of the data values
        JNZ     NEXTST
        JMP     AGAIN
DELAY:  MOV     CX,0FFH                ; Delay routine
DLY5:   PUSH    CX
        MOV     CX,03FFH
DLY10:  NOP
        LOOP    DLY10
        POP     CX
        LOOP    DLY5
        RET



        ORG     2038H
        PORTVALUES:     DB      88H,83H,F2H               
                                      DB      38H,88H,F4H             
                                      DB      83H,88H,F8H              
                                      DB      88H,38H,F1H                
                                      DB      00H             
                     

STEPPER MOTOR INTERFACING




Program:


                OUTPUT 2500AD
                ORG 2000H
                MOV AX,0000H            
                 MOV AL,80H                
                MOV DX,0FFE6H          
                OUT DX,AL
                MOV  AL,88H            
                MOV  DX,0FFE0H  
LOOP:      OUT DX,AL
                  CALL  DELAY
                               
                  RCR  AL,1
                  JMP SHORT LOOP
DELAY:    MOV  CX,1500H           
SS:           LOOP SS
                RET
                END

Computer Organization Lab Manual Programs-Cycle:1



PROGRAM 1: 8 BIT ADDITION

ADDRESS

OPCODE

LABEL

MNEMONIC

OPERANDS

3000


MOV
CX,0000
3001




3002




3003


MOV
SI,2100
3004





3005




3006


MOV
AL,[SI]
3007





3008


INC
SI
3009


MOV
BL,[SI]
300A




300B


ADD
AL,BL
300C




300D


JNC
3010
300E




300F


INC
CX
3010


INC
SI
3011


MOV
[SI],AL
3012




3013


INC
SI
3014


MOV
[SI],CX
3015




3016


INT
03


PROGRAM 2: 8 BIT SUBTRACTION

ADDRESS

OPCODE

LABEL

MNEMONIC

OPERANDS

3000


MOV
CX,0000
3001




3002




3003


MOV
SI,2100
3004





3005




3006


MOV
AL,[SI]
3007





3008


INC
SI
3009


MOV
BL,[SI]
300A




300B


SUB
AL,BL
300C




300D


JNC
3010
300E




300F


INC
CX
3010


INC
SI
3011


MOV
[SI],AL
3012




3013


INC
SI
3014


MOV
[SI],CX
3015




3016


INT
03


PROGRAM 3: 8 BIT  MULTIPLICATION

ADDRESS

OPCODE

LABEL

MNEMONIC

OPERANDS

3000


MOV
SI,2100
3001




3002




3003


MOV
AL,[SI]
3004





3005


INC
SI
3006


MOV
BL,[SI]
3007





3008


MUL
BL
3009


INC
SI
300A


MOV
[SI],AL
300B




300C


INT
03











PROGRAM 4: 8 BIT   DIVISION

ADDRESS

OPCODE

LABEL

MNEMONIC

OPERANDS

3000


MOV
SI,2060
3001




3002




3003


MOV
AL,[SI]
3004





3005


INC
SI
3006


MOV
BL,[SI]
3007





3008


DIV
BL
3009


INC
SI
300A


MOV
[SI],AL
300B




300C


INT
03











PROGRAM 5:  16 BIT AIRTHEMATIC OPERATIONS

ADDRESS

OPCODE

LABEL

MNEMONIC

OPERANDS

3000


MOV
CX,0000
3001




3002




3003


MOV
SI,2030
3004





3005




3006


MOV
AX,[SI]
3007





3008


ADD
SI,0002
3009




300A




300B




300C


MOV
BX,[SI]
300D




300E


ADD
AX,BX
300F




3010


JNC
3013
3011




3012


INC
CX
3013


ADD
SI,0002
3014




3015




3016




3017


MOV
[SI],AX
3018




3019


ADD
SI,0002
301A




301B




301C




301D


MOV
[SI],CX
301E




301F


INT
03





PROGRAM 6:  16 BIT SUBTRACTION

ADDRESS

OPCODE

LABEL

MNEMONIC

OPERANDS

3000


MOV
CX,0000
3001




3002




3003


MOV
SI,3030
3004





3005




3006


MOV
AX,[SI]
3007





3008


ADD
SI,0002
3009




300A




300B




300C


MOV
BX,[SI]
300D




300E


SUB
AX,BX
300F




3010


JNC
3013
3011




3012


INC
CX
3013


ADD
SI,0002
3014




3015




3016




3017


MOV
[SI],AX
3018




3019


ADD
SI,0002
301A




301B




301C




301D


MOV
[SI],CX
301E




301F


INT
03



PROGRAM 7:  16 BIT MULTIPLICATION

ADDRESS

OPCODE

LABEL

MNEMONIC

OPERANDS

3000


MOV
DX,0000
3001




3002




3003


MOV
SI,3050
3004





3005




3006


MOV
AX,[SI]
3007





3008


ADD
SI,0002
3009




300A




300B




300C


MOV
BX,[SI]
300D




300E


MUL
BX
300F


ADD
SI,0002
3010




3011




3012




3013


MOV
[SI],AX
3014




3015


ADD
SI,0002
3016




3017




3018




3019


MOV
[SI],DX
301A




301B


INT
03








PROGRAM 8:  16 BIT DIVISION

ADDRESS

OPCODE

LABEL

MNEMONIC

OPERANDS

3000


MOV
DX,0000
3001




3002




3003


MOV
SI,3050
3004





3005




3006


MOV
AX,[SI]
3007





3008


ADD
SI,0002
3009




300A




300B




300C


MOV
BX,[SI]
300D




300E


DIV
BX
300F


ADD
SI,0002
3010




3011




3012




3013


MOV
[SI],AX
3014




3015


ADD
SI,0002
3016




3017




3018




3019


MOV
[SI],DX
301A




301B


INT
03










PROGRAM 9: FACTORIAL

ADDRESS

OPCODE

LABEL

MNEMONIC

OPERANDS

5000



MOV

SI,3000
5001




5002




5003


MOV
AX,[SI]
5004




5005



MOV

BX,AX
5006




5007


DEC
BX
5008


JZ
500E
5009




500A


MUL
BX
500B




500C


JMP
5007
500D




500E


INC
SI
500F


MOV
[SI],AX
5010




5011


INT
03







PROGRAM 10: LARGEST NUMBER

ADDRESS

OPCODE

LABEL

MNEMONIC

OPERANDS

6000


MOV
SI,2100
6001




6002




6003


MOV
CX,0004
6004




6005




6006


MOV
AL,[SI]
6007




6008


INC
SI
6009


MOV
BL,[SI]
600A




600B


CMP
AL,BL
600C




600D


JNC
6011
600E




600F


MOV
AL,BL
6010




6011


DEC
CX
6012


JNZ
6008
6013




6014


INT
03



PROGRAM 11: SMALLEST NUMBER

ADDRESS

OPCODE

LABEL

MNEMONIC

OPERANDS

6000


MOV
SI,2100
6001




6002




6003


MOV
CX,0004
6004




6005




6006


MOV
AL,[SI]
6007




6008


INC
SI
6009


MOV
BL,[SI]
600A




600B


CMP
AL,BL
600C




600D


JC
6011
600E




600F


MOV
AL,BL
6010




6011


DEC
CX
6012


JNZ
6008
6013




6014


INT
03



PROGRAM 12:  8 BIT MULTIBYTE

ADDRESS

OPCODE

LABEL

MNEMONIC

OPERANDS

6000


MOV
SI,2350
6001




6002




6003


MOV
DI,2750
6004




6005




6006


MOV
BP,3000
6007




6008




6009


MOV
CL,0005
600A




600B

UP
MOV
AL,[SI]
600C




600D


MOV
BL,[DI]
600E




600F


ADD
AL,BL
6010




6011


MOV
[BP],AL
6012




6013




6014


INC
SI
6015


INC
DI
6016


INC
BP
6017


LOOP
UP
6018




6019


INT
03

PROGRAM 13:  LINEAR SEARCH

ADDRESS

OPCODE

LABEL

MNEMONIC

OPERANDS

3000


MOV
DX,0000
3001




3002




3003


MOV
SI,2100
3004





3005




3006


MOV
CX,0003
3007





3008




3009


MOV
AL,[SI]
300A




300B

L3
INC
SI
300C


MOV
BL,[SI]
300D




300E


CMP
AL,BL
300F




3010


JNE
L1
3011




3012


MOV
DX,0FFFF
3013




3014




3015


JMP
L2
3016




3017

L1
DEC
CX
3018


JNZ
L3
3019




301A

L2
INT
03