loading...

BCD up down counter using the logic controller interface

The assembly language program to perform BCD up down counter using the logic controller interface is displayed below –

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 al,00h
            mov dx,pa
loop1:      out dx,al
            call delay
            cmp al,09h
            je loop2
            inc al
            jmp loop1
loop2:      out dx,al
            call delay
            cmp al,00h
            je stop 
            dec al
            jmp loop2
stop:       mov ah,4ch
            int 21h
delay proc
             push dx
             mov cx,0ffffh
back1:       mov dx,9fffh
back2:       dec dx
             jnz back2
             loop back1
             ret
             delay endp
             code ends
             end start


 
Output: 
It counts 1,2,3,4,5,6,7,8,9 until the value of count is terminated and counter upto 0-9 digit.

Also read: 5 must use free secure vpn before you connect to internet

0 3

Leave a Reply

Your email address will not be published.