MASIGNALPHAS2101
6680671983845063762

Pemrograman Assembly - Program Input Menampilkan JAM DIGITAL

Pemrograman Assembly - Program Input Menampilkan JAM DIGITAL
Add Comments
8/06/2016
Program jam digital


; ==================
; Judul:Program Input Keypad & Output 7-Segment
; Port :Port0 => DATA 7-SEGMENT
; Port1 =>CONTROL 7-SEGMENT
; Port2 => -
; Port3 =>INPUT PUSH BUTTON
; Ket  :menampilkan jam digital
; -------------
; By   : ARC. Robotika Club
; ===================
$MOD51
  ORG  0000H
  AJMP START
  ORG 0100H
START: MOV SP, #30H
  MOV P0, #0FFH
  MOV  P1, #0FFH
  MOV P2, #0FFH
INITIAL: MOV 30H,#00H
  MOV 31H,#00H
  MOV 32H,#00H
  MOV 33H,#00H
  MOV 34H,#00H
  MOV 35H,#00H
  MOV 40H,#00H
  MOV 41H,#00H
  MOV 42H,#00H
  MOV 43H,#00H
  MOV 44H,#00H
  MOV 45H,#00H
  MOV 46H,#00H
TAMPIL_WAKTU:
  MOV P1, #01111111B
  CALL DETIK_SATUAN
  MOV P1, #10111111B
  CALL DETIK_PULUHAN
  MOV P1, #11011111B
  MOV P0, #10111111B
  CALL DELAY1
  MOV P1, #11101111B
  CALL MENIT_SATUAN
  MOV P1, #11110111B
  CALL MENIT_PULUHAN
  MOV P1, #11111011B
  MOV P0, #10111111B

  CALL DELAY1
  MOV P1, #11111101B
  CALL JAM_SATUAN
  MOV P1, #11111110B
  CALL JAM_PULUHAN
  INC 40H
  JMP TAMPIL_WAKTU
DETIK_SATUAN:
  MOV A,30H
  SUBB A,#09H
  JC PASSDET1
  INC 41H
  MOV 30H,#00H
  RET
PASSDET1: MOV A,40H
  SUBB A,#3FH
  JNZ PASSDET2
  MOV 40H,#00H
  INC 30H
PASSDET2: MOV A,30H
  JZ D_NOL
  DEC A
  JZ D_SATU
  DEC A
  JZ D_DUA
  DEC A
  JZ D_TIGA
  DEC A
  JZ D_EMPAT
  DEC A
  JZ D_LIMA
  DEC A
  JZ D_ENAM
  DEC A
  JZ D_TUJUH
  DEC A
  JZ D_DELAPAN
  DEC A
  JZ D_SEMBILAN
  RET
DETIK_PULUHAN:
  MOV A,41H
  SUBB A,#06H
  JC PASSDETPUL
  MOV 41H,#00H
  INC 42H
  RET

PASSDETPUL:
  MOV A,41H
  JZ D_NOL
  DEC A
  JZ D_SATU
  DEC A
  JZ D_DUA
  DEC A
  JZ D_TIGA
  DEC A
  JZ D_EMPAT
  DEC A
  JZ D_LIMA
  DEC A
  JZ D_ENAM
  DEC A
  JZ D_TUJUH
  DEC A
  JZ D_DELAPAN
  DEC A
  JZ D_SEMBILAN
  RET
D_NOL:  CALL ZERO
  CALL DELAY1
  RET
D_SATU:  CALL SATU
  CALL DELAY1
  RET
D_DUA:  CALL DUA
  CALL DELAY1
  RET
D_TIGA:  CALL TIGA
  CALL DELAY1
  RET
D_EMPAT: CALL EMPAT
  CALL DELAY1
  RET
D_LIMA:  CALL LIMA
  CALL DELAY1
  RET
D_ENAM:  CALL ENAM
  CALL DELAY1
  RET
D_TUJUH: CALL TUJUH
  CALL DELAY1
  RET
D_DELAPAN: CALL DELAPAN
  CALL DELAY1
  RET
D_SEMBILAN: CALL SEMBILAN
  CALL DELAY1
  RET
MENIT_SATUAN:
  MOV A,42H
  SUBB A,#09H
  JC PASSMENSAT
  MOV 42H,#00H
  INC 43H
  RET
PASSMENSAT:
  MOV A,42H
  JZ D_NOL
  DEC A
  JZ D_SATU

  DEC A

  JZ D_DUA

  DEC A

  JZ D_TIGA

  DEC A

  JZ D_EMPAT

  DEC A

  JZ D_LIMA

  DEC A

  JZ D_ENAM

  DEC A

  JZ D_TUJUH

  DEC A

  JZ D_DELAPAN

  DEC A

  JZ D_SEMBILAN

  RET  



MENIT_PULUHAN:

  MOV A,43H

  SUBB A,#06H

  JC PASSMENPUL

  MOV 43H,#00H

  INC 44H

  RET

PASSMENPUL:

  MOV A,43H

  JZ D_NOL1

  DEC A

  JZ D_SATU1

  DEC A

  JZ D_DUA1

  DEC A

  JZ D_TIGA1

  DEC A

  JZ D_EMPAT1

  DEC A

  JZ D_LIMA1

  DEC A

  JZ D_ENAM1

  DEC A

  JZ D_TUJUH1

  DEC A

  JZ D_DELAPAN1

  DEC A

  JZ D_SEMBILAN1

  RET



D_NOL1:  JMP D_NOL

D_SATU1: JMP D_SATU

D_DUA1:  JMP D_DUA

D_TIGA1: JMP D_TIGA

D_EMPAT1: JMP D_EMPAT

D_LIMA1: JMP D_LIMA

D_ENAM1: JMP D_ENAM

D_TUJUH1: JMP D_TUJUH

D_DELAPAN1: JMP D_DELAPAN

D_SEMBILAN1: JMP D_SEMBILAN



JAM_SATUAN:

  MOV A,44H

  SUBB A,#09H

  JC PASSJAMSAT

  MOV 44H,#00H

  INC 45H

  RET

PASSJAMSAT:

  MOV A,44H

  JZ D_NOL1

  DEC A

  JZ D_SATU1

  DEC A

  JZ D_DUA1

  DEC A

  JZ D_TIGA1

  DEC A

  JZ D_EMPAT1

  DEC A

  JZ D_LIMA1

  DEC A

  JZ D_ENAM1

  DEC A

  JZ D_TUJUH1

  DEC A

  JZ D_DELAPAN1

  DEC A

  JZ D_SEMBILAN1

  RET



JAM_PULUHAN:

  MOV A,45H

  SUBB A,#02H

  JC PASSJAMPUL

  MOV 45H,#00H

  RET

PASSJAMPUL:

  MOV A,45H

  JZ D_NOL1

  DEC A

  JZ D_SATU1

  DEC A

  JZ D_DUA1

  DEC A

  JZ D_TIGA1

  DEC A

  JZ D_EMPAT1

  DEC A

  JZ D_LIMA1

  DEC A

  JZ D_ENAM1

  DEC A

  JZ D_TUJUH1

  DEC A

  JZ D_DELAPAN1

  DEC A

  JZ D_SEMBILAN1

  RET





CEK:  CALL CEK_JAM

  CALL CEK_MENIT

  CALL CEK_DETIK

  RET

CEK_JAM: 

  RET

CEK_MENIT:

  RET

CEK_DETIK:

  RET



DELAY1:  MOV R5, #03H

DEL1:  MOV R6, #002H

DEL2:  MOV R7, #0A0H

  DJNZ R7, $

  DJNZ R6, DEL2

  DJNZ R5, DEL1

  RET

DELAY2:  MOV R6, #002H

DEL21:  MOV R7, #0A0H

  DJNZ R7, $

  DJNZ R6, DEL21

  RET



SATU:  MOV P0, #11111001B

  RET



DUA:  MOV P0, #10100100B

  RET



TIGA:  MOV P0, #10110000B

  RET



EMPAT:  MOV P0, #10011001B

  RET



LIMA:  MOV P0, #10010010B

  RET



ENAM:  MOV P0, #10000010B

  RET



TUJUH:  MOV P0, #11111000B

  RET



DELAPAN: MOV P0, #10000000B

  RET



SEMBILAN: MOV P0, #10010000B

  RET



ZERO:  MOV P0, #11000000B

  RET



END
Hestech Indonesia

Innovasi di bidang Teknologi, Listrik, Teknik Komputer dan gaya Hidup. Info lainnya tentang praktik konservasi berbasis Sains, inovasi, dan kearifan lokal