;------ Alat Pengingat Pabrik Otomatis --------------
;------------------------------------------------------
cacah EQU -50000
ORG 0H
Banding:
CPL P0.7 ;kedipan dp 7-segmen
JB P3.1,BANDING_1 ;scan buton
SENIN_SELASA_RABU_KAMIS_SABTU:
MOV TMOD,#01H
ACALL DISPLAY
JAM_1: CALL BEL_3X
MOV P1,#0F9H
CALL KERJA
JAM_2: CALL BEL_2X
MOV P1,#0A4H
CALL KERJA
JAM_3: CALL BEL_2X
MOV P1,#0B0H
CALL KERJA
IST: CALL BEL_3X
MOV P1,#0C0H
CALL ISTIRAHAT
JAM_4: CALL BEL_3X
MOV P1,#99H
CALL KERJA
JAM_5: CALL BEL_2X
MOV P1,#92H
CALL KERJA
JAM_6: CALL BEL_2X
MOV P1,#82H
CALL KERJA
IST2: CALL BEL_3X
MOV P1,#0C0H
CALL KERJA
JAM_7: CALL BEL_3X
MOV P1,#0F8H
CALL KERJA
JAM_8: CALL BEL_2X
MOV P1,#80H
CALL KERJA
CALL BEL_3X
CALL DISPLAY
LJMP BANDING
BANDING_1: ;banding ke dua
JB P3.2,BANDING_2
JUMAT:
MOV TMOD,#01H
ACALL DISPLAY
JUMAT_JAM_1:
CALL BEL_3X
MOV P1,#0F9H
CALL KERJA
JUMAT_JAM_2:
CALL BEL_2X
MOV P1,#0A4H
CALL KERJA
JUMAT_JAM_3:
CALL BEL_2X
MOV P1,#0B0H
CALL KERJA
JUMAT_IST1:
CALL BEL_3X
MOV P1,#0C0H
CALL ISTIRAHAT
JUMAT_JAM_4:
CALL BEL_3X
MOV P1,#99H
CALL KERJA
JUMAT_JAM_5:
CALL BEL_2X
MOV P1,#92H
CALL KERJA
CALL BEL_3X
CALL DISPLAY
LJMP BANDING
BANDING_2:
LJMP BANDING
;##########################################
BEL_3X: CLR P1.0 ;logika 0 relay hidup
CALL DETIK_4
SETB P1.0 ;logika 1 relay mati
CALL DETIK_2
BEL_2X: CLR P1.0
CALL DETIK_4
SETB P1.0
CALL DETIK_2
CLR P1.0
CALL DETIK_4
SETB P1.0
RET
DETIK_2:
MOV R1,#20
MOV R2,#2
ULANG1: MOV TH0,#HIGH CACAH
MOV TL0,#LOW CACAH
SETB TR0
TUNGGU1:
JNB TF0,TUNGGU1
CLR TF0
CLR TR0
DJNZ R1,ULANG1
CPL P0.7
MOV R1,#20
DJNZ R2,ULANG1
RET
DETIK_4:
MOV R1,#20
MOV R3,#4
ULANG2: MOV TH0,#HIGH CACAH
MOV TL0,#LOW CACAH
SETB TR0
TUNGGU2:
JNB TF0,TUNGGU2
CLR TF0
CLR TR0
DJNZ R1,ULANG2
CPL P1.7
MOV R1,#20
DJNZ R3,ULANG2
RET
;########################################
PELAJARAN:
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
JAM_30menit:
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ISTIRAHAT:
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
ACALL DELAY_1_MENIT
RET
DELAY_1_MENIT:
MOV R0,#20
MOV R6,#60
ULANG:
MOV TH0,#HIGH CACAH
MOV TL0,#LOW CACAH
SETB TR0
TUNGGU:
JNB TF0,TUNGGU
CLR TF0
CLR TR0
DJNZ R0,ULANG
MOV R0,#20
CPL P0.7
DJNZ R6,ULANG
RET
;#########################################
DISPLAY:
MOV R4,#10
MOV DPTR,#NUMERIK
NEXTDATA:
CLR A
MOVC A,@A+DPTR
MOV P0,A
INC DPTR
ACALL detik_2
DJNZ R4,NEXTDATA
RET
NUMERIK:
DB 90H,80H,0F8H,82H,92H,99H,0B0H,0A4H,0F9H,0C0H
END
0 komentar:
Posting Komentar