loading...

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
DATA SEGMENT
pa equ 0d880h
pb equ 0d881h
pc equ 0d882h
cw equ 0d883h
Data ends
CODE SEGMENT
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
              ret
              delay endp
              code ends
              end start


 
Output:
It counts the value 1,2,3,4,8 until the value is given.
Example:
               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.