Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ORG 00H                 ; Set origin to 00H
  2.  
  3. MOV DPTR, #300H         ; Moving Data pointer to 300H
  4. MOV R0, #10D            ; Loop 10 times
  5. MOV R7, #0D             ; Loop variable will increment
  6.  
  7. LOOP1:                  ; Loop of printing [0-9] of right digit
  8.     ; Loop 1 : loops to the position where the next value is present
  9.     MOV DPTR, #300H
  10.     MOV A, R7
  11.     MOV R6, A
  12.     MOV A, R7
  13.  
  14.     JZ PASS             ; Jump if value of A (which is R7) is zero
  15.     LOOP3:
  16.         INC DPTR
  17.         DJNZ R6, LOOP3         
  18.     PASS:
  19.  
  20.     ; Passing value of DPTR in output pin P2 (for left segment)
  21.     INC R7
  22.     MOV A, #00H
  23.     MOVC A, @ A+DPTR
  24.     MOV P2, A
  25.    
  26.     ; Loop 2 : loops to the position [0-9]
  27.     MOV R1, #10D
  28.     MOV DPTR, #300H
  29.     LOOP2:
  30.         MOV A, #00H
  31.         MOVC A, @ A+DPTR
  32.         MOV P0, A           ; Passing output to right segment
  33.         LCALL DELAY         ; Note that P0 has segment pins from
  34.         INC DPTR            ; higher to lower order
  35.         DJNZ R1, LOOP2
  36.          
  37.     ;INC DPTR
  38.     DJNZ R0, LOOP1
  39.  
  40. DELAY:                               ; Delay procedure
  41.     MOV R2, #10
  42.     RAI:
  43.         MOV R3, #255
  44.     RA:
  45.         MOV R4, #255
  46.     JA:
  47.         DJNZ R4, JA
  48.         DJNZ R3, RA
  49.         DJNZ R2, RAI
  50.     RET
  51.  
  52. ORG 300H
  53. DB 0C0H  ; digit drive pattern for 0
  54. DB 0F9H  ; digit drive pattern for 1
  55. DB 0A4H  ; digit drive pattern for 2
  56. DB 0B0H  ; digit drive pattern for 3
  57. DB 099H  ; digit drive pattern for 4
  58. DB 092H  ; digit drive pattern for 5
  59. DB 082H  ; digit drive pattern for 6
  60. DB 0F8H  ; digit drive pattern for 7
  61. DB 080H  ; digit drive pattern for 8
  62. DB 090H  ;digit drive pattern for 9
  63. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement