Thông báo

Collapse
No announcement yet.

điều khiển led đơn dùng 595

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

  • điều khiển led đơn dùng 595

    em tìm trên mạng được cái này dùng 595 để mở rộng chân ic. giờ e muốn gắn thêm mấy con 595 nữa thì sửa code như thê nào? mong anh chị giúp đỡ nhiều....
    đây là code dùng 4 con 595
    sh bit p2.0
    st bit p2.2
    da_ta bit p2.1

    org 0000h

    ljmp main

    org 30H
    main:
    clr sh
    clr st
    MOV R1,0 ; ma khoi dau
    MOV R2,#256 ; so bang ma
    MOV R3,#4 ; xuat 4 byte ra 4 con 595
    mov dptr,#mydata

    LOOP1: mov r4,#8 ; xuat 8 bit ra 595
    mov a,R1
    movc a,@a+dptr

    loop2:
    clr c
    rlc a
    mov da_ta,c
    setb sh
    clr sh
    djnz r4,loop2 ;dich 8 bit
    inc R1
    djnz r3,LOOP1 ;dich 4 byte
    setb st
    clr st
    lcall delay
    INC DPTR
    INC DPTR
    INC DPTR
    INC DPTR ;tang bang ma 4 lan
    djnz r2,LOOP1
    ljmp main

    ;=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

    delay:
    mov r7,#100
    d0: mov r6,#100
    here: NOP
    nop
    djnz r6,here
    djnz r7,d0
    ret

    ;=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

    org 300h
    mydata:
    db 00000000b,00000001b,10000000b,00000000b
    db 00000000b,00000010b,01000000b,00000000b
    db 00000000b,00000100b,00100000b,00000000b
    db 00000000b,00001000b,00010000b,00000000b
    db 00000000b,00010000b,00001000b,00000000b
    db 00000000b,00100000b,00000100b,00000000b
    db 00000000b,01000000b,00000010b,00000000b
    db 00000000b,10000000b,00000001b,00000000b
    db 00000001b,00000000b,00000000b,10000000b
    db 00000010b,00000000b,00000000b,01000000b
    db 00000100b,00000000b,00000000b,00100000b
    db 00001000b,00000000b,00000000b,00010000b
    db 00010000b,00000000b,00000000b,00001000b
    db 00100000b,00000000b,00000000b,00000100b
    db 01000000b,00000000b,00000000b,00000010b
    db 10000000b,00000000b,00000000b,00000001b
    db 10000000b,00000000b,00000000b,00000001b
    db 01000000b,00000000b,00000000b,00000010b
    db 00100000b,00000000b,00000000b,00000100b
    db 00010000b,00000000b,00000000b,00001000b
    db 00001000b,00000000b,00000000b,00010000b
    db 00000100b,00000000b,00000000b,00100000b
    db 00000010b,00000000b,00000000b,01000000b
    db 00000001b,00000000b,00000000b,10000000b
    db 00000000b,10000000b,00000001b,00000000b
    db 00000000b,01000000b,00000010b,00000000b
    db 00000000b,00100000b,00000100b,00000000b
    db 00000000b,00010000b,00001000b,00000000b
    db 00000000b,00001000b,00010000b,00000000b
    db 00000000b,00000100b,00100000b,00000000b
    db 00000000b,00000010b,01000000b,00000000b
    db 00000000b,00000001b,10000000b,00000000b ;1


    db 00000000b,00000001b,10000000b,00000000b
    db 00000000b,00000011b,11000000b,00000000b
    db 00000000b,00000111b,11100000b,00000000b
    db 00000000b,00001111b,11110000b,00000000b
    db 00000000b,00011111b,11111000b,00000000b
    db 00000000b,00111111b,11111100b,00000000b
    db 00000000b,01111111b,11111110b,00000000b
    db 00000000b,11111111b,11111111b,00000000b
    db 00000001b,11111111b,11111111b,10000000b
    db 00000011b,11111111b,11111111b,11000000b
    db 00000111b,11111111b,11111111b,11100000b
    db 00001111b,11111111b,11111111b,11110000b
    db 00011111b,11111111b,11111111b,11111000b
    db 00111111b,11111111b,11111111b,11111100b
    db 01111111b,11111111b,11111111b,11111110b
    db 11111111b,11111111b,11111111b,11111111b
    db 11111111b,11111111b,11111111b,11111111b
    db 01111111b,11111111b,11111111b,11111110b
    db 00111111b,11111111b,11111111b,11111100b
    db 00011111b,11111111b,11111111b,11111000b
    db 00001111b,11111111b,11111111b,11110000b
    db 00000111b,11111111b,11111111b,11100000b
    db 00000011b,11111111b,11111111b,11000000b
    db 00000001b,11111111b,11111111b,10000000b
    db 00000000b,11111111b,11111111b,00000000b
    db 00000000b,01111111b,11111110b,00000000b
    db 00000000b,00111111b,11111100b,00000000b
    db 00000000b,00011111b,11111000b,00000000b
    db 00000000b,00001111b,11110000b,00000000b
    db 00000000b,00000111b,11100000b,00000000b
    db 00000000b,00000011b,11000000b,00000000b
    db 00000000b,00000001b,10000000b,00000000b ;2

    db 11111111b,11111111b,11111111b,11111111b
    db 11111111b,11111110b,01111111b,11111111b
    db 11111111b,11111100b,00111111b,11111111b
    db 11111111b,11111000b,00011111b,11111111b
    db 11111111b,11110000b,00001111b,11111111b
    db 11111111b,11100000b,00000111b,11111111b
    db 11111111b,11000000b,00000011b,11111111b
    db 11111111b,10000000b,00000001b,11111111b
    db 11111111b,00000000b,00000000b,11111111b
    db 11111110b,00000000b,00000000b,01111111b
    db 11111100b,00000000b,00000000b,00111111b
    db 11111000b,00000000b,00000000b,00011111b
    db 11110000b,00000000b,00000000b,00001111b
    db 11100000b,00000000b,00000000b,00000111b
    db 11000000b,00000000b,00000000b,00000011b
    db 10000000b,00000000b,00000000b,00000001b
    db 10000000b,00000000b,00000000b,00000001b
    db 11000000b,00000000b,00000000b,00000011b
    db 11100000b,00000000b,00000000b,00000111b
    db 11110000b,00000000b,00000000b,00001111b
    db 11111000b,00000000b,00000000b,00011111b
    db 11111100b,00000000b,00000000b,00111111b
    db 11111110b,00000000b,00000000b,01111111b
    db 11111111b,00000000b,00000000b,11111111b
    db 11111111b,10000000b,00000001b,11111111b
    db 11111111b,01000000b,00000011b,11111111b
    db 11111111b,11100000b,00000111b,11111111b
    db 11111111b,11110000b,00001111b,11111111b
    db 11111111b,11111000b,00011111b,11111111b
    db 11111111b,11111100b,00111111b,11111111b
    db 11111111b,11111110b,01111111b,11111111b
    db 11111111b,11111111b,11111111b,11111111b ;3

    db 01111111b,11111111b,11111111b,11111110b
    db 00111111b,11111111b,11111111b,11111100b
    db 00011111b,11111111b,11111111b,11111000b
    db 00001111b,11111111b,11111111b,11110000b
    db 00000111b,11111111b,11111111b,11100000b
    db 00000011b,11111111b,11111111b,11000000b
    db 00000001b,11111111b,11111111b,10000000b
    db 00000000b,11111111b,11111111b,00000000b
    db 00000000b,01111111b,11111110b,00000000b
    db 00000000b,00111111b,11111100b,00000000b
    db 00000000b,00011111b,11111000b,00000000b
    db 00000000b,00001111b,11110000b,00000000b
    db 00000000b,00000111b,11100000b,00000000b
    db 00000000b,00000011b,11000000b,00000000b
    db 00000000b,00000001b,10000000b,00000000b
    db 00000000b,00000001b,10000000b,00000000b
    db 00000000b,00000011b,11000000b,00000000b
    db 00000000b,00000111b,11100000b,00000000b
    db 00000000b,00001111b,11110000b,00000000b
    db 00000000b,00011111b,11111000b,00000000b
    db 00000000b,00111111b,11111100b,00000000b
    db 00000000b,01111111b,11111110b,00000000b
    db 00000000b,11111111b,11111111b,00000000b
    db 00000001b,11111111b,11111111b,10000000b
    db 00000011b,11111111b,11111111b,11000000b
    db 00000111b,11111111b,11111111b,11100000b
    db 00001111b,11111111b,11111111b,11110000b
    db 00011111b,11111111b,11111111b,11111000b
    db 00111111b,11111111b,11111111b,11111100b
    db 01111111b,11111111b,11111111b,11111110b
    db 11111111b,11111111b,11111111b,11111111b
    db 11111111b,11111111b,11111111b,11111111b ;4

    db 10000000b,00000000b,00000000b,00000001b
    db 11000000b,00000000b,00000000b,00000011b
    db 11100000b,00000000b,00000000b,00000111b
    db 11110000b,00000000b,00000000b,00001111b
    db 11111000b,00000000b,00000000b,00011111b
    db 11111100b,00000000b,00000000b,00111111b
    db 11111110b,00000000b,00000000b,01111111b
    db 11111111b,00000000b,00000000b,11111111b
    db 11111111b,10000000b,00000001b,11111111b
    db 11111111b,11000000b,00000011b,11111111b
    db 11111111b,11100000b,00000111b,11111111b
    db 11111111b,11110000b,00001111b,11111111b
    db 11111111b,11111000b,00011111b,11111111b
    db 11111111b,11111100b,00111111b,11111111b
    db 11111111b,11111110b,01111111b,11111111b
    db 11111111b,11111111b,11111111b,11111111b
    db 11111111b,11111111b,11111111b,11111111b
    db 11111111b,11111110b,01111111b,11111111b
    db 11111111b,11111100b,00111111b,11111111b
    db 11111111b,11111000b,00011111b,11111111b
    db 11111111b,11110000b,00001111b,11111111b
    db 11111111b,11100000b,00000111b,11111111b
    db 11111111b,11000000b,00000011b,11111111b
    db 11111111b,10000000b,00000001b,11111111b
    db 11111111b,00000000b,00000000b,11111111b
    db 11111110b,00000000b,00000000b,01111111b
    db 11111100b,00000000b,00000000b,00111111b
    db 11111000b,00000000b,00000000b,00011111b
    db 11110000b,00000000b,00000000b,00001111b
    db 11100000b,00000000b,00000000b,00000111b
    db 11000000b,00000000b,00000000b,00000011b
    db 10000000b,00000000b,00000000b,00000001b ;5



    db 10000000b,00000000b,00000000b,00000000b
    db 01000000b,00000000b,00000000b,00000000b
    db 00100000b,00000000b,00000000b,00000000b
    db 00010000b,00000000b,00000000b,00000000b
    db 00001000b,00000000b,00000000b,00000000b
    db 00000100b,00000000b,00000000b,00000000b
    db 00000010b,00000000b,00000000b,00000000b
    db 00000001b,00000000b,00000000b,00000000b
    db 00000000b,10000000b,00000000b,00000000b
    db 00000000b,01000000b,00000000b,00000000b
    db 00000000b,00100000b,00000000b,00000000b
    db 00000000b,00010000b,00000000b,00000000b
    db 00000000b,00001000b,00000000b,00000000b
    db 00000000b,00000100b,00000000b,00000000b
    db 00000000b,00000010b,00000000b,00000000b
    db 00000000b,00000001b,00000000b,00000000b
    db 00000000b,00000000b,10000000b,00000000b
    db 00000000b,00000000b,01000000b,00000000b
    db 00000000b,00000000b,00100000b,00000000b
    db 00000000b,00000000b,00010000b,00000000b
    db 00000000b,00000000b,00001000b,00000000b
    db 00000000b,00000000b,00000100b,00000000b
    db 00000000b,00000000b,00000010b,00000000b
    db 00000000b,00000000b,00000001b,00000000b
    db 00000000b,00000000b,00000000b,10000000b
    db 00000000b,00000000b,00000000b,01000000b
    db 00000000b,00000000b,00000000b,00100000b
    db 00000000b,00000000b,00000000b,00010000b
    db 00000000b,00000000b,00000000b,00001000b
    db 00000000b,00000000b,00000000b,00000100b
    db 00000000b,00000000b,00000000b,00000010b
    db 00000000b,00000000b,00000000b,00000001b ;6

    db 00000000b,00000000b,00000000b,00000001b
    db 00000000b,00000000b,00000000b,00000010b
    db 00000000b,00000000b,00000000b,00000100b
    db 00000000b,00000000b,00000000b,00001000b
    db 00000000b,00000000b,00000000b,00010000b
    db 00000000b,00000000b,00000000b,00100000b
    db 00000000b,00000000b,00000000b,01000000b
    db 00000000b,00000000b,00000000b,10000000b
    db 00000000b,00000000b,00000001b,00000000b
    db 00000000b,00000000b,00000010b,00000000b
    db 00000000b,00000000b,00000100b,00000000b
    db 00000000b,00000000b,00001000b,00000000b
    db 00000000b,00000000b,00010000b,00000000b
    db 00000000b,00000000b,00100000b,00000000b
    db 00000000b,00000000b,01000000b,00000000b
    db 00000000b,00000000b,10000000b,00000000b
    db 00000000b,00000001b,00000000b,00000000b
    db 00000000b,00000010b,00000000b,00000000b
    db 00000000b,00000100b,00000000b,00000000b
    db 00000000b,00001000b,00000000b,00000000b
    db 00000000b,00010000b,00000000b,00000000b
    db 00000000b,00100000b,00000000b,00000000b
    db 00000000b,01000000b,00000000b,00000000b
    db 00000000b,10000000b,00000000b,00000000b
    db 00000001b,00000000b,00000000b,00000000b
    db 00000010b,00000000b,00000000b,00000000b
    db 00000100b,00000000b,00000000b,00000000b
    db 00001000b,00000000b,00000000b,00000000b
    db 00010000b,00000000b,00000000b,00000000b
    db 00100000b,00000000b,00000000b,00000000b
    db 01000000b,00000000b,00000000b,00000000b
    db 10000000b,00000000b,00000000b,00000000b ;7

    db 00000000b,00000000b,00000000b,00000000b
    db 00000000b,00000000b,00000000b,00000000b
    db 00000000b,00000000b,00000000b,00000000b
    db 00000000b,00000000b,00000000b,00000000b
    db 11111111b,11111111b,11111111b,11111111b
    db 11111111b,11111111b,11111111b,11111111b
    db 11111111b,11111111b,11111111b,11111111b
    db 11111111b,11111111b,11111111b,11111111b
    db 00000000b,00000000b,00000000b,00000000b
    db 00000000b,00000000b,00000000b,00000000b
    db 00000000b,00000000b,00000000b,00000000b
    db 00000000b,00000000b,00000000b,00000000b
    db 11111111b,11111111b,11111111b,11111111b
    db 11111111b,11111111b,11111111b,11111111b
    db 11111111b,11111111b,11111111b,11111111b
    db 11111111b,11111111b,11111111b,11111111b
    db 00000000b,00000000b,00000000b,00000000b
    db 00000000b,00000000b,00000000b,00000000b
    db 00000000b,00000000b,00000000b,00000000b
    db 00000000b,00000000b,00000000b,00000000b
    db 11111111b,11111111b,11111111b,11111111b
    db 11111111b,11111111b,11111111b,11111111b
    db 11111111b,11111111b,11111111b,11111111b
    db 11111111b,11111111b,11111111b,11111111b
    db 00000000b,00000000b,00000000b,00000000b
    db 00000000b,00000000b,00000000b,00000000b
    db 00000000b,00000000b,00000000b,00000000b
    db 00000000b,00000000b,00000000b,00000000b
    db 11111111b,11111111b,11111111b,11111111b
    db 11111111b,11111111b,11111111b,11111111b
    db 11111111b,11111111b,11111111b,11111111b
    db 11111111b,11111111b,11111111b,11111111b ;8


    ;=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+


    end


    Click image for larger version

