1. THÔNG BÁO TUYỂN ADMIN DIỄN ĐÀN 2013
    Tìm kiếm nhà trọ - Ở ghép
    THÔNG BÁO BÁN ÁO SPKT.NET CHO THÀNH VIÊN DIỄN ĐÀN


    HÃY TÌM KIẾM Ở ĐÂY TRƯỚC KHI ĐẶT CÂU HỎI
    {xen:phrase loading}

ăn cắp ý tưởng làm xong trả lại nè

Thảo luận trong 'Vi điều khiển - Mạch Số' bắt đầu bởi quochung06cdt, 14 Tháng chín 2010.

  1. quochung06cdt New Member

    Số bài viết: 3
    Đã được thích: 0
    Điểm thành tích: 0
    in ủi rửa hàn nạp cắm là chạy

    code:
    org 00h
    td: mov r0,#7h
    mov r1,#7h
    x0: mov p0,#0ffh
    mov p1,#0ffh
    mov p3,#0ffh
    mov p2,#0ffh
    lcall delay
    mov p0,#0
    mov p1,#0
    mov p2,#0
    mov p3,#0
    lcall delay
    djnz r0,x0
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    x2: mov p0,#0aah
    mov p1,#0aah
    mov p2,#0aah
    mov p3,#0aah
    lcall delay
    mov p0,#55h
    mov p1,#55h
    mov p2,#55h
    mov p3,#55h
    lcall delay
    djnz r1,x2
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxx(1led quet 32 led tu p1.0) *1
    mov p0,#0ffh
    mov p1,#0ffh
    mov p2,#0ffh
    mov p3,#0ffh
    lcall delay
    m: clr c
    mov a,p1
    rlc a
    mov p1,a
    mov a,p3
    rlc a
    mov p3,a
    mov a,p2
    rlc a
    mov p2,a
    mov a,p0
    rrc a
    mov p0,a
    lcall delay
    jc m
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxx(4 port sang dan _ cung _ nguoc chieu kim dh)*2
    mov p1,#0ffh
    mov p3,#0ffh
    mov p2,#0ffh
    mov p0,#0ffh
    lcall delay
    x3: clr c
    mov a,p1
    rlc a
    mov p1,a
    clr c
    mov a,p3
    rlc a
    mov p3,a
    clr c
    mov a,p2
    rlc a
    mov p2,a
    clr c
    mov a,p0
    rrc a
    mov p0,a
    lcall delay
    jc x3
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    mov p1,#0ffh
    mov p3,#0ffh
    mov p2,#0ffh
    mov p0,#0ffh
    lcall delay
    xk: clr c
    mov a,p1
    rrc a
    mov p1,a
    clr c
    mov a,p3
    rrc a
    mov p3,a
    clr c
    mov a,p2
    rrc a
    mov p2,a
    clr c
    mov a,p0
    rlc a
    mov p0,a
    lcall delay
    jc xk

    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxx(p3_p2 sang tu tren xuong)*3
    mov p1,#0ffh
    mov p2,#0ffh
    mov p3,#0ffh
    mov p0,#0ffh
    lcall delay
    x4: clr c
    mov a,p1
    rrc a
    mov p1,a
    clr c
    mov a,p3
    rrc a
    mov p3,a
    clr c
    mov a,p2
    rrc a
    mov p2,a
    clr c
    mov a,p0
    rrc a
    mov p0,a
    lcall delay
    jc x4
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxx(p3_p2 tu tren xuong p1_p0 tu duoi len cung luc)*
    mov p1,#0ffh
    mov p3,#0ffh
    mov p2,#0ffh
    mov p0,#0ffh
    lcall delay
    x5: clr c
    mov a,p3
    rrc a
    mov p3,a
    mov a,p1
    rrc a
    mov p1,a
    clr c
    mov a,p2
    rlc a
    mov p2,a
    mov a,p0
    rrc a
    mov p0,a
    lcall delay
    jc x5
    ;xxxxxxxxxxxxxxxxxxxxxxxxx(p1_p0 sang tu duoi len)*
    mov p1,#0ffh
    mov p3,#0ffh
    mov p2,#0ffh
    mov p0,#0ffh
    lcall delay
    x6: clr c
    mov a,p3
    rrc a
    mov p3,a
    clr c
    mov a,p2
    rlc a
    mov p2,a
    clr c
    mov a,p1
    rlc a
    mov p1,a
    clr c
    mov a,p0
    rlc a
    mov p0,a
    lcall delay
    jc x6
    ;xxxxxxxxxxxxxxxxxxxxxxxx(sang tu p1.7_p0.0 xuong_delay_p3.7_p2.0 sang xuong)*
    mov p1,#0ffh
    mov p3,#0ffh
    mov p2,#0ffh
    mov p0,#0ffh
    lcall delay
    x7: clr c
    mov a,p1
    rlc a
    mov p1,a
    mov a,p3
    rlc a
    mov p3,a
    clr c
    mov a,p0
    rlc a
    mov p0,a
    mov a,p2
    rrc a
    mov p2,a
    lcall delay
    jc x7
    ;xxxxxxxxxxxxxxxxxxxxxxxxx(sang tu p2.7_p0.0 qua den p1.7_p3.0)*
    mov p1,#0ffh
    mov p3,#0ffh
    mov p2,#0ffh
    mov p0,#0ffh
    lcall delay
    x8: clr c
    mov a,p1
    rrc a
    mov p1,a
    clr c
    mov a,p0
    rrc a
    mov p0,a
    lcall delay
    jc x8
    x9: clr c
    mov a,p3
    rrc a
    mov p3,a
    clr c
    mov a,p2
    rlc a
    mov p2,a
    lcall delay
    jc x9
    ;xxxxxxxxxxxxxxxxxxxxxxx(sang tu p3.7_p2.0 xuong duoi)*
    mov p1,#0ffh
    mov p3,#0ffh
    mov p2,#0ffh
    mov p0,#0ffh
    lcall delay
    x10: clr c
    mov a,p2
    rrc a
    mov p2,a
    mov a,p3
    rrc a
    mov p3,a
    clr c
    mov a,p0
    rrc a
    mov p0,a
    mov a,p1
    rlc a
    mov p1,a
    lcall delay
    jc x10
    ;xxxxxxxxxxxxxxxxxxxxxxxxxx(sang tu p1.0_p0.7 sang len)*
    mov p1,#0ffh
    mov p3,#0ffh
    mov p2,#0ffh
    mov p0,#0ffh
    lcall delay
    x11: clr c
    mov a,p3
    rrc a
    mov p3,a
    mov a,p1
    rrc a
    mov p1,a
    clr c
    mov a,p2
    rlc a
    mov p2,a
    mov a,p0
    rrc a
    mov p0,a
    lcall delay
    jc x11
    ;xxxxxxxxxxxxxxxxxxxxxxxxx( sang nhap nhay tu pp1.7_p3.0 qua sai)*
    mov p1,#0ffh
    mov p3,#0ffh
    mov p2,#0ffh
    mov p0,#0ffh
    lcall delay
    x13: clr c
    mov a,p1
    rlc a
    mov p1,a
    mov a,p3
    rlc a
    mov p3,a
    clr c
    mov a,p0
    rlc a
    mov p0,a
    mov a,p2
    rrc a
    mov p2,a
    lcall delay
    jc x13
    ;xxxxxxxxxxxxxxxxxxxxxxx( sang nhap nhay tu p3.0 den p2.7_ tu p1.7 den p0.0 )* hoa1
    mov p0,#0ffh
    mov p1,#7fh
    mov p2,#0ffh
    mov p3,#0feh
    clr 05h
    clr 06h
    x22: lcall delay
    clr c
    cpl 05h
    mov c,05h

    mov a,p3
    rlc a
    mov p3,a
    mov a,p2
    rlc a
    mov p2,a
    clr c
    cpl 06h
    mov c,06h
    mov a,p1
    rrc a
    mov p1,a
    mov a,p0
    rlc a
    mov p0,a
    jc x22
    ;xxxxxxxxxxxxxxxxxxxxx( sang tu p1.0_p0.7 sang len)*
    mov p1,#0ffh
    mov p3,#0ffh
    mov p2,#0ffh
    mov p0,#0ffh
    lcall delay
    x14: clr c
    mov a,p3
    rrc a
    mov p3,a
    mov a,p1
    rrc a
    mov p1,a
    clr c
    mov a,p2
    rlc a
    mov p2,a
    mov a,p0
    rrc a
    mov p0,a
    lcall delay
    jc x14
    ;xxxxxxxxxxxxxxxxxxxxxxxxx( sang tu p1.7_p3.0 sang qua p2.7_p0.00)*
    mov p1,#0ffh
    mov p3,#0ffh
    mov p2,#0ffh
    mov p0,#0ffh
    lcall delay
    x15: clr c
    mov a,p1
    rlc a
    mov p1,a
    mov a,p3
    rlc a
    mov p3,a
    clr c
    mov a,p0
    rlc a
    mov p0,a
    mov a,p2
    rrc a
    mov p2,a
    lcall delay
    jc x15
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*
    mov p1,#0ffh
    mov p3,#0ffh
    mov p2,#0ffh
    mov p0,#0ffh
    lcall delay
    x16: clr c
    mov a,p3
    rlc a
    mov p3,a
    mov a,p2
    rlc a
    mov p2,a
    clr c
    mov a,p1
    rrc a
    mov p1,a
    mov a,p0
    rlc a
    mov p0,a
    lcall delay
    jc x16
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxnhap nhay 1 phia tu p1.0 den p0.7*2
    mov p1,#0feh
    mov p3,#0ffh
    mov p2,#0ffh
    mov p0,#0ffh
    lcall delay
    clr 20h
    clr c
    x17: cpl 20h
    mov c,20h
    mov a,p1
    rlc a
    mov p1,a
    mov a,p3
    rlc a
    mov p3,a
    mov a,p2
    rlc a
    mov p2,a
    mov a,p0
    rrc a
    mov p0,a
    lcall delay
    jc x17
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxnhap nhay 2 fia tu p3.7 den p1.0_ tu p2.0 den p0.7* 3
    mov p0,#0ffh
    mov p1,#0ffh
    mov p2,#0feh
    mov p3,#7fh
    clr 05h
    clr 06h
    x18: lcall delay
    clr c
    cpl 05h
    mov c,05h

    mov a,p3
    rrc a
    mov p3,a
    mov a,p1
    rrc a
    mov p1,a
    clr c
    cpl 06h
    mov c,06h
    mov a,p2
    rlc a
    mov p2,a
    mov a,p0
    rrc a
    mov p0,a
    jc x18
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*
    mov p3,#0ffh
    mov p2,#0ffh
    mov p1,#0ffh
    mov p0,#0ffh
    lcall delay
    x19: clr c
    mov a,p3
    rlc a
    mov p3,a
    clr c
    mov a,p2
    rrc a
    mov p2,a
    lcall delay
    jc x19


    lcall delay
    x20: clr c
    mov a,p1
    rlc a
    mov p1,a
    clr c
    mov a,p0
    rlc a
    mov p0,a
    lcall delay
    jc x20
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxnhap nhay 2 fia tu p2,7 den p3.0_ tu p0.0 den p1.7*4
    mov p3,#0ffh
    mov p1,#0ffh
    mov p0,#7fh
    mov p2,#7fh
    clr 05h
    clr 06h
    x25: lcall delay
    clr c
    cpl 05h
    mov c,05h

    mov a,p2
    rrc a
    mov p2,a
    mov a,p3
    rrc a
    mov p3,a
    clr c
    cpl 06h
    mov c,06h
    mov a,p0
    rrc a
    mov p0,a
    mov a,p1
    rlc a
    mov p1,a
    jc x25
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxnhap nhay xen ke *
    mov r3,#4
    x26: mov p0,#0aah
    mov p1,#0aah
    mov p2,#0aah
    mov p3,#0aah
    lcall delay
    mov p0,#55h
    mov p1,#55h
    mov p2,#55h
    mov p3,#55h
    lcall delay
    djnz r3,x26
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*
    mov p0,#0ffh
    mov p1,#0ffh
    mov p2,#0ffh
    mov p3,#0ffh
    lcall delay
    x27: clr c
    mov a,p2
    rrc a
    mov p2,a
    clr c
    mov a,p0
    rrc a
    mov p0,a
    clr c
    mov a,p3
    rrc a
    mov p3,a
    clr c
    mov a,p1
    rlc a
    mov p1,a
    lcall delay
    jc x27
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx *
    mov p0,#0ffh
    mov p1,#0ffh
    mov p2,#0ffh
    mov p3,#0ffh
    lcall delay
    x28: clr c
    mov a,p2
    rlc a
    mov p2,a
    clr c
    mov a,p0
    rlc a
    mov p0,a
    clr c
    mov a,p3
    rlc a
    mov p3,a
    clr c
    mov a,p1
    rrc a
    mov p1,a
    lcall delay
    jc x28
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxnhap nhay 2 fia tu p1.0 den p3.7_ tu p0.7 den p2.0*
    mov p1,#0feh
    mov p3,#0ffh
    mov p2,#0ffh
    mov p0,#0feh
    lcall delay
    clr 20h
    clr 22h
    x29: clr c
    cpl 20h
    mov c,20h
    mov a,p1
    rlc a
    mov p1,a
    mov a,p3
    rlc a
    mov p3,a
    clr c
    cpl 22h
    mov c,22h
    mov a,p0
    rlc a
    mov p0,a
    mov a,p2
    rrc a
    mov p2,a
    lcall delay
    jc x29
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*
    mov r4,#2
    xn: mov p3,#0ffh
    mov p2,#0ffh
    mov p1,#0ffh
    mov p0,#0ffh
    lcall delay
    x30: clr c
    mov a,p3
    rrc a
    mov p3,a
    clr c
    mov a,p1
    rlc a
    mov p1,a
    clr c
    mov a,p0
    rlc a
    mov p0,a
    clr c
    mov a,p2
    rlc a
    mov p2,a
    lcall delay
    jc x30
    mov p3,#0ffh
    mov p2,#0ffh
    mov p1,#0ffh
    mov p0,#0ffh
    lcall delay
    x32: clr c
    mov a,p3
    rlc a
    mov p3,a
    clr c
    mov a,p0
    rrc a
    mov p0,a
    clr c
    mov a,p1
    rrc a
    mov p1,a
    clr c
    mov a,p2
    rrc a
    mov p2,a
    lcall delay
    jc x32
    djnz r4,xn
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    mov p1,#0ffh
    mov p3,#0ffh
    mov p2,#0ffh
    mov p0,#0ffh
    y1: clr c
    mov a,p2
    rlc a
    mov p2,a
    lcall delay
    jc y1
    y2: clr c
    mov a,p1
    rrc a
    mov p1,a
    mov a,p0
    rlc a
    mov p0,a
    lcall delay
    jc y2
    y3: clr c
    mov a,p3
    rlc a
    mov p3,a
    lcall delay
    jc y3
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    mov p1,#0ffh
    mov p3,#0ffh
    mov p2,#0ffh
    mov p0,#0ffh
    lcall delay
    y4: clr c
    mov a,p3
    rrc a
    mov p3,a
    lcall delay
    jc y4
    y5: clr c
    mov a,p0
    rrc a
    mov p0,a
    mov a,p1
    rlc a
    mov p1,a
    lcall delay
    jc y5
    y6: clr c
    mov a,p2
    rrc a
    mov p2,a
    lcall delay
    jc y6
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxx(4port sang don cung chieu nguoc chieu )
    ck equ 10h
    slx equ 11h
    j equ 12h
    btg0 equ 13h
    btg1 equ 14h
    j2 equ 15h
    mov p0,#0ffh
    mov p1,#0ffh
    mov p2,#0ffh
    mov p3,#0ffh
    lcall delay
    mov ck,#8
    mov j,#0ffh
    mov j2,#0ffh

    k11: mov slx,ck
    mov btg0,#0ffh
    mov btg1,#0ffh
    clr c
    k01: mov a,btg0
    rlc a
    mov btg0,a
    anl a,j
    mov p1,a
    mov p2,a
    mov p3,a
    mov a,slx
    cjne a,ck,zi
    clr c
    zi: mov a,btg1
    rrc a
    mov btg1,a
    anl a,j2
    mov p0,a
    lcall delay
    djnz slx,k01
    mov j,p1
    mov j2,p0
    djnz ck,k11
    mov p0,#1
    mov p1,#80h
    mov p2,#80h
    mov p3,#80h
    lcall delay
    mov ck,#8
    mov j,#0ffh
    mov j2,#0ffh
    h21: mov slx,ck
    mov btg0,#0ffh
    mov btg1,#0ffh
    clr c
    h31: mov a,btg0

    rrc a
    mov btg0,a
    anl a,j

    mov p1,a
    mov p2,a
    mov p3,a
    mov a,slx
    cjne a,ck,hy
    clr c
    hy: mov a,btg1
    rlc a
    mov btg1,a
    anl a,j2
    mov p0,a
    lcall delay
    djnz slx,h31
    mov j,p1
    mov j2,p0
    djnz ck,h21

    ;xxxxxxxxxxxxxxxxxxxxxxxxx(p3-p2 sang tu tren xuong_delay_p0p1tu duoi len)*
    mov p0,#0ffh
    mov p1,#0ffh
    mov p2,#0ffh
    mov p3,#0ffh
    lcall delay
    n1: clr c
    mov a,p3
    rrc a
    mov p3,a
    clr c
    mov a,p2
    rlc a
    mov p2,a
    lcall delay
    jc n1
    n2: clr c
    mov a,p1
    rlc a
    mov p1,a
    clr c
    mov a,p0
    rlc a
    mov p0,a
    lcall delay
    jc n2
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(1 led tat chay tu p2.0 den pp3.7) *
    mov p0,#0h
    mov p1,#0h
    mov p2,#0h
    mov p3,#0h
    lcall delay
    setb c
    g: mov a,p2
    rlc a
    mov p2,a
    mov a,p0
    rrc a
    mov p0,a
    mov a,p1
    rlc a
    mov p1,a
    mov a,p3
    rlc a
    mov p3,a
    lcall delay
    jnc g
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx( 1 led tat chay tu p3.7 den p2.0) *
    setb c
    y10: mov a,p3
    rrc a
    mov p3,a
    mov a,p1
    rrc a
    mov p1,a
    mov a,p0
    rlc a
    mov p0,a
    mov a,p2
    rrc a
    mov p2,a
    lcall delay
    jnc y10
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(tat dan tu p2.0 den p3.7)*
    k: setb c
    mov a,p3
    rrc a
    mov p3,a
    mov a,p1
    rrc a
    mov p1,a
    mov a,p0
    rlc a
    mov p0,a
    mov a,p2
    rrc a
    mov p2,a

    lcall delay
    jnc k
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(1led sang don 4 port_tat don)*********
    ckm equ 10h
    slxm equ 11h
    jm equ 12h
    bt equ 13h
    tg1 equ 14h
    ji equ 15h
    mov p0,#0ffh
    mov p1,#0ffh
    mov p2,#0ffh
    mov p3,#0ffh
    lcall delay
    mov ckm,#8
    mov jm,#0ffh
    mov j2,#0ffh

    k1: mov slxm,ckm
    mov bt,#0ffh
    mov tg1,#0ffh
    clr c
    k0: mov a,bt
    rlc a
    mov bt,a
    anl a,jm
    mov p1,a
    mov p2,a
    mov p3,a
    mov a,slxm
    cjne a,ckm,zx
    clr c
    zx: mov a,tg1
    rrc a
    mov tg1,a
    anl a,ji
    mov p0,a
    lcall delay
    djnz slxm,k0
    mov jm,p1
    mov ji,p0
    djnz ckm,k1
    mov p0,#1
    mov p1,#80h
    mov p2,#80h
    mov p3,#80h
    lcall delay
    mov ckm,#8
    mov jm,#0ffh
    mov ji,#0ffh
    h2: mov slxm,ckm
    mov bt,#0ffh
    mov tg1,#0ffh
    clr c
    h3: mov a,bt

    rrc a
    mov bt,a
    anl a,jm

    mov p1,a
    mov p2,a
    mov p3,a
    mov a,slxm
    cjne a,ckm,hj
    clr c
    hj: mov a,tg1
    rlc a
    mov tg1,a
    anl a,ji
    mov p0,a
    lcall delay
    djnz slxm,h3
    mov jm,p1
    mov ji,p0
    djnz ckm,h2
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(1)
    mov ckm,#8
    mov j,#0
    mov ji,#0
    m11: mov slxm,ckm
    mov bt,#0
    mov tg1,#0
    setb c
    m10: mov a,bt
    rrc a
    mov bt,a
    orl a,j

    mov p1,a
    mov p2,a
    mov p3,a
    mov a,ckm
    cjne a,slxm,de
    setb c
    de: mov a,tg1
    rlc a
    mov tg1,a
    orl a,ji
    mov p0,a
    lcall delay
    djnz slxm,m10
    mov j,p1
    mov ji,p0
    djnz ckm,m11
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(nhap nhay)*
    mov r4,#6
    d1: mov p0,#0aah
    mov p1,#0aah
    mov p2,#0aah
    mov p3,#0aah
    lcall delay
    mov p0,#55h
    mov p1,#55h
    mov p2,#55h
    mov p3,#55h
    lcall delay
    djnz r4,d1
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(3led quet 32 led thuan_nguoc)*
    mov p3,#1fh
    mov p1,#0ffh
    mov p2,#0ffh
    mov p0,#0ffh
    mov r1,#2
    setb c
    m5: mov a,p3
    rrc a
    mov p3,a
    mov a,p1
    rrc a
    mov p1,a
    mov a,p0
    rlc a
    mov p0,a
    mov a,p2
    rrc a
    mov p2,a
    lcall delay
    jc m5
    setb c
    k10: mov a,p2
    rlc a
    mov p2,a
    mov a,p0
    rrc a
    mov p0,a
    mov a,p1
    rlc a
    mov p1,a
    mov a,p3
    rlc a
    mov p3,a
    lcall delay
    jc k10
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxx(1ledsangdon2portcungluc_tatdon)
    ck1 equ 10h
    sla1 equ 11h
    m01 equ 12h
    m02 equ 13h
    btg01 equ 16h
    btg02 equ 17h
    m03 equ 18h
    m04 equ 19h
    btg03 equ 20h
    btg04 equ 21h

    mov ck1,#16
    mov m01,#0ffh
    mov m02,#0ffh
    mov m03,#0ffh
    mov m04,#0ffh

    mov p0,#0ffh
    mov p1,#0ffh
    mov p2,#0ffh
    mov p3,#0ffh
    lcall delay
    v2: mov sla1,ck1
    mov btg01,#0ffh
    mov btg02,#0ffh
    mov btg03,#0ffh
    mov btg04,#0ffh
    clr c
    v1: mov a,btg01
    rlc a
    mov btg01,a
    anl a,m01
    mov p1,a
    mov a,btg02
    rlc a
    mov btg02,a
    anl a,m02
    mov p3,a
    mov a,sla1
    cjne a,ck1,i11
    clr c
    i11: mov a,btg03
    rlc a
    mov btg03,a
    anl a,m03
    mov p2,a
    mov a,btg04
    rrc a
    mov btg04,a
    anl a,m04
    mov p0,a
    lcall delay
    djnz sla1,v1
    mov m01,p1
    mov m02,p3
    mov m03,p2
    mov m04,p0
    djnz ck1,v2
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    mov ck1,#16
    mov m01,#0
    mov m02,#0
    mov m03,#0
    mov m04,#0

    v4: mov sla1,ck1
    mov btg01,#0
    mov btg02,#0
    mov btg03,#0
    mov btg04,#0
    setb c
    v3: mov a,btg01
    rlc a
    mov btg01,a
    orl a,m01
    mov p1,a
    mov a,btg02
    rlc a
    mov btg02,a
    orl a,m02
    mov p3,a
    mov a,ck1
    cjne a,sla1,x12
    setb c
    x12: mov a,btg03
    rlc a
    mov btg03,a
    orl a,m03
    mov p2,a
    mov a,btg04
    rrc a
    mov btg04,a
    orl a,m04
    mov p0,a
    lcall delay
    djnz sla1,v3
    mov m01,p1
    mov m02,p3
    mov m03,p2
    mov m04,p0
    djnz ck1,v4

    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(nguoc truong hop tren)
    kck1 equ 10h
    sxa1 equ 11h
    l01 equ 12h
    l02 equ 13h
    bg01 equ 16h
    bg02 equ 17h
    l03 equ 18h
    l04 equ 19h
    bg03 equ 20h
    bg04 equ 21h

    mov kck1,#16
    mov l01,#0ffh
    mov l02,#0ffh
    mov l03,#0ffh
    mov l04,#0ffh

    mov p0,#0ffh
    mov p1,#0ffh
    mov p2,#0ffh
    mov p3,#0ffh
    lcall delay
    w15: mov sxa1,kck1
    mov bg01,#0ffh
    mov bg02,#0ffh
    mov bg03,#0ffh
    mov bg04,#0ffh
    clr c
    w14: mov a,bg01
    rrc a
    mov bg01,a
    anl a,l01
    mov p3,a
    mov a,bg02
    rrc a
    mov bg02,a
    anl a,l02
    mov p1,a
    mov a,sxa1
    cjne a,kck1,w13
    clr c
    w13: mov a,bg03
    rlc a
    mov bg03,a
    anl a,l03
    mov p0,a
    mov a,bg04
    rrc a
    mov bg04,a
    anl a,l04
    mov p2,a
    lcall delay
    djnz sxa1,w14
    mov l01,p3
    mov l02,p1
    mov l03,p0
    mov l04,p2
    djnz kck1,w15
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    mov kck1,#16
    mov l01,#0
    mov l02,#0
    mov l03,#0
    mov l04,#0

    w1: mov sxa1,kck1
    mov bg01,#0
    mov bg02,#0
    mov bg03,#0
    mov bg04,#0
    setb c
    w2: mov a,bg01
    rrc a
    mov bg01,a
    orl a,l01
    mov p3,a
    mov a,bg02
    rrc a
    mov bg02,a
    orl a,l02
    mov p1,a
    mov a,kck1
    cjne a,sxa1,w12
    setb c
    w12: mov a,bg03
    rlc a
    mov bg03,a
    orl a,l03
    mov p0,a
    mov a,bg04
    rrc a
    mov bg04,a
    orl a,l04
    mov p2,a
    lcall delay
    djnz sxa1,w2
    mov l01,p3
    mov l02,p1
    mov l03,p0
    mov l04,p2
    djnz kck1,w1



    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxnhap nhay 2 fia tu p3.7 den p1.0_ tu p2.0 den p0.7*
    mov p0,#0ffh
    mov p1,#0ffh
    mov p2,#0feh
    mov p3,#7fh
    clr 05h
    clr 06h
    n1n: lcall delay
    clr c
    cpl 05h
    mov c,05h

    mov a,p3
    rrc a
    mov p3,a
    mov a,p1
    rrc a
    mov p1,a
    clr c
    cpl 06h
    mov c,06h
    mov a,p2
    rlc a
    mov p2,a
    mov a,p0
    rrc a
    mov p0,a
    jc n1n
    ;xxxxxxxxxxxxxxxxxxxxxxx( sang nhap nhay tu p3.0 den p2.7_ tu p1.7 den p0.0 ) *
    mov p0,#0ffh
    mov p1,#7fh
    mov p2,#0ffh
    mov p3,#0feh
    clr 05h
    clr 06h
    n2n: lcall delay
    clr c
    cpl 05h
    mov c,05h

    mov a,p3
    rlc a
    mov p3,a
    mov a,p2
    rlc a
    mov p2,a
    clr c
    cpl 06h
    mov c,06h
    mov a,p1
    rrc a
    mov p1,a
    mov a,p0
    rlc a
    mov p0,a
    jc n2n
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxnhap nhay 2 fia tu p2,7 den p3.0_ tu p0.0 den p1.7*
    mov p3,#0ffh
    mov p1,#0ffh
    mov p0,#7fh
    mov p2,#7fh
    clr 05h
    clr 06h
    n3: lcall delay
    clr c
    cpl 05h
    mov c,05h

    mov a,p2
    rrc a
    mov p2,a
    mov a,p3
    rrc a
    mov p3,a
    clr c
    cpl 06h
    mov c,06h
    mov a,p0
    rrc a
    mov p0,a
    mov a,p1
    rlc a
    mov p1,a
    jc n3
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxnhap nhay 2 fia tu p1.0 den p3.7_ tu p0.7 den p2.0*
    mov p1,#0feh
    mov p3,#0ffh
    mov p2,#0ffh
    mov p0,#0feh
    lcall delay
    clr 20h
    clr 22h
    n4: clr c
    cpl 20h
    mov c,20h
    mov a,p1
    rlc a
    mov p1,a
    mov a,p3
    rlc a
    mov p3,a
    clr c
    cpl 22h
    mov c,22h
    mov a,p0
    rlc a
    mov p0,a
    mov a,p2
    rrc a
    mov p2,a
    lcall delay
    jc n4
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxx(1led sang quet 23 led kieu) *
    mov p2,#0feh

    lcall delay

    clr c
    u1: mov a,p2
    rlc a
    mov p2,a

    lcall delay
    jc u1
    clr c
    mov p0,#7fh
    u2: mov a,p0
    rrc a
    mov p0,a
    lcall delay
    jc u2
    clr c
    mov p1,#0feh
    u3: mov a,p1
    rlc a
    mov p1,a
    lcall delay
    jc u3
    clr c
    mov p3,#0feh
    u4: mov a,p3
    rlc a
    mov p3,a
    lcall delay
    jc u4
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*
    mov p3,#7fh
    clr c
    v5: mov a,p3
    rrc a
    mov p3,a
    lcall delay
    jc v5
    mov p1,#7fh
    clr c
    v6: mov a,p1
    rrc a
    mov p1,a
    lcall delay
    jc v6
    mov p0,#0feh
    clr c
    v7: mov a,p0
    rlc a
    mov p0,a
    lcall delay
    jc v7
    mov p2,#7fh
    clr c
    v8: mov a,p2
    rrc a
    mov p2,a
    lcall delay
    jc v8
    ;xxxxxxxxxxxxxxxxxxxxxxxxxx21ledsangquet32led2phia va nguoc lai*
    mov p0,#0feh
    mov p1,#0feh
    mov p2,#0ffh
    mov p3,#0ffh
    lcall delay
    setb c
    z2: mov a,p0
    rlc a
    mov p0,a
    mov a,p2
    rrc a
    mov p2,a

    setb c
    mov a,p1
    rlc a
    mov p1,a
    mov a,p3
    rlc a
    mov p3,a
    lcall delay
    jc z2
    ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(1)
    mov p0,#0ffh
    mov p1,#0ffh
    mov p2,#0feh
    mov p3,#7fh
    lcall delay
    setb c
    z3: mov a,p3
    rrc a
    mov p3,a
    mov a,p1
    rrc a
    mov p1,a
    setb c
    mov a,p2
    rlc a
    mov p2,a
    mov a,p0
    rrc a
    mov p0,a
    lcall delay
    jc z3




    jmp td

    delay:
    MOV R7,#20
    LOOOP:MOV TH0,#HIGH(-50000)
    MOV TL0,#LOW(-50000)
    SETB TR0
    WAIT: JNB TF0,WAIT
    CLR TR0
    CLR TF0
    DJNZ R7,LOOOP
    RET

    end

    Các file đính kèm:

  2. innocence91 Member

    Số bài viết: 404
    Đã được thích: 0
    Điểm thành tích: 16
  3. samspkt_9x New Member

    Số bài viết: 16
    Đã được thích: 0
    Điểm thành tích: 0
  4. samspkt_9x New Member

    Số bài viết: 16
    Đã được thích: 0
    Điểm thành tích: 0
  5. FrozenHeart0705 New Member

    Số bài viết: 9
    Đã được thích: 0
    Điểm thành tích: 0
    Sửa nội dung code cũng không có gì là xấu lắm nhờ!
    Biết biến cái của người khác thành cái của riêng mình thì không có gì xấu cả!
    :D
  6. dragonck4 Member

    Số bài viết: 31
    Đã được thích: 0
    Điểm thành tích: 6
    bạn viết để điều khiển led ah?sao ko thấy bạn đưa mạch vậy?bạn có thể cho xem mạch để hiểu rõ hơn chương trình được ko?hjhjhj....
  7. small ant Well-Known Member

    Số bài viết: 2,827
    Đã được thích: 88
    Điểm thành tích: 48
    Giới tính: Nữ

Chia sẻ trang này