Ring counter using the logic controller interface

The following assembly language program performs the ring counter using the logic gate controller interface –

assume cs:code,ds:data
pa equ 0d880h
pb equ 0d881h
pc equ 0d882h
cw equ 0d883h
Data ends
Start:      mov ax,data
            mov ds,ax
            mov dx,cw
            mov al,80h
            out dx,al
            mov bx,05h
j1:         dec bx
            jz stop
            mov al,01h
            mov dx,pa
loop1:      out dx,al
            call delay
            cmp al,08h
            je j1
            add al,al
            jmp loop1
stop:       mov ah,4ch
            int 21h
delay proc
              push dx
              mov cx,0ffffh
back1:        mov dx,9fffh
back2:        dec dx
              jnz back2
              loop back1
              pop dx
              delay endp
              code ends
              end start

It counts the value 1,2,3,4,8 until the value is given.
               In a four register value counter with initial value of 0000,the repeating pattern is
0000 0001 1100 1110 1111 0111 0011 0010

Also read: Artificial intelligence in blood donation: Big data perspective


0 4

Leave a Reply

Your email address will not be published.