pc based digital clock via parallel port using assembly language in tasm

Thread Starter

maonin

Joined Oct 15, 2011
4
hi, i have this project and we already have a code and the circuit but it is not working..
it's supposed to display the hours and minutes
the problems are:
1. the hour display is not displaying anything
2. the minute displays but it is advanced by one minute

so here's the code:
Rich (BB code):
TITLE CLOCK.ASM 
DOSSEG 
.MODEL SMALL 
.STACK 0100H 
.DATA     
      PRINTERPORTBASEADDRESS equ 378h  
.CODE
 MAIN        PROC    
      MOV AX, @DATA     
      MOV DS, AX      

      CALL RTIME    ; READ TIME     
      CALL DisplayTime     ;DISPLAY TIME              

      MOV AX, 4C00H     
      INT 21H 
MAIN         ENDP  

RTIME         PROC     
      MOV AH, 02H     
      INT 1AH     
      RET     
      
      ; CH - HOUR     
      ; CL - MINUTES     
      ; DH - SECONDS 
RTIME        ENDP  

DisplayTime PROC     
      push     DX     
      push     CX     

      mov      AL,CH     
      mov      DX,PRINTERPORTBASEADDRESS    
      out        DX,AL     
      mov      AL,01h     
      mov      DX,PRINTERPORTBASEADDRESS+2     
      out        DX,AL    ; enable display     
      call       Delay 
;     
      mov      AL,00h     
      mov      DX,PRINTERPORTBASEADDRESS+2     
      out        DX,AL     
      pop       AX    ; pop CL (minutes)     
      mov      DX,PRINTERPORTBASEADDRESS    
      out        DX,AL     
      mov      AL,02h     
      mov      DX,PRINTERPORTBASEADDRESS+2     
      out        DX,AL    ; enable display     
      call       Delay 
;     
      mov      AL,00h     
      mov      DX,PRINTERPORTBASEADDRESS+2     
      out        DX,AL     
      pop       AX    ; pop DH (seconds)    
      mov    AL,AH     
      mov      DX,PRINTERPORTBASEADDRESS    
      out        DX,AL     
      mov      AL,08h    
      mov      DX,PRINTERPORTBASEADDRESS+2    
      out        DX,AL    ; enable display     
      call       Delay 
;     
      mov      DX,PRINTERPORTBASEADDRESS+2     
      mov      AL,00h    
      out        DX,AL    
      ret  

DisplayTime ENDP  

Delay Proc        
      MOV CX, 00100h     
X:  PUSH CX         
      MOV CX, 0FFFFh     
Y:  LOOP Y         
      POP CX         
      LOOP X         
      RET  
Delay ENDP 
END
and the circuit:
http://postimage.org/image/2egfc6wsk/
 

nerdegutta

Joined Dec 15, 2009
2,660
This is an international forum. Give it time.

Besides, I think there is something with your circuit...
 

nerdegutta

Joined Dec 15, 2009
2,660
I don't know much about ASM, so I cannot assist you there.

About the circuit:
I'm not sure, but wouldn't D1, D3, D5 show the same? The same with D2, D4 and D6.

They are connected to the same 7447. I think you need at least one 7447-IC for each 7-segment. That means 6 IC-7447.
 

t06afre

Joined May 11, 2009
5,936
If I am correct the 7-segments are multiplexed. So only one group is active at any moment. If they are switched fast enough which may be around 30 Hz or faster. The human eye will se it as they are constant turned on. The circuit looks OK. From what I can see it pass the sanity test at least.
Then things do not work it is time to start debugging. Since you are using TASM. I guess you also have the Turbo Debugger. Run td.exe, the Turbo Debugger. And step through your code.
 

Thread Starter

maonin

Joined Oct 15, 2011
4
we got it!

thankU.

the circuit is just fine.

something in the code that is not right.

thankU. Godbless. :)
 
Top