Thông báo

Collapse
No announcement yet.

Không xuat đúng Led

Collapse
X
 
  • Lọc
  • Giờ
  • Show
Clear All
new posts

  • Không xuat đúng Led

    Mình làm ma trận led dùng con 74ls595 cùng con 89c51 nhưng sao xuat ra thi không đúng
    Minh moi người giúp đỡ

    Mo Phổng http://www.mediafire.com/?lcjb10fa59q3afd

    Code
    org 0000h
    KD:mov p1,#00h
    mov dptr,#DL1
    ;=================================
    start:
    mov r2,#00h
    loop: mov r1,#30 ;tan so quet
    loop1: setb p2.0 ;du lieu vao 595
    mov r0,#00h
    call lap
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    djnz r1,loop1
    inc r2
    inc dptr
    cjne r2,#248,loop
    mov dptr,#DL2
    mov r2,#00h
    loop2: mov r1,#20 ;tan so quet
    loop3: setb p2.0 ;du lieu vao 595
    mov r0,#00h
    call lap
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    djnz r1,loop3
    inc r2
    inc dptr
    cjne r2,#240,loop2
    mov dptr,#DL2
    mov r2,#00h
    loop4: mov r1,#200 ;tan so quet
    loop5: setb p2.0 ;du lieu vao 595
    mov r0,#00h
    call lap
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    djnz r1,loop5
    inc r2
    inc dptr
    cjne r2,#48,loop4


    ljmp KD
    lap:
    setb p2.2;xung clock
    nop
    nop
    clr p2.2
    setb p2.1;xung chot
    clr p2.1;xung chot
    clr p2.0
    mov a,r0
    movc a,@a+dptr
    ; cpl a
    mov p1,a

    inc r0

    call doi
    mov p1,#00h

    cjne r0,#32,lap
    ret

    doi: mov 71h,#120
    djnz 71h,$
    ret
    ;;;;;;;;;;;;;;;;;

    DL1:
    DB 0FFH,0FFH,0FFH,0FFH,0C1H,0F7H,0F7H,0C1H,0FFH,0FFH, 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
    DL2:
    DB 52H,30H,10H,0H,7EH,8H,8H,7EH,0H,7EH,4AH,4AH,42H,0H ,0H,0H,0H,7EH,4AH,4AH,34H,0H,3CH,42H
    DB 42H,3CH,0H,7EH,4H,8H,4H,7EH,0H,3CH,42H,42H,3CH,0H, 7EH,8H,10H,7EH,0H,8H,7EH,4AH,42H,3CH
    DB 0H,42H,7EH,42H,0H,7EH,4AH,4AH,0H,7EH,8H,10H,7EH,0H ,8H,8H,8H,0H,0H,8H,7EH,4AH,42H,3CH
    DB 0H,42H,7EH,42H,0H,7EH,4AH,4AH,0H,7EH,4H,8H,7EH,0H, 2H,2H,7EH,2H,2H,0H,3EH,40H,40H,3EH
    DB 0H,0H,0H,0H,4CH,4AH,32H,0H,1EH,20H,40H,20H,1EH,0H, 2H,2H,7EH,2H,2H,0H,7EH,8H,8H,7EH
    DB 0H,3EH,40H,40H,3EH,0H,3CH,42H,42H,42H,0H,7EH,8H,8H ,7EH,0H,42H,7EH,42H,0H,7EH,4AH,4AH,0H
    DB 7EH,8H,10H,7EH,0H,24H,0H,8H,7EH,4AH,42H,3CH,0H,7CH ,12H,12H,7CH,0H,3CH,42H,42H,3CH,0H,42H
    DB 24H,18H,18H,24H,42H,0H,3EH,40H,40H,3EH,0H,7CH,12H, 12H,7CH,0H,7EH,4H,18H,7EH,0H,2H,2H,7EH
    DB 2H,2H,0H,7EH,8H,8H,7EH,0H,3EH,40H,40H,3EH,0H,2H,4H ,78H,4H,2H,0H,10H,10H,10H,0H,7EH
    DB 12H,12H,0CH,0H,7EH,8H,8H,7EH,0H,7CH,12H,12H,7CH,0H ,7EH,4H,8H,4H,7EH,0H,1EH,20H,40H,20H
    DL3:
    DB 1EH,0H,7CH,12H,12H,7CH,0H,7EH,4H,8H,7EH,0H,7EH,42H ,42H,3CH,0H,3EH,40H,40H,3EH,0H,7CH,12H
    DB 12H,7CH,0H,7EH,8H,10H,7EH,0H,0H,0H,0H,0H,0H,0H,0H, 0H,0H,0H,0H,0H,0H,0H,0H,0H

    DB 0H,7CH,12H,12H,7CH,0H,0H,7EH,4AH,4AH,3CH,0H,0H,3CH ,42H,42H,42H,0H,0H,7EH,42H,42H,3CH,0H
    DB 0H,7EH,4AH,4AH,4AH,0H,0H,7EH,0AH,0AH,0AH,0H,0H,3CH ,42H,52H,72H,10H,0H,0H,7EH,8H,8H,7EH
    DB 0H,0H,42H,7EH,42H,0H,0H,7EH,18H,24H,42H,0H,0H,7EH, 40H,40H,40H,0H,0H,7EH,4H,8H,4H,7EH
    DB 0H,0H,7EH,4H,8H,10H,7EH,0H,0H,3CH,42H,42H,3CH,0H,0 H,1EH,20H,40H,20H,1EH,0H,0H,7EH,2H
    DB 12H,12H,0CH,0H,0H,3CH,42H,42H,42H,3CH,40H,0H,0H,7E H,1AH,2AH,44H,0H,0H,2H,2H,7EH,2H,2H
    DB 0H,0H,2H,4H,78H,4H,2H,0H,0H,62H,14H,8H,14H,62H,0H, 0H,62H,52H,4AH,46H,0H,0H,2H,2H
    DB 42H,3EH,2H,0H,0H,40H,4CH,52H,22H,2H,0H,0H,0H,0H,0H ,0H,0H,0H,0H,0H,0H,0H,0H,0H
    end

    Mong mọi ngưởi chỉ bảo

  • #2
    bạn ơi cho lại cái file mô phỏng đi. file của bạn mở ko được

    Comment


    • #3
      đây nè mong moi người giúp đỡ em http://www.mediafire.com/?1fytpw8kpuqg0o1

      Comment


      • #4
        Nguyên văn bởi chang4mat Xem bài viết
        Mình làm ma trận led dùng con 74ls595 cùng con 89c51 nhưng sao xuat ra thi không đúng
        Minh moi người giúp đỡ

        Mo Phổng http://www.mediafire.com/?lcjb10fa59q3afd

        Code
        org 0000h
        KD:mov p1,#00h
        mov dptr,#DL1
        ;=================================
        start:
        mov r2,#00h
        loop: mov r1,#30 ;tan so quet
        loop1: setb p2.0 ;du lieu vao 595
        mov r0,#00h
        call lap
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        djnz r1,loop1
        inc r2
        inc dptr
        cjne r2,#248,loop
        mov dptr,#DL2
        mov r2,#00h
        loop2: mov r1,#20 ;tan so quet
        loop3: setb p2.0 ;du lieu vao 595
        mov r0,#00h
        call lap
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        djnz r1,loop3
        inc r2
        inc dptr
        cjne r2,#240,loop2
        mov dptr,#DL2
        mov r2,#00h
        loop4: mov r1,#200 ;tan so quet
        loop5: setb p2.0 ;du lieu vao 595
        mov r0,#00h
        call lap
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        djnz r1,loop5
        inc r2
        inc dptr
        cjne r2,#48,loop4


        ljmp KD
        lap:
        setb p2.2;xung clock
        nop
        nop
        clr p2.2
        setb p2.1;xung chot
        clr p2.1;xung chot
        clr p2.0
        mov a,r0
        movc a,@a+dptr
        ; cpl a
        mov p1,a

        inc r0

        call doi
        mov p1,#00h ;sửa thành mov p1,#0ffh

        cjne r0,#32,lap
        ret

        doi: mov 71h,#120
        djnz 71h,$
        ret
        ;;;;;;;;;;;;;;;;;

        DL1:
        DB 0FFH,0FFH,0FFH,0FFH,0C1H,0F7H,0F7H,0C1H,0FFH,0FFH, 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
        DL2:
        DB 52H,30H,10H,0H,7EH,8H,8H,7EH,0H,7EH,4AH,4AH,42H,0H ,0H,0H,0H,7EH,4AH,4AH,34H,0H,3CH,42H
        DB 42H,3CH,0H,7EH,4H,8H,4H,7EH,0H,3CH,42H,42H,3CH,0H, 7EH,8H,10H,7EH,0H,8H,7EH,4AH,42H,3CH
        DB 0H,42H,7EH,42H,0H,7EH,4AH,4AH,0H,7EH,8H,10H,7EH,0H ,8H,8H,8H,0H,0H,8H,7EH,4AH,42H,3CH
        DB 0H,42H,7EH,42H,0H,7EH,4AH,4AH,0H,7EH,4H,8H,7EH,0H, 2H,2H,7EH,2H,2H,0H,3EH,40H,40H,3EH
        DB 0H,0H,0H,0H,4CH,4AH,32H,0H,1EH,20H,40H,20H,1EH,0H, 2H,2H,7EH,2H,2H,0H,7EH,8H,8H,7EH
        DB 0H,3EH,40H,40H,3EH,0H,3CH,42H,42H,42H,0H,7EH,8H,8H ,7EH,0H,42H,7EH,42H,0H,7EH,4AH,4AH,0H
        DB 7EH,8H,10H,7EH,0H,24H,0H,8H,7EH,4AH,42H,3CH,0H,7CH ,12H,12H,7CH,0H,3CH,42H,42H,3CH,0H,42H
        DB 24H,18H,18H,24H,42H,0H,3EH,40H,40H,3EH,0H,7CH,12H, 12H,7CH,0H,7EH,4H,18H,7EH,0H,2H,2H,7EH
        DB 2H,2H,0H,7EH,8H,8H,7EH,0H,3EH,40H,40H,3EH,0H,2H,4H ,78H,4H,2H,0H,10H,10H,10H,0H,7EH
        DB 12H,12H,0CH,0H,7EH,8H,8H,7EH,0H,7CH,12H,12H,7CH,0H ,7EH,4H,8H,4H,7EH,0H,1EH,20H,40H,20H
        DL3:
        DB 1EH,0H,7CH,12H,12H,7CH,0H,7EH,4H,8H,7EH,0H,7EH,42H ,42H,3CH,0H,3EH,40H,40H,3EH,0H,7CH,12H
        DB 12H,7CH,0H,7EH,8H,10H,7EH,0H,0H,0H,0H,0H,0H,0H,0H, 0H,0H,0H,0H,0H,0H,0H,0H,0H

        DB 0H,7CH,12H,12H,7CH,0H,0H,7EH,4AH,4AH,3CH,0H,0H,3CH ,42H,42H,42H,0H,0H,7EH,42H,42H,3CH,0H
        DB 0H,7EH,4AH,4AH,4AH,0H,0H,7EH,0AH,0AH,0AH,0H,0H,3CH ,42H,52H,72H,10H,0H,0H,7EH,8H,8H,7EH
        DB 0H,0H,42H,7EH,42H,0H,0H,7EH,18H,24H,42H,0H,0H,7EH, 40H,40H,40H,0H,0H,7EH,4H,8H,4H,7EH
        DB 0H,0H,7EH,4H,8H,10H,7EH,0H,0H,3CH,42H,42H,3CH,0H,0 H,1EH,20H,40H,20H,1EH,0H,0H,7EH,2H
        DB 12H,12H,0CH,0H,0H,3CH,42H,42H,42H,3CH,40H,0H,0H,7E H,1AH,2AH,44H,0H,0H,2H,2H,7EH,2H,2H
        DB 0H,0H,2H,4H,78H,4H,2H,0H,0H,62H,14H,8H,14H,62H,0H, 0H,62H,52H,4AH,46H,0H,0H,2H,2H
        DB 42H,3EH,2H,0H,0H,40H,4CH,52H,22H,2H,0H,0H,0H,0H,0H ,0H,0H,0H,0H,0H,0H,0H,0H,0H
        end

        Mong mọi ngưởi chỉ bảo
        bạn chỉ cần sửa lại như trên là ok!

        Comment


        • #5
          cho mình hỏi them nếu muon tăng thêm led ma trận nửa thì code sửa làm sao

          Comment

          Về tác giả

          Collapse

          chang4mat Tìm hiểu thêm về chang4mat

          Bài viết mới nhất

          Collapse

          Đang tải...
          X