Name:	Untitled.jpg
Views:	1
Size:	122.5 KB
ID:	1415082

  • #2
    bạn xem thêm cái này dùng cho 5 con 595 nhé , nhiều hơn thì tương tự : 595

    Phần data mình thêm 1 ít ở bên trên , bạn thêm vào bên dưới nhé

    Comment


    • #3
      mov r3,#4, giờ mún thêm mấy con, thì tăng thêm bấy nhiu
      không tiếp nhận cuộc gọi qua điện thoại vì đi làm toàn tập, tính khí thất thường, hay nóng võ công lại cao

      Comment


      • #4
        cảm ơn các anh nha....chạy được rồi. a có thể cho e cái yahoo hay facebook hoặc mail được không? khi nào gặp rắc rối thì gỡ rối giúp em.
        e chưa được học môn vvi điều khiển nên chưa biết gì cả.

        Comment


        • #5
          giờ e muốn dùng thêm port khác để điều khiển mấy con 595 khác thì phải khai báo và sửa đợn 010110 như thế nào?

          Comment


          • #6
            Phài có mục đích, mới làm, nói như vậy, ko ai hiểu, nên ko thể giúp dc, phải cụ thể
            không tiếp nhận cuộc gọi qua điện thoại vì đi làm toàn tập, tính khí thất thường, hay nóng võ công lại cao

            Comment


            • #7
              e muốn làm 1 bảng led khoảng 500 con led đơn. có 200 con led chạy viền và 300 con led chạy hình trái tim với chạy chữ. giờ e muốn dùng 1 cổng điều khiển led viền, 1 cổng điều khiên led trái tim và 1 cổng điều khiển chữ. với code như trên thì mình khai báo để dùng cổng khác như thế nào? e dùng 89c51 và 74hc595

              Comment

              Về tác giả

              Collapse

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

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

              Collapse

              Đang tải...
              X