BEL OTOMATIS


Untuk merancang alat penulis harus mencari beberapa sumber referensi yang dapat dihubungkan atau dikembangkan dalam pembuatan alat, menemukan permasalahan dan penyelesaian dalam pembuatan alat.

Foto Alat

Blok Diagram Bel otomatis.

Listing Program

http://www.4shared.com/file/nRKn45Ss/Bel.html

Gambar rangkaian

About these ads

15 pemikiran pada “BEL OTOMATIS

  1. pak,saya sudah mencoba buat dan bisa bekerja rangkaian tsb
    untuk mengubah (program) pengaturan berl (alarm) untuk 3 (tiga) hari yang berbeda gimana…?
    misal Bel untuk hari 1. SENIN , 2. (SELASA,RABU,KAMIS), 3. JUMAT,4. SABTU
    masing-masing hari tsb berbeda seting alarm nya…mohon petujukknya…….pak lagi belajar…..

  2. Ini contoh listiing Program bel 3 kelompok hariiiii

    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Program Bel Sekolah Otomatis
    ; RTC DS 12C887
    ; Mikrokontroler AT89S52
    ; LCD M1632
    ; Push Button = 3
    ; Output Relai & Speaker = 1
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    K_menu bit p3.1
    K_up bit p3.2
    K_down bit p3.0

    LCD_rs bit p1.0
    LCD_cs bit p1.1

    RTC_cs bit p3.5

    Speaker bit p1.4
    Relai bit p1.3

    geserL equ 00011011b ; 0 0 0 1 S/C R/L X X
    geserR equ 00011111b ; 0 0 0 1 S/C R/L X X

    Nada_B0 Equ -1508
    Nada_C0 Equ -1424
    Nada_D0 Equ -1267

    Nada_E1 Equ -1127
    Nada_F1 Equ -1064
    Nada_F1K Equ -1003
    Nada_G1 Equ -947
    Nada_G1K Equ -894
    Nada_A1 Equ -843
    Nada_A1K Equ -795
    Nada_B1 Equ -750
    Nada_C1 Equ -707
    Nada_C1K Equ -667
    Nada_D1 Equ -629
    Nada_D1K Equ -593

    Nada_E2 Equ -559
    Nada_F2 Equ -527
    Nada_F2K Equ -497
    Nada_G2 Equ -469
    Nada_G2K Equ -442
    Nada_A2 Equ -417
    Nada_A2K Equ -393
    Nada_B2 Equ -370
    Nada_C2 Equ -349
    Nada_C2K Equ -329
    Nada_D2 Equ -310
    Nada_D2k Equ -292

    jam_rtc equ 20h
    menit_rtc equ 21h
    detik_rtc equ 22h
    Hari_rtc equ 23h

    jam_bel equ 24h
    menit_bel equ 25h
    nada_bel equ 26h

    bebas equ 30H
    bebas_2 equ 31H
    Del1 equ 60h
    Del2 equ 61h
    Tmp equ 63h
    Dech equ 66h
    DecL equ 67h
    Almcount equ 68h
    Tmp1 equ 6ch
    Detik_lama equ 6dh
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Memori RTC
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Secon equ 0
    Minute equ 2
    Hour equ 4
    Day_week equ 6
    Day_month equ 7
    Month equ 8
    Year equ 9
    Reg_a equ 10
    Reg_b equ 11

    Data_Kelompok_1 equ 14
    Data_Kelompok_2 equ 15
    Data_Kelompok_3 equ 16
    Data_Kelompok_4 equ 17
    Data_Kelompok_5 equ 18
    Data_Kelompok_6 equ 19
    Data_Kelompok_7 equ 125

    Bel_Grup_1_1 equ 20
    Bel_Grup_1_2 equ 23
    Bel_Grup_1_3 equ 26
    Bel_Grup_1_4 equ 29
    Bel_Grup_1_5 equ 32
    Bel_Grup_1_6 equ 35
    Bel_Grup_1_7 equ 38
    Bel_Grup_1_8 equ 41
    Bel_Grup_1_9 equ 44
    Bel_Grup_1_10 equ 47
    Bel_Grup_1_11 equ 50
    Bel_Grup_1_12 equ 53
    Bel_Grup_1_13 equ 56
    Bel_Grup_1_14 equ 59

    Bel_Grup_2_1 equ 62
    Bel_Grup_2_2 equ 65
    Bel_Grup_2_3 equ 68
    Bel_Grup_2_4 equ 71
    Bel_Grup_2_5 equ 74
    Bel_Grup_2_6 equ 77
    Bel_Grup_2_7 equ 80
    Bel_Grup_2_8 equ 83
    Bel_Grup_2_9 equ 86
    Bel_Grup_2_10 equ 89
    Bel_Grup_2_11 equ 92
    Bel_Grup_2_12 equ 95

    Bel_Grup_3_1 equ 98
    Bel_Grup_3_2 equ 101
    Bel_Grup_3_3 equ 104
    Bel_Grup_3_4 equ 107
    Bel_Grup_3_5 equ 110
    Bel_Grup_3_6 equ 113
    Bel_Grup_3_7 equ 116
    Bel_Grup_3_8 equ 119
    Bel_Grup_3_9 equ 122
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Program utama
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    org 0h
    mov tmod,#01H
    mov p2,#00h
    setb relai
    call tunda_long

    Mulai: call inisialisasi_lcd
    call inisialisasi_rtc
    mov dptr,#Start_up
    call tulis_lcd
    call tunda_long
    mov dptr,#judul
    call tulis_lcd
    call tunda_long
    call hapus_layar
    call tulis_char
    call geser

    restar: call nada_alarm_E1
    clr relai
    call tunda_long
    mov dptr,#waktu
    call tulis_lcd

    Ulang: mov detik_lama,a
    call display

    Dtk: call ambil_detik
    cjne a,detik_lama,ulang
    jmp Scanning_waktu

    geser: mov R6,#40
    lagi: mov R1,#geserL
    call tulis_inst
    call ldelay
    djnz R6,lagi
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Scanning_waktu: mov dptr,#Day_week
    call ambil_rtc
    mov hari_rtc,a
    cek_hari_1: cjne a,#1,cek_hari_2
    jmp b_k_1
    cek_hari_2: cjne a,#2,cek_hari_3
    jmp b_k_2
    cek_hari_3: cjne a,#3,cek_hari_4
    jmp b_k_3
    cek_hari_4: cjne a,#4,cek_hari_5
    jmp b_k_4
    cek_hari_5: cjne a,#5,cek_hari_6
    jmp b_k_5
    cek_hari_6: cjne a,#6,cek_hari_7
    jmp b_k_6
    cek_hari_7: cjne a,#7,Cek_hari_Exit
    jmp b_k_7
    Cek_hari_Exit: jmp ulangan
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    b_k_1: mov dptr,#Data_Kelompok_7
    call ambil_rtc
    cbk_1_1: cjne a,#1,cbk_1_2
    jmp scan_bel_k1
    cbk_1_2: cjne a,#2,cbk_1_3
    jmp scan_bel_k2
    cbk_1_3: cjne a,#3,keluar_cek_1
    jmp scan_bel_k3
    keluar_cek_1: jmp ulangan

    b_k_2: mov dptr,#Data_Kelompok_1
    call ambil_rtc
    cbk_2_1: cjne a,#1,cbk_2_2
    jmp scan_bel_k1
    cbk_2_2: cjne a,#2,cbk_2_3
    jmp scan_bel_k2
    cbk_2_3: cjne a,#3,keluar_cek_2
    jmp scan_bel_k3
    keluar_cek_2: jmp ulangan

    b_k_3: mov dptr,#Data_Kelompok_2
    call ambil_rtc
    cbk_3_1: cjne a,#1,cbk_3_2
    jmp scan_bel_k1
    cbk_3_2: cjne a,#2,cbk_3_3
    jmp scan_bel_k2
    cbk_3_3: cjne a,#3,keluar_cek_3
    jmp scan_bel_k3
    keluar_cek_3: jmp ulangan

    b_k_4: mov dptr,#Data_Kelompok_3
    call ambil_rtc
    cbk_4_1: cjne a,#1,cbk_4_2
    jmp scan_bel_k1
    cbk_4_2: cjne a,#2,cbk_4_3
    jmp scan_bel_k2
    cbk_4_3: cjne a,#3,keluar_cek_4
    jmp scan_bel_k3
    keluar_cek_4: jmp ulangan

    b_k_5: mov dptr,#Data_Kelompok_4
    call ambil_rtc
    cbk_5_1: cjne a,#1,cbk_5_2
    jmp scan_bel_k1
    cbk_5_2: cjne a,#2,cbk_5_3
    jmp scan_bel_k2
    cbk_5_3: cjne a,#3,keluar_cek_5
    jmp scan_bel_k3
    keluar_cek_5: jmp ulangan

    b_k_6: mov dptr,#Data_Kelompok_5
    call ambil_rtc
    cbk_6_1: cjne a,#1,cbk_6_2
    jmp scan_bel_k1
    cbk_6_2: cjne a,#2,cbk_6_3
    jmp scan_bel_k2
    cbk_6_3: cjne a,#3,keluar_cek_6
    jmp scan_bel_k3
    keluar_cek_6: jmp ulangan

    b_k_7: mov dptr,#Data_Kelompok_6
    call ambil_rtc
    cbk_7_1: cjne a,#1,cbk_7_2
    jmp scan_bel_k1
    cbk_7_2: cjne a,#2,cbk_7_3
    jmp scan_bel_k2
    cbk_7_3: cjne a,#3,keluar_cek_7
    jmp scan_bel_k3
    keluar_cek_7: jmp ulangan
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    scan_bel_k1: call ambil_waktu
    mov dptr,#Bel_Grup_1_1
    mov r5,#14
    lanjut_scan_1: call ambil_rtc
    mov jam_bel,a
    inc dptr
    call ambil_rtc
    mov menit_bel,a
    inc dptr
    call ambil_rtc
    mov nada_bel,a
    call scanning_bel
    inc dptr
    djnz r5,lanjut_scan_1
    jmp ulangan

    scan_bel_k2: call ambil_waktu
    mov dptr,#Bel_Grup_2_1
    mov r5,#12
    lanjut_scan_2: call ambil_rtc
    mov jam_bel,a
    inc dptr
    call ambil_rtc
    mov menit_bel,a
    inc dptr
    call ambil_rtc
    mov nada_bel,a
    call scanning_bel
    inc dptr
    djnz r5,lanjut_scan_2
    jmp ulangan

    scan_bel_k3: call ambil_waktu
    mov dptr,#Bel_Grup_3_1
    mov r5,#9
    lanjut_scan_3: call ambil_rtc
    mov jam_bel,a
    inc dptr
    call ambil_rtc
    mov menit_bel,a
    inc dptr
    call ambil_rtc
    mov nada_bel,a
    call scanning_bel
    inc dptr
    djnz r5,lanjut_scan_3
    jmp ulangan

    scanning_bel: mov a,jam_rtc
    cjne a,jam_bel,scanning_out
    scanning_bel_2: mov a,menit_rtc
    cjne a,menit_bel,scanning_out
    scanning_bel_3: call ambil_detik
    mov a,detik_rtc
    cjne a,#0,scanning_out
    setb relai
    mov dptr,#Bell_bunyi
    call tulis_lcd
    call tunda_long
    call scanning_nada_bel
    clr relai
    call tunda_long
    mov dptr,#Waktu
    call tulis_lcd
    scanning_out: ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    scanning_nada_bel: mov a,nada_bel
    cjne a,#0,scanning_nada_bel_2
    jmp scanning_nada_bel_out
    scanning_nada_bel_2: cjne a,#1,scanning_nada_bel_3
    call Nada_Klasikan
    jmp scanning_nada_bel_out
    scanning_nada_bel_3: cjne a,#2,scanning_nada_bel_4
    call nada_alarm_F1
    jmp scanning_nada_bel_out
    scanning_nada_bel_4: cjne a,#3,scanning_nada_bel_out
    call nada_alarm_F1k
    jmp scanning_nada_bel_out
    scanning_nada_bel_out: ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ulangan: call display
    jb k_menu,jmp_dtk
    jnb k_menu,$
    call Set_menu_awal
    jmp ulang
    jmp_dtk: jmp dtk
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Settingan tombol pilihan awal
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Set_menu_awal: mov dptr,#Menu_1
    call tulis_lcd
    pilihan_set_jam: jb k_Menu,pilihan_set_jam_1
    jnb k_menu,$
    call setting_1
    ret
    pilihan_set_jam_1: jb k_up,pilihan_set_jam_2
    jnb k_up,$
    jmp Set_menu_2
    pilihan_set_jam_2: jb k_down,pilihan_set_jam
    jnb k_down,$
    jmp Set_menu_4

    Set_menu_2: mov dptr,#Menu_2
    call tulis_lcd
    pilihan_set_bel: jb k_Menu,pilihan_set_bel_1
    jnb k_Menu,$
    call set_bel
    ret
    pilihan_set_bel_1: jb k_up,pilihan_set_bel_2
    jnb k_up,$
    jmp Set_menu_3
    pilihan_set_bel_2: jb k_down,pilihan_set_bel
    jnb k_down,$
    jmp Set_menu_awal

    Set_menu_3: mov dptr,#Menu_3
    call tulis_lcd
    pilihan_set_Aktif: jb k_Menu,pilihan_set_Aktif_1
    jnb k_Menu,$
    call Hari_1
    ret
    pilihan_set_Aktif_1: jb k_up,pilihan_set_Aktif_2
    jnb k_up,$
    jmp Set_menu_4
    pilihan_set_Aktif_2: jb k_down,pilihan_set_Aktif
    jnb k_down,$
    jmp Set_menu_2

    Set_menu_4: mov dptr,#Menu_4
    call tulis_lcd
    pilihan_set_Exit: jb k_Menu,pilihan_set_Exit_1
    jnb k_Menu,$
    jmp setting_7
    pilihan_set_Exit_1: jb k_up,pilihan_set_Exit_2
    jnb k_up,$
    jmp Set_menu_awal
    pilihan_set_Exit_2: jb k_down,pilihan_set_Exit
    jnb k_down,$
    jmp Set_menu_3
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Settingan jam dan menit bel
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    set_bel: mov dptr,#Bel_1
    call tulis_lcd
    set_bel_1: jb k_Menu,set_b_1
    jnb k_menu,$
    mov dptr,#Bell_1
    call tulis_lcd
    mov dptr,#Bel_Grup_1_1
    jnb k_menu,$
    mov bebas,#14
    mov bebas_2,#1
    mulai_set_1: call tulis_lcd_1
    call scan_waktu_1
    inc bebas_2
    djnz bebas,mulai_set_1
    jmp Setting_7
    set_b_1: jb k_up,set_b_1a
    jnb k_up,$
    jmp set_bel_2
    set_b_1a: jb k_down,set_bel_1
    jnb k_down,$
    jmp set_bel_8
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    set_bel_2: mov dptr,#Bel_2
    call tulis_lcd
    set_bell_2: jb k_Menu,set_b_2
    jnb k_menu,$
    mov dptr,#Bell_1
    call tulis_lcd
    mov dptr,#Bel_Grup_2_1
    jnb k_menu,$
    mov bebas,#12
    mov bebas_2,#1
    mulai_set_2: call tulis_lcd_1
    call scan_waktu_1
    inc bebas_2
    djnz bebas,mulai_set_2
    jmp Setting_7
    set_b_2: jb k_up,set_b_2a
    jnb k_up,$
    jmp set_bel_3
    set_b_2a: jb k_down,set_bell_2
    jnb k_down,$
    jmp set_bel
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    set_bel_3: mov dptr,#Bel_3
    call tulis_lcd
    set_bell_3: jb k_Menu,set_b_3
    jnb k_menu,$
    mov dptr,#Bell_1
    call tulis_lcd
    mov dptr,#Bel_Grup_3_1
    jnb k_menu,$
    mov bebas,#9
    mov bebas_2,#1
    mulai_set_3: call tulis_lcd_1
    call scan_waktu_1
    inc bebas_2
    djnz bebas,mulai_set_3
    jmp Setting_7
    set_b_3: jb k_up,set_b_3a
    jnb k_up,$
    jmp set_bel_8
    set_b_3a: jb k_down,set_bell_3
    jnb k_down,$
    jmp set_bel_2
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    set_bel_8: mov dptr,#Menu_4
    call tulis_lcd
    set_bell_8: jb k_Menu,set_b_8
    jnb k_menu,$
    jmp setting_7
    ret
    set_b_8: jb k_up,set_b_8a
    jnb k_up,$
    jmp set_bel
    set_b_8a: jb k_down,set_bell_8
    jnb k_down,$
    jmp set_bel_3
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Bel_jam: call disp_set_j
    cekb_1a: jb k_menu,cekb_2a
    jnb k_menu,$
    inc dptr
    ret
    cekb_2a: jb k_up,cekb_3a
    mov p0,#0ffh
    call up_jam
    jmp Bel_jam
    cekb_3a: jb k_down,Bel_jam
    mov p0,#0ffh
    call down_jam
    jmp Bel_jam

    Bel_Menit: call disp_set_m
    cekm_1a: jb k_menu,cekm_2a
    jnb k_menu,$
    inc dptr
    ret
    cekm_2a: jb k_up,cekm_3a
    mov p0,#0ffh
    call up_Menit
    jmp Bel_Menit
    cekm_3a: jb k_down,Bel_Menit
    mov p0,#0ffh
    call down_Menit
    jmp Bel_Menit

    Bel_Lagu: call disp_set_l
    cekl_1a: jb k_menu,cekl_2a
    jnb k_menu,$
    inc dptr
    ret
    cekl_2a: jb k_up,cekl_3a
    mov p0,#0ffh
    call up_Lagu
    jmp Bel_Lagu
    cekl_3a: jb k_down,Bel_Lagu
    mov p0,#0ffh
    call down_Lagu
    jmp Bel_Lagu
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Settingan Hari Pengaktifan
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Hari_1: mov dptr,#Aktif_1
    call tulis_lcd
    mov dptr,#Data_Kelompok_1
    jnb k_menu,$
    hari_1a: call disp_set_3
    cekh_1a: jb k_menu,cekh_2a
    jnb k_menu,$
    jmp Hari_2
    cekh_2a: jb k_up,cekh_3a
    call lcd_up
    jmp hari_1a
    cekh_3a: jb k_down,hari_1a
    call lcd_down
    jmp hari_1a

    Hari_2: mov dptr,#Aktif_2
    call tulis_lcd
    mov dptr,#Data_Kelompok_2
    jnb k_menu,$
    hari_2a: call disp_set_3
    cekh_1b:
    jb k_menu,cekh_2b
    jnb k_menu,$
    jmp Hari_3
    cekh_2b: jb k_up,cekh_3b
    call lcd_up
    jmp hari_2a
    cekh_3b: jb k_down,hari_2a
    call lcd_down
    jmp hari_2a

    Hari_3: mov dptr,#Aktif_3
    call tulis_lcd
    mov dptr,#Data_Kelompok_3
    jnb k_menu,$
    hari_3a: call disp_set_3
    cekh_1c: jb k_menu,cekh_2c
    jnb k_menu,$
    jmp Hari_4
    cekh_2c: jb k_up,cekh_3c
    call lcd_up
    jmp hari_3a
    cekh_3c: jb k_down,hari_3a
    call lcd_down
    jmp hari_3a

    Hari_4: mov dptr,#Aktif_4
    call tulis_lcd
    mov dptr,#Data_Kelompok_4
    jnb k_menu,$
    hari_4a: call disp_set_3
    cekh_1d: jb k_menu,cekh_2d
    jnb k_menu,$
    jmp hari_5
    cekh_2d: jb k_up,cekh_3d
    call lcd_up
    jmp hari_4a
    cekh_3d: jb k_down,hari_4a
    call lcd_down
    jmp hari_4a

    Hari_5: mov dptr,#Aktif_5
    call tulis_lcd
    mov dptr,#Data_Kelompok_5
    jnb k_menu,$
    hari_5a: call disp_set_3
    cekh_1e: jb k_menu,cekh_2e
    jnb k_menu,$
    jmp hari_6
    cekh_2e: jb k_up,cekh_3e
    call lcd_up
    jmp hari_5a
    cekh_3e: jb k_down,hari_5a
    call lcd_down
    jmp hari_5a

    Hari_6: mov dptr,#Aktif_6
    call tulis_lcd
    mov dptr,#Data_Kelompok_6
    jnb k_menu,$
    hari_6a: call disp_set_3
    cekh_1f: jb k_menu,cekh_2f
    jnb k_menu,$
    jmp hari_7
    cekh_2f: jb k_up,cekh_3f
    call lcd_up
    jmp hari_6a
    cekh_3f: jb k_down,hari_6a
    call lcd_down
    jmp hari_6a

    Hari_7: mov dptr,#Aktif_7
    call tulis_lcd
    mov dptr,#Data_Kelompok_7
    jnb k_menu,$
    hari_7a: call disp_set_3
    cekh_1g: jb k_menu,cekh_2g
    jnb k_menu,$
    jmp hari_8
    cekh_2g: jb k_up,cekh_3g
    call lcd_up
    jmp hari_7a
    cekh_3g: jb k_down,hari_7a
    call lcd_down
    jmp hari_7a

    hari_8: mov dptr,#Menu_4
    call tulis_lcd
    set_hari_8: jb k_up,set_hari_a
    jnb k_up,$
    jmp setting_7
    set_hari_a: jb k_menu,set_hari_8
    jnb k_menu,$
    jmp hari_1

    lcd_down: mov p0,#0ffh
    call down_Aktif
    ret
    lcd_up: mov p0,#0ffh
    call up_Aktif
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Settingan tombol jam dan kalender
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Setting_1: mov almcount,#0
    mov dptr,#Waktu
    call tulis_lcd
    call display
    mov dptr,#hour
    mov tmp1,#0
    bounce_1a: jnb k_menu,$
    djnz tmp1,bounce_1a
    Setting_1a: call kursor
    mov a,#0c7h
    call write_inst
    call ambil_data_rtc
    cekset_1a: jb k_menu,cekset_2a
    inc almcount
    jnb k_menu,$
    jmp setting_2
    cekset_2a: jb k_up,cekset_3a
    mov p0,#0ffh
    call up_jam
    jmp setting_1a
    cekset_3a: jb k_down,cekset_4a
    mov p0,#0ffh
    call down_jam
    jmp setting_1a
    cekset_4a: mov tmp1,#0
    bounce_1b: jb k_up,setting_1a
    djnz tmp1,bounce_1b
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Setting_2: jnb k_menu,$
    mov dptr,#Waktu
    call tulis_lcd
    call display
    mov dptr,#minute
    Setting_2a: call kursor
    mov a,#0cah
    call write_inst
    call ambil_data_rtc
    cekset_1b: jb k_menu,cekset_2b
    inc almcount
    jnb k_menu,$
    jmp setting_3
    cekset_2b: jb k_up,cekset_3b
    mov p0,#0ffh
    call up_menit
    jmp setting_2a
    cekset_3b: jb k_down,setting_2a
    mov p0,#0ffh
    call down_menit
    jmp setting_2a
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Setting_3: jnb k_menu,$
    mov dptr,#Waktu
    call tulis_lcd
    call display
    setting_3a: call kursor
    mov a,#0c0h
    call write_inst
    mov dptr,#day_week
    call ambil_rtc
    mov dptr,#hari
    dec a
    mov b,#6
    mul ab
    mov tmp,#6
    mov tmp1,a
    Setting_3b: call copy_tmp
    djnz tmp,setting_3b
    cekset_1c: mov dptr,#day_week
    jb k_menu,cekset_2c
    inc almcount
    jnb k_menu,$
    jmp setting_4
    cekset_2c: jb k_up,cekset_3c
    mov p0,#0ffh
    call up_day
    jmp setting_3a
    cekset_3c: jb k_down,cekset_1c
    mov p0,#0ffh
    call down_day
    jmp setting_3a
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Setting_4: jnb k_menu,$
    mov dptr,#Waktu
    call tulis_lcd
    call display
    mov dptr,#day_month
    Setting_4a: call kursor
    mov a,#80h
    call write_inst
    call ambil_data_rtc
    cekset_1d: jb k_menu,cekset_2d
    inc almcount
    jnb k_menu,$
    jmp setting_5
    cekset_2d: jb k_up,cekset_3d
    mov p0,#0ffh
    call up_day_month
    jmp setting_4a
    cekset_3d: jb k_down,setting_4a
    mov p0,#0ffh
    call down_day_month
    jmp setting_4a
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Setting_5: jnb k_menu,$
    mov dptr,#Waktu
    call tulis_lcd
    call display
    setting_5a: call kursor
    mov a,#83h
    call write_inst
    mov dptr,#month
    call ambil_rtc
    mov dptr,#bulan
    dec a
    mov b,#7
    mul ab
    mov tmp,#7
    mov tmp1,a
    Setting_5b: call copy_tmp
    djnz tmp,setting_5b
    cekset_1e: mov dptr,#month
    jb k_menu,cekset_2e
    inc almcount
    jnb k_menu,$
    jmp setting_6
    cekset_2e: jb k_up,cekset_3e
    mov p0,#0ffh
    call up_month
    jmp setting_5a
    cekset_3e: jb k_down,cekset_1e
    mov p0,#0ffh
    call down_month
    jmp setting_5a

    copy_tmp: mov a,tmp1
    movc a,@a+dptr
    call write_data
    inc dptr
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Setting_6: jnb k_menu,$
    mov dptr,#Waktu
    call tulis_lcd
    call display
    mov dptr,#year
    Setting_6a: call kursor
    mov a,#8dh
    call write_inst
    call ambil_data_rtc
    cekset_1f: jb k_menu,cekset_2f
    inc almcount
    jnb k_menu,$
    jmp setting_7
    cekset_2f: jb k_up,cekset_3f
    mov p0,#0ffh
    call up_year
    jmp setting_6a
    cekset_3f: jb k_down,setting_6a
    mov p0,#0ffh
    call down_year
    jmp setting_6a
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Setting_7: jnb k_menu,$
    bounce_7b: jnb k_menu,$
    call Kursor_mati
    mov dptr,#waktu
    call tulis_lcd
    ret

    Kursor: clr LCD_rs
    mov a,#00001111B
    call write_inst
    call Ldelay
    ret

    Kursor_mati: clr LCD_rs
    mov a,#00001100B
    call write_inst
    call Ldelay
    ret

    scan_waktu_1: call Bel_Jam
    call Bel_Menit
    call Bel_lagu
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Nada alarm
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    isi_delay: mov bebas,#1
    mov bebas_2,#2
    ret
    nada_alarm_B0: call isi_delay
    mulai_nada_B0: mov th0,#high Nada_B0
    mov tl0,#low Nada_B0
    call timer_jalan
    djnz bebas,mulai_nada_B0
    djnz bebas_2,mulai_nada_B0
    ret
    nada_alarm_C0: call isi_delay
    mulai_nada_C0: mov th0,#high Nada_C0
    mov tl0,#low Nada_C0
    call timer_jalan
    djnz bebas,mulai_nada_C0
    djnz bebas_2,mulai_nada_C0
    ret
    nada_alarm_D0: call isi_delay
    mulai_nada_D0: mov th0,#high Nada_D0
    mov tl0,#low Nada_D0
    call timer_jalan
    djnz bebas,mulai_nada_D0
    djnz bebas_2,mulai_nada_D0
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    nada_alarm_E1: call isi_delay
    mulai_nada_E1: mov th0,#high Nada_E1
    mov tl0,#low Nada_E1
    call timer_jalan
    djnz bebas,mulai_nada_E1
    djnz bebas_2,mulai_nada_E1
    ret
    nada_alarm_F1: call isi_delay
    mulai_nada_F1: mov th0,#high Nada_F1
    mov tl0,#low Nada_F1
    call timer_jalan
    djnz bebas,mulai_nada_F1
    djnz bebas_2,mulai_nada_F1
    ret
    nada_alarm_F1K: call isi_delay
    mulai_nada_F1K: mov th0,#high Nada_F1K
    mov tl0,#low Nada_F1K
    call timer_jalan
    djnz bebas,mulai_nada_F1K
    djnz bebas_2,mulai_nada_F1K
    ret
    nada_alarm_G1: call isi_delay
    mulai_nada_G1: mov th0,#high Nada_G1
    mov tl0,#low Nada_G1
    call timer_jalan
    djnz bebas,mulai_nada_G1
    djnz bebas_2,mulai_nada_G1
    ret
    nada_alarm_G1K: call isi_delay
    mulai_nada_G1K: mov th0,#high Nada_G1K
    mov tl0,#low Nada_G1K
    call timer_jalan
    djnz bebas,mulai_nada_G1K
    djnz bebas_2,mulai_nada_G1K
    ret
    nada_alarm_A1: call isi_delay
    mulai_nada_A1: mov th0,#high Nada_A1
    mov tl0,#low Nada_A1
    call timer_jalan
    djnz bebas,mulai_nada_A1
    djnz bebas_2,mulai_nada_A1
    ret
    nada_alarm_A1K: call isi_delay
    mulai_nada_A1K: mov th0,#high Nada_A1K
    mov tl0,#low Nada_A1K
    call timer_jalan
    djnz bebas,mulai_nada_A1K
    djnz bebas_2,mulai_nada_A1K
    ret
    nada_alarm_B1: call isi_delay
    mulai_nada_B1: mov th0,#high Nada_B1
    mov tl0,#low Nada_B1
    call timer_jalan
    djnz bebas,mulai_nada_B1
    djnz bebas_2,mulai_nada_B1
    ret
    nada_alarm_C1: call isi_delay
    mulai_nada_C1: mov th0,#high Nada_C1
    mov tl0,#low Nada_C1
    call timer_jalan
    djnz bebas,mulai_nada_C1
    djnz bebas_2,mulai_nada_C1
    ret
    nada_alarm_C1K: call isi_delay
    mulai_nada_C1K: mov th0,#high Nada_C1K
    mov tl0,#low Nada_C1K
    call timer_jalan
    djnz bebas,mulai_nada_C1K
    djnz bebas_2,mulai_nada_C1K
    ret
    nada_alarm_D1: call isi_delay
    mulai_nada_D1: mov th0,#high Nada_D1
    mov tl0,#low Nada_D1
    call timer_jalan
    djnz bebas,mulai_nada_D1
    djnz bebas_2,mulai_nada_D1
    ret
    nada_alarm_D1K: call isi_delay
    mulai_nada_D1K: mov th0,#high Nada_D1K
    mov tl0,#low Nada_D1K
    call timer_jalan
    djnz bebas,mulai_nada_D1K
    djnz bebas_2,mulai_nada_D1K
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    nada_alarm_E2: call isi_delay
    mulai_nada_E2: mov th0,#high Nada_E2
    mov tl0,#low Nada_E2
    call timer_jalan
    djnz bebas,mulai_nada_E2
    djnz bebas_2,mulai_nada_E2
    ret
    nada_alarm_F2: call isi_delay
    mulai_nada_F2: mov th0,#high Nada_F2
    mov tl0,#low Nada_F2
    call timer_jalan
    djnz bebas,mulai_nada_F2
    djnz bebas_2,mulai_nada_F2
    ret
    nada_alarm_F2K: call isi_delay
    mulai_nada_F2K: mov th0,#high Nada_F2K
    mov tl0,#low Nada_F2K
    call timer_jalan
    djnz bebas,mulai_nada_F2K
    djnz bebas_2,mulai_nada_F2K
    ret
    nada_alarm_G2: call isi_delay
    mulai_nada_G2: mov th0,#high Nada_G2
    mov tl0,#low Nada_G2
    call timer_jalan
    djnz bebas,mulai_nada_G2
    djnz bebas_2,mulai_nada_G2
    ret
    nada_alarm_G2K: call isi_delay
    mulai_nada_G2K: mov th0,#high Nada_G2K
    mov tl0,#low Nada_G2K
    call timer_jalan
    djnz bebas,mulai_nada_G2K
    djnz bebas_2,mulai_nada_G2K
    ret
    nada_alarm_A2: call isi_delay
    mulai_nada_A2: mov th0,#high Nada_A2
    mov tl0,#low Nada_A2
    call timer_jalan
    djnz bebas,mulai_nada_A2
    djnz bebas_2,mulai_nada_A2
    ret
    nada_alarm_A2K: call isi_delay
    mulai_nada_A2K: mov th0,#high Nada_A2K
    mov tl0,#low Nada_A2K
    call timer_jalan
    djnz bebas,mulai_nada_A2K
    djnz bebas_2,mulai_nada_A2K
    ret
    nada_alarm_B2: call isi_delay
    mulai_nada_B2: mov th0,#high Nada_B2
    mov tl0,#low Nada_B2
    call timer_jalan
    djnz bebas,mulai_nada_B2
    djnz bebas_2,mulai_nada_B2
    ret
    nada_alarm_C2: call isi_delay
    mulai_nada_C2: mov th0,#high Nada_C2
    mov tl0,#low Nada_C2
    call timer_jalan
    djnz bebas,mulai_nada_C2
    djnz bebas_2,mulai_nada_C2
    ret
    nada_alarm_C2K: call isi_delay
    mulai_nada_C2K: mov th0,#high Nada_C2K
    mov tl0,#low Nada_C2K
    call timer_jalan
    djnz bebas,mulai_nada_C2K
    djnz bebas_2,mulai_nada_C2K
    ret
    nada_alarm_D2: call isi_delay
    mulai_nada_D2: mov th0,#high Nada_D2
    mov tl0,#low Nada_D2
    call timer_jalan
    djnz bebas,mulai_nada_D2
    djnz bebas_2,mulai_nada_D2
    ret
    nada_alarm_D2K: call isi_delay
    mulai_nada_D2K: mov th0,#high Nada_D2K
    mov tl0,#low Nada_D2K
    call timer_jalan
    djnz bebas,mulai_nada_D2K
    djnz bebas_2,mulai_nada_D2K
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Nada_diam: mov R5,#3
    Nada_d: call tundaan
    djnz R5,Nada_d
    ret
    Nada_diam_1_2: mov R5,#1
    Nada_d_1_2: call tundaan
    djnz R5,Nada_d_1_2
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    timer_jalan: setb tr0
    jnb tf0,$
    clr tr0
    clr tf0
    cpl speaker
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Nada alarm Sayonara
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Nada_Sayonara: call Nada_sayonara_1
    call Nada_sayonara_1
    call Nada_sayonara_2
    call nada_alarm_g1k ;NYA
    call nada_alarm_g1k_2
    call nada_diam_2
    call Nada_sayonara_2
    call nada_alarm_e1 ;NYA
    call nada_alarm_e1_2
    call nada_diam_2
    ret

    Nada_sayonara_1: call nada_alarm_b0 ;SA
    call nada_diam
    call nada_alarm_e1 ;YO
    call nada_alarm_e1_2
    call nada_diam
    call nada_alarm_e1 ;NA
    call Nada_diam_1_2
    call nada_alarm_e1_2
    call Nada_diam
    call nada_alarm_f1k_2
    call nada_diam
    call nada_alarm_g1k ;YO
    call nada_alarm_g1k_2
    call Nada_diam
    call nada_alarm_g1k ;NA
    call Nada_diam_1_2
    call nada_alarm_g1k_2
    call nada_diam
    call nada_alarm_g1k_2
    call nada_diam
    call nada_alarm_f1k_2
    call nada_diam_1_2
    call nada_alarm_e1 ;BER
    call Nada_diam_1_2
    call nada_alarm_f1k ;JUM
    call Nada_diam_1_2
    call nada_alarm_g1k_2
    call Nada_diam
    call nada_alarm_f1k_2
    call Nada_diam
    call nada_alarm_e1_2
    call nada_alarm_e1_2
    call nada_diam_2
    ret

    Nada_sayonara_2: call nada_alarm_E1 ;BU
    call nada_diam_1_2
    call nada_alarm_F1K ;AT
    call nada_diam_1_2
    call nada_alarm_G1K ;A
    call nada_diam_1_2
    call nada_alarm_a1_2
    call nada_diam_1_2
    call nada_alarm_A1 ;SU
    call nada_diam_1_2
    call nada_alarm_A1 ;SAH
    call nada_alarm_A1
    call nada_diam_1_2
    call nada_alarm_a1 ;BU
    call nada_diam_1_2
    call nada_alarm_b1 ;AT
    call nada_diam_1_2
    call nada_alarm_a1 ;A
    call nada_diam_1_2
    call nada_alarm_g1k_2
    call nada_diam_1_2
    call nada_alarm_g1k ;SU
    call nada_diam_1_2
    call nada_alarm_g1k_2
    call nada_diam_1_2
    call nada_alarm_g1k ;SU
    call nada_diam_1_2
    call nada_alarm_a1 ;SAH
    call nada_diam_1_2
    call nada_alarm_g1k ;I
    call nada_diam_1_2
    call nada_alarm_f1k ;TU
    call nada_alarm_f1k_2
    call nada_diam_1_2
    call nada_alarm_f1k ;TAK
    call nada_diam_1_2
    call nada_alarm_b1 ;A
    call nada_diam_1_2
    call nada_alarm_a1 ;DA
    call nada_diam_1_2
    call nada_alarm_g1k ;GU
    call nada_diam_1_2
    call nada_alarm_f1k ;NA
    call nada_diam_1_2
    ret

    nada_alarm_g1k_2: call nada_alarm_g1k ;SAH
    call nada_alarm_g1k
    ret
    nada_alarm_f1k_2: call nada_alarm_f1k
    call nada_alarm_f1k
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Nada alarm Hymne Guru
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Nada_Hymne_Guru: call Hymne_Guru_1
    call Hymne_Guru_2
    call nada_alarm_g1_2
    call nada_diam_1_2
    call nada_alarm_e1_2
    call nada_alarm_e1
    call nada_diam
    call nada_diam_2
    call Hymne_Guru_1
    call Hymne_Guru_2
    call nada_alarm_d0_2
    call nada_diam_1_2
    call nada_alarm_c0
    call nada_alarm_c0_2
    call nada_diam
    call nada_diam_2
    ret

    Hymne_Guru_1: call nada_alarm_g1_2
    call nada_diam
    call nada_alarm_c1
    call nada_alarm_c1_2
    call nada_diam
    call nada_alarm_g1
    call nada_diam
    call nada_alarm_g1_2
    call nada_diam
    call nada_alarm_e1_2
    call nada_diam
    call nada_alarm_f1
    call nada_alarm_f1_2
    call nada_diam
    call nada_alarm_e1
    call nada_diam
    call nada_alarm_f1_2
    call nada_diam
    call nada_alarm_e1_2
    call nada_diam
    call nada_alarm_f1_2
    call nada_diam
    call nada_alarm_e1_2
    call nada_diam_1_2
    call nada_alarm_d0_2
    call nada_diam_1_2
    call nada_alarm_c0_2
    call nada_diam_1_2
    call nada_alarm_d0_2
    call nada_alarm_d0_2
    call nada_diam
    ret

    Hymne_Guru_2: call nada_alarm_e1
    call nada_diam_1_2
    call nada_alarm_f1
    call nada_diam_1_2
    call nada_alarm_g1_2
    call nada_diam
    call nada_alarm_g1_2
    call nada_diam
    call nada_alarm_g1_2
    call nada_diam
    call nada_alarm_e1
    call nada_diam_1_2
    call nada_alarm_d0
    call nada_diam_1_2
    call nada_alarm_a1_2
    call nada_diam
    call nada_alarm_b1
    call nada_alarm_b1_2
    call nada_diam
    call nada_alarm_c1_2
    call nada_alarm_c1_2
    call nada_alarm_c1
    call nada_diam
    call nada_diam_2
    call nada_alarm_a1_2
    call nada_diam
    call nada_alarm_g1_2
    call nada_diam_1_2
    call nada_alarm_f1
    call nada_diam_1_2
    call nada_alarm_e1
    call nada_diam_1_2
    call nada_alarm_f1_2
    call nada_diam
    ret

    nada_alarm_g1_2: call nada_alarm_g1
    call nada_alarm_g1
    ret
    nada_alarm_e1_2: call nada_alarm_e1
    call nada_alarm_e1
    ret
    nada_alarm_c0_2: call nada_alarm_c0
    call nada_alarm_c0
    ret
    nada_alarm_d0_2: call nada_alarm_d0
    call nada_alarm_d0
    ret
    nada_alarm_c1_2: call nada_alarm_c1
    call nada_alarm_c1
    ret
    nada_alarm_f1_2: call nada_alarm_f1
    call nada_alarm_f1
    ret
    nada_diam_2: call nada_diam
    call nada_diam
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Nada alarm Klasikan
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Nada_Klasikan: call Nada_Klasikan_1
    call nada_alarm_g1
    call nada_alarm_a1
    call nada_alarm_b1
    call nada_alarm_c1
    call nada_alarm_c1_2
    call nada_diam
    call Nada_Klasikan_1
    call nada_alarm_g1
    call nada_alarm_c1
    call nada_alarm_b1
    call nada_alarm_a1_2
    call nada_alarm_a1
    call nada_diam
    call Nada_Klasikan_2
    call Nada_Klasikan_1
    call nada_alarm_g1
    call nada_alarm_c1
    call nada_alarm_b1
    call nada_alarm_a1_2
    call nada_alarm_a1
    call nada_diam_2
    call nada_diam
    ret

    Nada_Klasikan_1: call nada_alarm_e2
    call nada_diam_1_2
    call nada_alarm_d1k
    call nada_diam_1_2
    call nada_alarm_e2
    call nada_diam_1_2
    call nada_alarm_d1k
    call nada_diam_1_2
    call nada_alarm_e2
    call nada_diam_1_2
    call nada_alarm_b1
    call nada_diam_1_2
    call nada_alarm_d1
    call nada_diam_1_2
    call nada_alarm_c1
    call nada_diam_1_2
    call nada_alarm_a1_2
    call nada_alarm_a1
    call nada_diam
    call nada_alarm_e1
    call nada_alarm_g1
    call nada_alarm_a1
    call nada_alarm_b1_2
    call nada_alarm_b1_2
    ret

    Nada_Klasikan_2: call nada_alarm_b1
    call nada_diam_1_2
    call nada_alarm_c1
    call nada_diam_1_2
    call nada_alarm_d1
    call nada_diam_1_2
    call nada_alarm_e2_2
    call nada_alarm_e2_2
    call nada_diam
    call nada_alarm_c1
    call nada_diam_1_2
    call nada_alarm_f2
    call nada_diam_1_2
    call nada_alarm_e2
    call nada_diam_1_2
    call nada_alarm_d1_2
    call nada_alarm_d1_2
    call nada_diam
    call nada_alarm_b1
    call nada_diam_1_2
    call nada_alarm_e2
    call nada_diam_1_2
    call nada_alarm_d1
    call nada_diam_1_2
    call nada_alarm_c1_2
    call nada_alarm_c1_2
    call nada_alarm_c1
    call nada_diam_1_2
    call nada_alarm_d1
    call nada_diam_1_2
    call nada_alarm_c1
    call nada_diam_1_2
    call nada_alarm_b1_2
    call nada_alarm_b1_2
    call nada_alarm_b1_2
    call nada_diam
    ret

    nada_alarm_b1_2: call nada_alarm_b1
    call nada_alarm_b1
    ret
    nada_alarm_d1_2: call nada_alarm_d1
    call nada_alarm_d1
    ret
    nada_alarm_a1_2: call nada_alarm_a1
    call nada_alarm_a1
    ret
    nada_alarm_e2_2: call nada_alarm_e2
    call nada_alarm_e2
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Tampilan utama LCD
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Display: mov a,#0c0h
    call write_inst
    T_hari: mov dptr,#day_week
    call ambil_rtc
    mov dptr,#hari
    dec a
    mov b,#6
    mul ab
    mov tmp,#6
    mov tmp1,a
    T_hari_2: call copy_tmp
    djnz tmp,T_hari_2
    mov a,#20h
    call write_data
    mov a,#0c7h
    call write_inst
    T_jam: mov dptr,#hour
    call ambil_data_rtc
    mov a,#’:’
    call write_data
    T_menit: mov dptr,#minute
    call ambil_data_rtc
    mov a,#’:’
    call write_data
    T_detik: mov dptr,#secon
    call ambil_data_rtc
    T_tanggal: mov a,#080h
    call write_inst
    mov dptr,#day_month
    call ambil_data_rtc
    mov a,#’ ‘
    call write_data
    T_bulan: mov dptr,#month
    call ambil_rtc
    mov dptr,#bulan
    dec a
    mov b,#7
    mul ab
    mov tmp,#7
    mov tmp1,a
    T_bulan_2: call copy_tmp
    djnz tmp,T_bulan_2
    mov a,#20h
    call write_data
    mov a,#08dh
    call write_inst
    T_tahun: mov dptr,#year
    call ambil_data_rtc
    mov p0,#0ffh
    exit0: ret
    disp_set: mov a,#0cah
    dip_set: call write_inst
    call ambil_data_rtc
    ret

    disp_set_2: call kursor
    mov a,#0c8h
    jmp dip_set
    disp_set_3: call kursor
    mov a,#0c7h
    jmp dip_set

    disp_set_J: call kursor
    mov a,#0c2h
    jmp dip_set

    disp_set_M: call kursor
    mov a,#0c5h
    jmp dip_set

    disp_set_L: call kursor
    mov a,#0c8h
    jmp dip_set
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Baca rtc up rtc down dan tulis rtc
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Baca_rtc_up: mov r7,#25
    Bounce_up: jb k_up,exit
    djnz r7,bounce_up
    baca_up: call ambil_rtc
    inc a
    ret
    Baca_rtc_down: mov r7,#25
    baca_down: jb k_down,exit
    djnz r7,baca_down
    call ambil_rtc
    dec a
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Tulis_rtc: clr rtc_cs
    movx @dptr,a
    setb rtc_cs

    Tunggu_tombol_dilepas:
    ca: mov r7,#25
    cc: jnb k_up,ca
    jnb k_down,ca
    djnz r7,cc
    exit: ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Rutin tambah & kurangi menit
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Up_menit: call baca_rtc_up
    cjne a,#59,cek_59
    cek_59: jc belum_59
    clr a
    belum_59: jmp tulis_rtc

    Down_menit: call baca_rtc_down
    cjne a,#0ffh,m_255
    mov a,#59
    m_255: jmp tulis_rtc
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Rutin tambah & kurangi jam
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Up_jam: call baca_rtc_up
    cjne a,#24,cek_24
    cek_24: jc belum_24
    clr a
    belum_24: jmp tulis_rtc

    Down_jam: call baca_rtc_down
    cjne a,#0ffh,j_255
    mov a,#23
    j_255: jmp tulis_rtc
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Rutin tambah & kurangi hari dlm seminggu
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Up_day: call baca_rtc_up
    cjne a,#8,cek_7
    cek_7: jc belum_7
    clr a
    inc a
    belum_7: jmp tulis_rtc

    Down_day: call baca_rtc_down
    jnz bukan_0_day
    mov a,#7
    bukan_0_day: jmp tulis_rtc
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Rutin tambah & kurangi hari dlm sebulan
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Up_day_month: call baca_rtc_up
    cjne a,#32,cek_31
    cek_31: jc belum_31
    clr a
    inc a
    belum_31: jmp tulis_rtc

    Down_day_month: call baca_rtc_down
    jnz bukan_0_daymonth
    mov a,#31
    bukan_0_daymonth: jmp tulis_rtc
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Rutin tambah & kurangi bulan
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Up_month: call baca_rtc_up
    cjne a,#13,cek_12
    cek_12: jc belum_12
    clr a
    inc a
    belum_12: jmp tulis_rtc

    Down_month: call baca_rtc_down
    jnz bukan_0_month
    mov a,#12
    bukan_0_month: jmp tulis_rtc
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Rutin tambah & kurangi Lagu
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Up_Lagu: call baca_rtc_up
    cjne a,#4,cek_4
    cek_4: jc belum_4
    clr a
    belum_4: jmp tulis_rtc

    Down_lagu: call baca_rtc_down
    cjne a,#0ffh,l_255
    mov a,#3
    l_255: jmp tulis_rtc
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Rutin tambah & kurangi Aktifan
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Up_aktif: call baca_rtc_up
    cjne a,#4,cek_a4
    cek_a4: jc belum_a4
    clr a
    belum_a4: jmp tulis_rtc

    Down_aktif: call baca_rtc_down
    cjne a,#0ffh,aktif_255
    mov a,#3
    aktif_255: jmp tulis_rtc
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Rutin tambah & kurangi tahun
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Up_year: call baca_rtc_up
    cjne a,#100,cek_99
    cek_99: jc belum_99
    clr a
    belum_99: jmp tulis_rtc

    Down_year: call baca_rtc_down
    cjne a,#0ffh,y_255
    mov a,#99
    y_255: jmp tulis_rtc
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; inisialisasi LCD
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Inisialisasi_LCD: mov a,#03fh
    call write_inst
    call write_inst
    mov a,#0dh
    call write_inst
    mov a,#06h
    call write_inst
    mov a,#01h
    call write_inst
    mov a,#0ch
    call write_inst
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; inisialisasi RTC
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Inisialisasi_rtc: clr rtc_cs
    ; reg a = UIP DV2 DV1 DV0 RS3 RS2 RS1 RS0
    ; REG B = SET PIE AIE UIE SQWE DM 24/12 DSE
    mov r0,#reg_a
    mov a,#00101111b
    movx @r0,a
    inc r0
    mov a,#00001110b
    movx @r0,a
    clr a
    setb rtc_cs
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Ambil data rtc dan tulis ke lcd
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Ambil_data_rtc: call ambil_rtc
    mov decl,a
    call hextodec
    mov tmp,a
    swap a
    anl a,#0fh
    orl a,#30h
    call write_data
    mov a,tmp
    anl a,#0fh
    orl a,#30h
    call write_data
    ret

    Ambil_rtc_desimal: call ambil_rtc
    mov decl,a
    call hextodec
    mov tmp,a
    ret

    Ambil_rtc: clr rtc_cs
    movx a,@dptr
    setb rtc_cs
    ret

    ambil_waktu: mov dptr,#hour
    call ambil_rtc
    mov jam_rtc,a
    mov dptr,#minute
    call ambil_rtc
    mov menit_rtc,a
    call ambil_detik
    ret

    ambil_detik: mov dptr,#secon
    call ambil_rtc
    mov detik_rtc,a
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Rutin menulis instruksi ke lcd
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    write_inst: clr lcd_rs
    setb lcd_cs
    mov p0,a
    wrdt: clr lcd_cs
    setb lcd_cs
    call delay
    mov p0,#0ffh
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Rutin menulis data ke lcd
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    write_data: setb lcd_rs
    setb lcd_cs
    trsa: mov p0,a
    jmp wrdt
    Hapus_layar: clr LCD_rs
    mov a,#00000001B
    call write_inst
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; tulis 16 char di baris lcd atas
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Tulis_lcd_atas: mov a,#80h
    tlcdb: mov r3,#16
    call write_inst
    tulis1: clr a
    movc a,@a+dptr
    call write_data
    inc dptr
    djnz r3,tulis1
    ret

    tulis_lcd_1: mov a,#0c0h
    call write_inst
    mov a,bebas_2
    cjne a,#1,tulis_char_2
    mov a,#’1′
    jmp write_data
    tulis_char_2: cjne a,#2,tulis_char_3
    mov a,#’2′
    jmp write_data
    tulis_char_3: cjne a,#3,tulis_char_4
    mov a,#’3′
    jmp write_data
    tulis_char_4: cjne a,#4,tulis_char_5
    mov a,#’4′
    jmp write_data
    tulis_char_5: cjne a,#5,tulis_char_6
    mov a,#’5′
    jmp write_data
    tulis_char_6: cjne a,#6,tulis_char_7
    mov a,#’6′
    jmp write_data
    tulis_char_7: cjne a,#7,tulis_char_8
    mov a,#’7′
    jmp write_data
    tulis_char_8: cjne a,#8,tulis_char_9
    mov a,#’8′
    jmp write_data
    tulis_char_9: cjne a,#9,tulis_char_a
    mov a,#’9′
    jmp write_data
    tulis_char_a: cjne a,#10,tulis_char_b
    mov a,#’A’
    jmp write_data
    tulis_char_b: cjne a,#11,tulis_char_c
    mov a,#’B’
    jmp write_data
    tulis_char_c: cjne a,#12,tulis_char_d
    mov a,#’C’
    jmp write_data
    tulis_char_d: cjne a,#13,tulis_char_e
    mov a,#’D’
    jmp write_data
    tulis_char_e: cjne a,#14,tulis_char_f
    mov a,#’E’
    jmp write_data
    tulis_char_f: ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; tulis 16 char di baris lcd bawah
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Tulis_lcd_bawah: mov a,#0c0h
    jmp tlcdb
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; tulis 32 char di baris lcd
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Tulis_lcd: call tulis_lcd_atas
    call tulis_lcd_bawah
    ret

    tulis_char: mov dptr,#citra
    mov r3,#16
    mov r1,#80h
    call Tulis_inst
    write1: clr a
    movc a,@a+dptr
    mov r1,A
    inc dptr
    call Tulis_data
    djnz r3,write1
    ret

    Tulis_inst: clr lcd_rs
    mov P0,R1
    setb lcd_cs
    call delay
    clr lcd_cs
    ret

    Tulis_data: setb lcd_rs
    mov P0,R1
    setb lcd_cs
    call delay
    clr lcd_cs
    ret

    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; konversi heksa ke desimal
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    hextodec: mov psw,#0
    clr c
    mov dech,#0
    mov a,decl
    swap a
    anl a,#0fh ;00001111
    mov tmp,a
    jz sudah_ditambah
    clr a
    tambah_16: add a,#16h ;22 d
    da a
    mov r2,a
    clr a
    addc a,dech
    mov dech,a
    mov a,r2
    djnz tmp,tambah_16
    sudah_ditambah: mov tmp,a
    mov a,decl
    anl a,#0fh
    da a
    add a,tmp
    da a
    mov decl,a
    ; desimal hanya di bawah 100
    ret
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Rutin delay
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    delay: mov del1,#5
    delay1: mov del2,#0
    djnz del2,$
    djnz del1,delay1
    ret

    ldelay: mov del1,#200
    ldelay1: mov del2,#0
    djnz del2,$
    djnz del1,ldelay1
    ret

    TUNDA_LONG: MOV R5,#50
    JJz: CALL TUNDAan
    DJNZ R5,JJz
    RET

    TUNDAan: MOV R7,#100
    LD11: DJNZ R6,$
    DJNZ R7,LD11
    RET
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ; Data
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Judul: db ‘ Bel Sekolah ‘
    db ‘<<<>>>’
    Citra: db ‘Produk PT. CITRA’

    Start_up: db ‘ Start-Up ‘
    db ‘…………….’
    Waktu: db ‘ 20 ‘
    db ‘ ‘

    Menu_1: db ‘Setting Waktu>>>’
    db ‘JJ/MM/D/HH/BB/TT’
    Menu_2: db ‘Setting Bel Ot>>’
    db ‘Grup>(1)>(2)>(3)’
    Menu_3: db ‘Setting Kelmpok>’
    db ‘ S/S/R/K/J/S//M ‘
    Menu_4: db ‘<<<<>>>>’
    db ‘ ‘

    Bel_1: db ”
    db ‘>>>>>>’
    Bel_2: db ”
    db ‘>>>>>>’
    Bel_3: db ”
    db ‘>>>>>>’

    Bell_1: db ‘>>HH:MM:NN >>>>>’
    db ‘ ) : : >>>>>’
    Bell_bunyi: db ‘>Alarm Bel Bunyi’
    db ‘>Out AC 220V On ‘

    Aktif_1: db ‘<<>>’
    db ‘ ( ) ‘
    Aktif_2: db ‘<<>’
    db ‘ ( ) ‘
    Aktif_3: db ‘<<>>>’
    db ‘ ( ) ‘
    Aktif_4: db ‘<<>>’
    db ‘ ( ) ‘
    Aktif_5: db ‘<<>>’
    db ‘ ( ) ‘
    Aktif_6: db ‘<<>>’
    db ‘ ( ) ‘
    Aktif_7: db ‘<<>’
    db ‘ ( ) ‘

    Hari: db ‘Minggu’
    db ‘Senin ‘
    db ‘Selasa’
    db ‘Rabu ‘
    db ‘Kamis ‘
    db ‘Jumat ‘
    db ‘Sabtu ‘

    Bulan: db ‘Januari’
    db ‘Februar’
    db ‘Maret ‘
    db ‘April ‘
    db ‘Mei ‘
    db ‘Juni ‘
    db ‘Juli ‘
    db ‘Agustus’
    db ‘Sptembr’
    db ‘Oktober’
    db ‘Novembr’
    db ‘Desembr’
    ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    END

  3. Salam…
    maaf mau tanya di skema ada komponen RN1 nilainya berapa ohm?
    Terus di listing program ada “Nada alarm Hymne Guru” apakah pada saat listing program dimasukkan lagu/alarm hymne guru ini sudah masuk?

  4. Terima kasih telah berbagi ilmu, mudah-mudahan jadi amalan kebaikan, dilapangkan rezeki dan dimudahkan segala urusannya.
    Ada beberapa pertanyaan, mudah-mudahan berkenan menjawabnya:
    1. Di skema ada beberapa komponen yang tidak ada nilainya; IC5 :………….., RN1………………., N2…………., RN3………….., Q1 ………………, Q2………………..
    2. B2430UNI batre 3 Volt?
    3. Untuk JP1, JP3, JP5 dan JP 6 masing-masing nyambungnya kemana? apakah JP1 ke catu daya atau (+) MP3 player dan JP3 ke tombol Next Player MP3?
    4. Untuk nada di MP3, kalau durasi lagunya beda-beda bagaimana pengaturannya? contoh lagu ke-1 10 detik, lagu ke2
    15 detik maksudnya agar jangan sampai lagu ke-2 cuma diputar selama 10 detik
    5. Secara garis besar prinsip keranya bagaimana?
    6. Untuk memasukkan listing program apakah semua file listing program dalam direktori itu dimasukkan? mulai dari Bel_1 sampai Bel_8, nada_1 sampai nada_3? bisa dijelaskan alur pemasukan listingnya? (Maaf ini pengalaman pertama, saya lagi belajar mikrokontoler.

    Sekali lagi terima kasih atas segala informasinya

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Logout / Ubah )

Twitter picture

You are commenting using your Twitter account. Logout / Ubah )

Facebook photo

You are commenting using your Facebook account. Logout / Ubah )

Google+ photo

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s