View Index by Level
RANDOM PAGE

SITE SEARCH

LOG
IN

SIGN UP

HELP

Assembler Count to 99

To gain access to revision questions, please sign up and log in.

A2

Seven Segment Displays Counting to 99

Written by Robert Legget (Feb 2011)

CTRL+Click here to run the simulator.

; ===========================================
; OPEN LOOP CONTROL OF THE SEVEN SEG DISPLAYS
; CONNECT THE SEVEN SEGMENT DISPLAYS TO PORTA
; STEP OR RUN THE PROGRAM 
; 120Hz optimal for fluid transitions 
; ============================================
TENS:
    CALL  SETNOUGHTS
    CALL  PAUSE
    CALL  UNITS
    MOVW  0x85 
    MOVWR PORTA
    CALL  PAUSE
    CALL  UNITS
    MOVW  0xDB 
    MOVWR PORTA
    CALL  PAUSE
    CALL  UNITS
    MOVW  0xCF
    MOVWR PORTA
    CALL  PAUSE
    CALL  UNITS
    MOVW  0xA7
    MOVWR PORTA
    CALL  PAUSE
    CALL  UNITS
    MOVW  0xEE
    MOVWR PORTA
    CALL  PAUSE
    CALL  UNITS
    MOVW  0xFE
    MOVWR PORTA
    CALL  PAUSE
    CALL  UNITS
    MOVW  0xC5
    MOVWR PORTA
    CALL  PAUSE
    CALL  UNITS
    MOVW  0xFF
    MOVWR PORTA
    CALL  PAUSE
    CALL  UNITS
    MOVW  0xEF
    MOVWR PORTA
    CALL  PAUSE
    CALL  UNITS
    JMP   TENS
UNITS:
    MOVW   0X05    ; CONTROL DATA TO W (ONE)
    MOVWR  PORTA   ; COPY DATA TO PORT
    CALL   PAUSE
    MOVW   0X5B    ; CONTROL DATA TO W (TWO)
    MOVWR  PORTA   ; COPY DATA TO PORT
    CALL   PAUSE
    MOVW   0X4F    ; CONTROL DATA TO W (THREE)
    MOVWR  PORTA   ; COPY DATA TO PORT
    CALL   PAUSE
    MOVW   0X27    ; CONTROL DATA TO W (FOUR)
    MOVWR  PORTA   ; COPY DATA TO PORT
    CALL   PAUSE
    MOVW   0X6E    ; CONTROL DATA TO W (FIVE)
    MOVWR  PORTA   ; COPY DATA TO PORT
    CALL   PAUSE
    MOVW   0X7E    ; CONTROL DATA TO W (SIX)
    MOVWR  PORTA   ; COPY DATA TO PORT
    CALL   PAUSE
    MOVW   0X45    ; CONTROL DATA TO W (SEVEN)
    MOVWR  PORTA   ; COPY DATA TO PORT
    CALL   PAUSE
    MOVW   0X7F    ; CONTROL DATA TO W (EIGHT)
    MOVWR  PORTA   ; COPY DATA TO PORT
    CALL   PAUSE
    MOVW   0X6F    ; CONTROL DATA TO W (NINE)
    MOVWR  PORTA   ; COPY DATA TO PORT
    CALL   PAUSE
    MOVW   0X7D    ; CONTROL DATA TO W (ZERO)
    MOVWR  PORTA   ; COPY DATA TO PORT
    RET

; The amount of NOPs is so it is 
; less noticeable when it swaps the
; left hand digit
PAUSE:   
    NOP NOP NOP NOP NOP NOP NOP NOP
    NOP NOP NOP NOP NOP NOP NOP NOP
    NOP NOP NOP NOP NOP NOP NOP NOP
    NOP NOP NOP NOP NOP NOP NOP NOP
    NOP NOP NOP NOP NOP NOP NOP NOP
    NOP NOP NOP NOP NOP NOP NOP NOP
    NOP NOP NOP NOP NOP NOP NOP NOP
    NOP NOP NOP NOP NOP NOP NOP NOP
    RET

SETNOUGHTS:
    MOVW    0X7D    ;SET NOUGHT LEFT DISPLAY
    MOVWR   PORTA
    MOVW    0XFD   ; SET NOUGHT RIGHT DISPLAY
    MOVWR   PORTA
    RET

 

 

 

reviseOmatic V3     Contacts, ©, Cookies, Data Protection and Disclaimers Hosted at linode.com, London