Instructables

pc based digital clock via parallel port using C language ?

how are you every one?
    I have this project and I already have a code and the circuit but i studied assembly language
    it's supposed to display the hours and minutes
   do any one know assembly and c language

so here's the 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 ; was DH
    push CX ; was CL
    ;
    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

thank you for your time

and this is the circuit diagram

http://www.electvillage.com/upload//uploads/images/qariya_com_adbd174136.png


lolooo (author) 1 year ago
I use Linux
the problems are:
1. the hour display is not displaying anything.
2. the minute displays but it is advanced by one minute.
1.) Specify the OS you are using.
2.) Put comments in your code to tell YOU what your code does as well as those you are asking to review it.

3.) ANY modern OS stops direct port access.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!