Thông báo

Collapse
No announcement yet.

89C52_LED TRÁI TIM 32LED 2 Màu + 74HC595

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

  • 89C52_LED TRÁI TIM 32LED 2 Màu + 74HC595

    Em Muốn làm một mạch như trên, không biết có khả thì không các anh? E mới làm quen với vi điều khiển nên bỡ ngỡ quá. Mong đc cái anh hướng dẫn! tiện thể, a nào có code asm 32 led đơn( và code led sáng kiểu sao băng nữa) cho e xin, e tập làm quen! Cảm ơn mọi người nhiều!

  • #2

    asm
    MAIN:
    LCALL SANGTAT
    LCALL SANGDANTATDAN
    LCALL SANGDANTATLUI
    LCALL LEDCHAYKIEU1
    LCALL LEDCHAYKIEU2
    LCALL LEDCHAYKIEU3
    LCALL LEDCHAYKIEU4

    LJMP MAIN

    SANGTAT:

    MOV R0,#5

    L1: MOV P0,#0FFH
    MOV P2,#0FFH
    MOV P3,#0FFH
    MOV P1,#0FFH
    LCALL DELAY
    LCALL DELAY
    LCALL DELAY
    LCALL DELAY
    LCALL DELAY
    MOV P0,#00H
    MOV P2,#00H
    MOV P3,#00H
    MOV P1,#00H
    LCALL DELAY
    LCALL DELAY
    LCALL DELAY
    LCALL DELAY
    LCALL DELAY
    MOV P0,#0AAH
    MOV P2,#0AAH
    MOV P3,#0AAH
    MOV P1,#0AAH
    LCALL DELAY
    LCALL DELAY
    LCALL DELAY
    LCALL DELAY
    LCALL DELAY
    MOV P0,#55H
    MOV P2,#55H
    MOV P3,#55H
    MOV P1,#55H
    LCALL DELAY
    LCALL DELAY
    LCALL DELAY
    DJNZ R0,L1
    RET

    SANGDANTATDAN:

    MOV P0,#0FFH
    MOV P2,#0FFH
    MOV P3,#0FFH
    MOV P1,#0FFH
    MOV R2,#0FFH

    B1:
    CLR C
    MOV A,R2
    RLC A
    MOV R2,A
    MOV P0,R2
    LCALL DELAY
    MOV P1,R2
    JC B1


    MOV P2,#0FFH
    MOV P3,#0FFH
    MOV R2,#0FFH

    B11: CLR C
    MOV A,R2
    RLC A
    MOV R2,A
    MOV P2,R2
    LCALL DELAY
    MOV P2,R2
    JC B11


    B2: SETB C
    MOV A,R2
    RLC A
    MOV R2,A
    MOV P0,R2
    LCALL DELAY
    MOV P1,R2
    JNC B2

    MOV P2,#00H
    MOV P3,#00H
    MOV R2,#00H

    B22: SETB C
    MOV A,R2
    RLC A
    MOV R2,A
    MOV P2,R2
    LCALL DELAY
    MOV P3,R2
    JNC B22
    RET

    SANGDANTATLUI:
    MOV P0,#0FFH
    MOV P2,#0FFH
    MOV P3,#0FFH
    MOV P1,#0FFH
    MOV R2,#0FFH

    B3:
    CLR C
    MOV A,R2
    RLC A
    MOV R2,A
    MOV P0,R2
    LCALL DELAY
    MOV P1,R2
    JC B3


    MOV P2,#0FFH
    MOV P3,#0FFH
    MOV R2,#0FFH

    B33: CLR C
    MOV A,R2
    RLC A
    MOV R2,A
    MOV P2,R2
    LCALL DELAY
    MOV P3,R2
    JC B33


    B4: SETB C
    MOV A,R2
    RRC A
    MOV R2,A
    MOV P3,R2
    LCALL DELAY
    MOV P2,R2
    JNC B4

    MOV P0,#00H
    MOV P1,#00H
    MOV R2,#00H

    B44: SETB C
    MOV A,R2
    RRC A
    MOV R2,A
    MOV P1,R2
    LCALL DELAY
    MOV P0,R2
    JNC B44
    RET


    LEDCHAYKIEU1:

    MOV P0,#0FFH
    MOV P2,#0FFH
    MOV P3,#0FFH
    MOV P1,#0FFH


    MOV P0,#11111110B
    MOV P3,#01111111B
    LCALL DELAY

    MOV P0,#11111101B
    MOV P3,#10111111B
    LCALL DELAY

    MOV P0,#11111011B
    MOV P3,#11011111B
    LCALL DELAY

    MOV P0,#11110111B
    MOV P3,#11101111B
    LCALL DELAY

    MOV P0,#11101111B
    MOV P3,#11110111B
    LCALL DELAY

    MOV P0,#11011111B
    MOV P3,#11111011B
    LCALL DELAY

    MOV P0,#10111111B
    MOV P3,#11111101B
    LCALL DELAY

    MOV P0,#01111111B
    MOV P3,#11111110B
    LCALL DELAY


    MOV P0,#0FFH
    MOV P3,#0FFH

    MOV P1,#11111110B
    MOV P3,#01111111B
    LCALL DELAY

    MOV P2,#11111101B
    MOV P1,#10111111B
    LCALL DELAY

    MOV P2,#11111011B
    MOV P1,#11011111B
    LCALL DELAY

    MOV P2,#11110111B
    MOV P1,#11101111B
    LCALL DELAY

    MOV P2,#11101111B
    MOV P1,#11110111B
    LCALL DELAY

    MOV P2,#11011111B
    MOV P1,#11111011B
    LCALL DELAY

    MOV P2,#10111111B
    MOV P1,#11111101B
    LCALL DELAY

    MOV P2,#01111111B
    MOV P1,#11111110B
    LCALL DELAY
    RET
    LEDCHAYKIEU2:

    MOV P0,#0FFH
    MOV P2,#0FFH
    MOV P3,#0FFH
    MOV P1,#0FFH

    MOV P0,#11111100B
    MOV P3,#00111111B
    LCALL DELAY

    MOV P0,#11111001B
    MOV P3,#10011111B
    LCALL DELAY

    MOV P0,#11110011B
    MOV P3,#11001111B
    LCALL DELAY

    MOV P0,#11100111B
    MOV P3,#11100111B
    LCALL DELAY

    MOV P0,#11001111B
    MOV P3,#11110011B
    LCALL DELAY

    MOV P0,#10011111B
    MOV P3,#11111001B
    LCALL DELAY

    MOV P0,#00111111B
    MOV P3,#11111100B
    LCALL DELAY

    MOV P0,#01111111B
    MOV P3,#11111110B
    MOV P2,#11111110B
    MOV P3,#01111111B
    LCALL DELAY


    MOV P0,#0FFH
    MOV P3,#0FFH

    MOV P2,#11111100B
    MOV P1,#00111111B
    LCALL DELAY

    MOV P2,#11111001B
    MOV P3,#10011111B
    LCALL DELAY

    MOV P2,#11110011B
    MOV P1,#11001111B
    LCALL DELAY

    MOV P2,#11100111B
    MOV P1,#11100111B
    LCALL DELAY

    MOV P2,#11001111B
    MOV P1,#11110011B
    LCALL DELAY

    MOV P2,#10011111B
    MOV P1,#11111001B
    LCALL DELAY

    MOV P2,#00111111B
    MOV P1,#11111100B
    LCALL DELAY

    MOV P2,#01111111B
    MOV P1,#11111110B
    LCALL DELAY

    MOV P2,#11111111B
    MOV P1,#11111111B
    LCALL DELAY
    RET

    LEDCHAYKIEU3:

    MOV P0,#0FFH
    MOV P2,#0FFH
    MOV P3,#0FFH
    MOV P1,#0FFH

    MOV P0,#11111000B
    MOV P3,#00011111B
    LCALL DELAY

    MOV P0,#11110001B
    MOV P3,#10001111B
    LCALL DELAY

    MOV P0,#11100011B
    MOV P2,#11000111B
    LCALL DELAY

    MOV P0,#11000111B
    MOV P3,#11100011B
    LCALL DELAY

    MOV P0,#10001111B
    MOV P3,#11110001B
    LCALL DELAY

    MOV P0,#00011111B
    MOV P3,#11111000B
    LCALL DELAY

    MOV P0,#00111111B
    MOV P3,#11111100B
    MOV P2,#11111110B
    MOV P1,#01111111B
    LCALL DELAY


    MOV P0,#01111111B
    MOV P3,#11111110B
    MOV P2,#11111100B
    MOV P1,#00111111B
    LCALL DELAY

    MOV P0,#0FFH
    MOV P3,#0FFH



    MOV P2,#11111100B
    MOV P1,#00111111B
    LCALL DELAY

    MOV P2,#11111000B
    MOV P1,#00011111B
    LCALL DELAY

    MOV P2,#11110001B
    MOV P1,#10001111B
    LCALL DELAY

    MOV P2,#11100011B
    MOV P1,#11000111B
    LCALL DELAY

    MOV P2,#11000111B
    MOV P1,#11100011B
    LCALL DELAY

    MOV P2,#10001111B
    MOV P1,#11110001B
    LCALL DELAY

    MOV P2,#00011111B
    MOV P1,#11111000B
    LCALL DELAY

    MOV P2,#00111111B
    MOV P1,#11111100B
    LCALL DELAY

    MOV P2,#01111111B
    MOV P1,#11111110B
    LCALL DELAY

    MOV P2,#11111111B
    MOV P1,#11111111B
    LCALL DELAY
    RET


    LEDCHAYKIEU4:

    MOV P0,#0FFH
    MOV P2,#0FFH
    MOV P3,#0FFH
    MOV P1,#0FFH

    MOV P0,#11111110B
    MOV P3,#01111111B
    LCALL DELAY

    MOV P0,#11111100B
    MOV P3,#00111111B
    LCALL DELAY

    MOV P0,#11111000B
    MOV P3,#00011111B
    LCALL DELAY

    MOV P0,#11110000B
    MOV P3,#00001111B
    LCALL DELAY

    MOV P0,#11100001B
    MOV P3,#10000111B
    LCALL DELAY

    MOV P0,#11000011B
    MOV P3,#11000011B
    LCALL DELAY

    MOV P0,#10000111B
    MOV P3,#11100001B
    LCALL DELAY

    MOV P0,#00001111B
    MOV P3,#11110000B
    LCALL DELAY

    MOV P0,#00011111B
    MOV P3,#11111000B
    MOV P2,#11111110B
    MOV P1,#01111111B
    LCALL DELAY


    MOV P0,#00111111B
    MOV P3,#11111100B
    MOV P2,#11111100B
    MOV P1,#00111111B
    LCALL DELAY

    MOV P0,#01111111B
    MOV P3,#11111110B
    MOV P2,#11111000B
    MOV P1,#00011111B
    LCALL DELAY


    MOV P0,#0FFH
    MOV P3,#0FFH



    MOV P2,#11110000B
    MOV P1,#00001111B
    LCALL DELAY

    MOV P2,#11100001B
    MOV P1,#10000111B
    LCALL DELAY

    MOV P2,#11000011B
    MOV P1,#11000011B
    LCALL DELAY

    MOV P2,#10000111B
    MOV P1,#11100001B
    LCALL DELAY

    MOV P2,#00001111B
    MOV P1,#11110000B
    LCALL DELAY

    MOV P2,#00011111B
    MOV P1,#11111000B
    LCALL DELAY

    MOV P2,#00111111B
    MOV P1,#11111100B
    LCALL DELAY

    MOV P2,#01111111B
    MOV P1,#11111110B
    LCALL DELAY

    MOV P2,#11111111B
    MOV P1,#11111111B
    LCALL DELAY
    RET



    DELAY: MOV R6,#0FFH
    LAP1: MOV R7,#70H
    LAP2: DJNZ R7,LAP2
    DJNZ R6,LAP1
    RET
    END

    Comment


    • #3
      cảm ơn anh nhiều ! Mong anh cho e hướng đi với đề tài trên được không ah?

      Comment


      • #4
        Mình có 4 kiểu chớp:
        ;************************
        Title: LED
        Author: Sang Thái - Thiết kế mạch điện tử
        Language: ASM
        Complier: SPKT_C
        Microcontroller: AT89S52
        ;************************
        ORG 000H
        TD: CALL KIEU1
        CALL KIEU2
        CALL KIEU3
        CALL KIEU4
        JMP TD
        ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        KIEU1:
        m1 EQU 30H
        BTG1 EQU 31H
        SCK EQU 32H
        SLXA EQU 33H
        m2 EQU 34H
        BTG2 EQU 35H
        m3 EQU 36H
        BTG3 EQU 37H
        m4 EQU 38H
        BTG4 EQU 39H
        CO BIT 20H.0

        SETB CO
        MOV P0,#0
        MOV P1,#0
        MOV P2,#0
        MOV P3,#0
        MOV SCK,#32
        MOV m1,#0
        MOV m2,#0
        MOV m3,#0
        MOV m4,#0
        MOV BTG1,#00H
        MOV BTG2,#00H
        MOV BTG3,#00H
        MOV BTG4,#00H
        SETB C
        LB2: MOV SLXA,SCK
        LB1: JNB CO,LB3
        MOV A,BTG1
        RLC A
        MOV BTG1,A

        MOV A,BTG2
        RLC A
        MOV BTG2,A

        MOV A,BTG3
        RLC A
        MOV BTG3,A

        MOV A,BTG4
        RLC A
        MOV BTG4,A
        JMP LB4
        LB3:
        MOV A,BTG4
        RRC A
        MOV BTG4,A

        MOV A,BTG3
        RRC A
        MOV BTG3,A

        MOV A,BTG2
        RRC A
        MOV BTG2,A

        MOV A,BTG1
        RRC A
        MOV BTG1,A

        LB4: MOV A,BTG1
        ORL A,m1
        MOV P0,A

        MOV A,BTG2
        ORL A,m2
        MOV P1,A

        MOV A,BTG3
        ORL A,m3
        MOV P2,A

        MOV A,BTG4
        ORL A,m4
        MOV P3,A

        CALL DELAY
        DJNZ SLXA,LB1
        MOV m1,P0
        MOV m2,P1
        MOV m3,P2
        MOV m4,P3
        CPL CO
        DJNZ SCK,LB2
        RET
        ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        KIEU2:
        X0 EQU 40H
        Y0 EQU 41H
        Z0 EQU 42H
        X1 EQU 43H
        Y1 EQU 44H
        Z1 EQU 45H
        X2 EQU 46H
        Y2 EQU 47H
        Z2 EQU 48H
        X3 EQU 49H
        Y3 EQU 4AH
        Z3 EQU 4BH
        BDEM EQU 4CH

        MOV P0,#0FFH
        MOV P1,#0FFH
        MOV P2,#0FFH
        MOV P3,#0FFH
        MOV X0,#0FEH
        MOV Y0,#01H
        MOV X1,#0FFH
        MOV Y1,#00H
        MOV X2,#0FFH
        MOV Y2,#00H
        MOV X3,#0FFH
        MOV Y3,#00H

        MOV BDEM,#32
        LB6: MOV Z0,Y0
        MOV Z1,Y1
        MOV Z2,Y2
        MOV Z3,Y3
        LB5: CALL XPHAI_Z
        CALL OR_X_Z
        CALL DELAY
        JNC LB5
        CALL XTRAI_X
        CALL XTRAI_Y
        DJNZ BDEM,LB6
        RET
        ;**************************************
        XPHAI_Z:
        CLR C
        MOV A,Z3
        RRC A
        MOV Z3,A

        MOV A,Z2
        RRC A
        MOV Z2,A

        MOV A,Z1
        RRC A
        MOV Z1,A

        MOV A,Z0
        RRC A
        MOV Z0,A
        RET
        ;**************************************
        XTRAI_X:
        CLR C
        MOV A,X0
        RLC A
        MOV X0,A

        MOV A,X1
        RLC A
        MOV X1,A

        MOV A,X2
        RLC A
        MOV X2,A

        MOV A,X3
        RLC A
        MOV X3,A
        RET
        ;**************************************
        XTRAI_Y:
        CLR C
        MOV A,Y0
        RLC A
        MOV Y0,A

        MOV A,Y1
        RLC A
        MOV Y1,A

        MOV A,Y2
        RLC A
        MOV Y2,A

        MOV A,Y3
        RLC A
        MOV Y3,A
        RET
        ;**************************************
        OR_X_Z:
        MOV A,X0
        ORL A,Z0
        MOV P0,A

        MOV A,X1
        ORL A,Z1
        MOV P1,A

        MOV A,X2
        ORL A,Z2
        MOV P2,A

        MOV A,X3
        ORL A,Z3
        MOV P3,A
        RET
        ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        KIEU3:
        MOV P0,#0
        MOV P1,#0
        MOV P2,#0
        MOV P3,#0

        MOV 50H,#32 ;SANG DAN
        LB7: SETB C
        MOV A,P0
        RLC A
        MOV P0,A

        MOV A,P1
        RLC A
        MOV P1,A

        MOV A,P2
        RLC A
        MOV P2,A

        MOV A,P3
        RLC A
        MOV P3,A
        CALL DELAY
        CALL DELAY
        DJNZ 50H,LB7
        ;************************************************T AT DAN
        MOV 50H,#32
        LB8: CLR C
        MOV A,P3
        RRC A
        MOV P3,A

        MOV A,P2
        RRC A
        MOV P2,A

        MOV A,P1
        RRC A
        MOV P1,A

        MOV A,P0
        RRC A
        MOV P0,A
        CALL DELAY
        CALL DELAY
        DJNZ 50H,LB8
        RET
        ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        KIEU4:
        MOV P0,#0FFH
        MOV P1,#0FFH
        MOV P2,#0FFH
        MOV P3,#0FFH
        MOV X0,#01H
        MOV X1,#00H
        MOV X2,#00H
        MOV X3,#00H

        MOV Y0,#0FEH
        MOV Y1,#0FFH
        MOV Y2,#0FFH
        MOV Y3,#0FFH

        MOV BDEM,#32
        LB10: MOV Z0,Y0
        MOV Z1,Y1
        MOV Z2,Y2
        MOV Z3,Y3
        LB9: CALL XOAYPHAI_Z
        CALL AND_X_Z
        CALL DELAY
        JNC LB9
        CALL XTRAI_X
        CALL XTRAI_Y
        DJNZ BDEM,LB10
        RET
        ;**************************************
        XOAYPHAI_Z:
        SETB C
        MOV A,Z3
        RRC A
        MOV Z3,A

        MOV A,Z2
        RRC A
        MOV Z2,A

        MOV A,Z1
        RRC A
        MOV Z1,A

        MOV A,Z0
        RLC A
        MOV Z0,A
        RET
        ;**************************************
        AND_X_Z:
        MOV A,X0
        ANL A,Z0
        MOV P0,A

        MOV A,X1
        ANL A,Z1
        MOV P1,A

        MOV A,X2
        ANL A,Z2
        MOV P2,A

        MOV A,X3
        ANL A,Z3
        MOV P3,A
        RET
        ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        DELAY:
        MOV R6,#50
        DEL: MOV R7,#0FFH
        DJNZ R7,$
        DJNZ R6,DEL
        RET
        END

        Comment


        • #5
          trái tim đẹp đấy nhưng sao nhìu hiệu ứng wak vậy
          ....!!!... Cơm cha, áo mẹ, chữ thầy. Cố gắng mà học cho thành công danh ...!!!...

          Comment


          • #6
            dân điện tử cho mail để liên lạc hey nguyenngoctuan1908@yahoo.com.vn
            có mạch trái tim ne! anh em tham khảo.vẽ bằng orcad. liên hệ với email mình mình gửi cho.vì ko gửi lên đây được.thông cảm hey. sử dụng ic89c51

            Comment


            • #7
              còn về vấn đề dung 74HC595 thì sao các anh ?

              Comment


              • #8
                Nguyên văn bởi tranvanhung Xem bài viết
                còn về vấn đề dung 74HC595 thì sao các anh ?
                bạn hỏi gì về 74595
                IC ghi dịch 74HC595 - IC ghi dich 74HC595 - MachDienTu.Net - Mạch điện tử ứng dụng | mạch điện tử lý thú | led trái tim | led cube |khoa học - công nghệ ...

                Comment


                • #9
                  trái tim89c51
                  89c51

                  Comment


                  • #10
                    anh em ai có đề tài nào hay không?

                    Comment


                    • #11
                      Nguyên văn bởi boychjpcoj Xem bài viết
                      anh em ai có đề tài nào hay không?
                      đề nghị bạn ko spam kiểu thế này nhé. Diễn đàn ko giống các diễn đàn tuổi 9x đâu.

                      Comment


                      • #12
                        cui

                        trái tim 32bit wa cùi. cùi đến nỗi ko thể ta

                        Comment


                        • #13
                          cái led này đẹp quá .mình cũng đang định làm nhưng khó quá

                          Comment


                          • #14
                            Nguyên văn bởi boychjpcoj anh em ai có đề tài nào hay không?



                            đề nghị bạn ko spam kiểu thế này nhé. Diễn đàn ko giống các diễn đàn tuổi 9x đâu.
                            em nói thiếu .anh em ai có đề tài về tốt nghiệp nghành điện tử nào hay không? gợi ý em với!?!

                            Comment


                            • #15
                              Nguyên văn bởi boychjpcoj Xem bài viết

                              asm
                              MAIN:
                              LCALL SANGTAT
                              LCALL SANGDANTATDAN
                              LCALL SANGDANTATLUI
                              LCALL LEDCHAYKIEU1
                              LCALL LEDCHAYKIEU2
                              LCALL LEDCHAYKIEU3
                              LCALL LEDCHAYKIEU4

                              LJMP MAIN

                              SANGTAT:

                              MOV R0,#5

                              L1: MOV P0,#0FFH
                              MOV P2,#0FFH
                              MOV P3,#0FFH
                              MOV P1,#0FFH
                              LCALL DELAY
                              LCALL DELAY
                              LCALL DELAY
                              LCALL DELAY
                              LCALL DELAY
                              MOV P0,#00H
                              MOV P2,#00H
                              MOV P3,#00H
                              MOV P1,#00H
                              LCALL DELAY
                              LCALL DELAY
                              LCALL DELAY
                              LCALL DELAY
                              LCALL DELAY
                              MOV P0,#0AAH
                              MOV P2,#0AAH
                              MOV P3,#0AAH
                              MOV P1,#0AAH
                              LCALL DELAY
                              LCALL DELAY
                              LCALL DELAY
                              LCALL DELAY
                              LCALL DELAY
                              MOV P0,#55H
                              MOV P2,#55H
                              MOV P3,#55H
                              MOV P1,#55H
                              LCALL DELAY
                              LCALL DELAY
                              LCALL DELAY
                              DJNZ R0,L1
                              RET

                              SANGDANTATDAN:

                              MOV P0,#0FFH
                              MOV P2,#0FFH
                              MOV P3,#0FFH
                              MOV P1,#0FFH
                              MOV R2,#0FFH

                              B1:
                              CLR C
                              MOV A,R2
                              RLC A
                              MOV R2,A
                              MOV P0,R2
                              LCALL DELAY
                              MOV P1,R2
                              JC B1


                              MOV P2,#0FFH
                              MOV P3,#0FFH
                              MOV R2,#0FFH

                              B11: CLR C
                              MOV A,R2
                              RLC A
                              MOV R2,A
                              MOV P2,R2
                              LCALL DELAY
                              MOV P2,R2
                              JC B11


                              B2: SETB C
                              MOV A,R2
                              RLC A
                              MOV R2,A
                              MOV P0,R2
                              LCALL DELAY
                              MOV P1,R2
                              JNC B2

                              MOV P2,#00H
                              MOV P3,#00H
                              MOV R2,#00H

                              B22: SETB C
                              MOV A,R2
                              RLC A
                              MOV R2,A
                              MOV P2,R2
                              LCALL DELAY
                              MOV P3,R2
                              JNC B22
                              RET

                              SANGDANTATLUI:
                              MOV P0,#0FFH
                              MOV P2,#0FFH
                              MOV P3,#0FFH
                              MOV P1,#0FFH
                              MOV R2,#0FFH

                              B3:
                              CLR C
                              MOV A,R2
                              RLC A
                              MOV R2,A
                              MOV P0,R2
                              LCALL DELAY
                              MOV P1,R2
                              JC B3


                              MOV P2,#0FFH
                              MOV P3,#0FFH
                              MOV R2,#0FFH

                              B33: CLR C
                              MOV A,R2
                              RLC A
                              MOV R2,A
                              MOV P2,R2
                              LCALL DELAY
                              MOV P3,R2
                              JC B33


                              B4: SETB C
                              MOV A,R2
                              RRC A
                              MOV R2,A
                              MOV P3,R2
                              LCALL DELAY
                              MOV P2,R2
                              JNC B4

                              MOV P0,#00H
                              MOV P1,#00H
                              MOV R2,#00H

                              B44: SETB C
                              MOV A,R2
                              RRC A
                              MOV R2,A
                              MOV P1,R2
                              LCALL DELAY
                              MOV P0,R2
                              JNC B44
                              RET


                              LEDCHAYKIEU1:

                              MOV P0,#0FFH
                              MOV P2,#0FFH
                              MOV P3,#0FFH
                              MOV P1,#0FFH


                              MOV P0,#11111110B
                              MOV P3,#01111111B
                              LCALL DELAY

                              MOV P0,#11111101B
                              MOV P3,#10111111B
                              LCALL DELAY

                              MOV P0,#11111011B
                              MOV P3,#11011111B
                              LCALL DELAY

                              MOV P0,#11110111B
                              MOV P3,#11101111B
                              LCALL DELAY

                              MOV P0,#11101111B
                              MOV P3,#11110111B
                              LCALL DELAY

                              MOV P0,#11011111B
                              MOV P3,#11111011B
                              LCALL DELAY

                              MOV P0,#10111111B
                              MOV P3,#11111101B
                              LCALL DELAY

                              MOV P0,#01111111B
                              MOV P3,#11111110B
                              LCALL DELAY


                              MOV P0,#0FFH
                              MOV P3,#0FFH

                              MOV P1,#11111110B
                              MOV P3,#01111111B
                              LCALL DELAY

                              MOV P2,#11111101B
                              MOV P1,#10111111B
                              LCALL DELAY

                              MOV P2,#11111011B
                              MOV P1,#11011111B
                              LCALL DELAY

                              MOV P2,#11110111B
                              MOV P1,#11101111B
                              LCALL DELAY

                              MOV P2,#11101111B
                              MOV P1,#11110111B
                              LCALL DELAY

                              MOV P2,#11011111B
                              MOV P1,#11111011B
                              LCALL DELAY

                              MOV P2,#10111111B
                              MOV P1,#11111101B
                              LCALL DELAY

                              MOV P2,#01111111B
                              MOV P1,#11111110B
                              LCALL DELAY
                              RET
                              LEDCHAYKIEU2:

                              MOV P0,#0FFH
                              MOV P2,#0FFH
                              MOV P3,#0FFH
                              MOV P1,#0FFH

                              MOV P0,#11111100B
                              MOV P3,#00111111B
                              LCALL DELAY

                              MOV P0,#11111001B
                              MOV P3,#10011111B
                              LCALL DELAY

                              MOV P0,#11110011B
                              MOV P3,#11001111B
                              LCALL DELAY

                              MOV P0,#11100111B
                              MOV P3,#11100111B
                              LCALL DELAY

                              MOV P0,#11001111B
                              MOV P3,#11110011B
                              LCALL DELAY

                              MOV P0,#10011111B
                              MOV P3,#11111001B
                              LCALL DELAY

                              MOV P0,#00111111B
                              MOV P3,#11111100B
                              LCALL DELAY

                              MOV P0,#01111111B
                              MOV P3,#11111110B
                              MOV P2,#11111110B
                              MOV P3,#01111111B
                              LCALL DELAY


                              MOV P0,#0FFH
                              MOV P3,#0FFH

                              MOV P2,#11111100B
                              MOV P1,#00111111B
                              LCALL DELAY

                              MOV P2,#11111001B
                              MOV P3,#10011111B
                              LCALL DELAY

                              MOV P2,#11110011B
                              MOV P1,#11001111B
                              LCALL DELAY

                              MOV P2,#11100111B
                              MOV P1,#11100111B
                              LCALL DELAY

                              MOV P2,#11001111B
                              MOV P1,#11110011B
                              LCALL DELAY

                              MOV P2,#10011111B
                              MOV P1,#11111001B
                              LCALL DELAY

                              MOV P2,#00111111B
                              MOV P1,#11111100B
                              LCALL DELAY

                              MOV P2,#01111111B
                              MOV P1,#11111110B
                              LCALL DELAY

                              MOV P2,#11111111B
                              MOV P1,#11111111B
                              LCALL DELAY
                              RET

                              LEDCHAYKIEU3:

                              MOV P0,#0FFH
                              MOV P2,#0FFH
                              MOV P3,#0FFH
                              MOV P1,#0FFH

                              MOV P0,#11111000B
                              MOV P3,#00011111B
                              LCALL DELAY

                              MOV P0,#11110001B
                              MOV P3,#10001111B
                              LCALL DELAY

                              MOV P0,#11100011B
                              MOV P2,#11000111B
                              LCALL DELAY

                              MOV P0,#11000111B
                              MOV P3,#11100011B
                              LCALL DELAY

                              MOV P0,#10001111B
                              MOV P3,#11110001B
                              LCALL DELAY

                              MOV P0,#00011111B
                              MOV P3,#11111000B
                              LCALL DELAY

                              MOV P0,#00111111B
                              MOV P3,#11111100B
                              MOV P2,#11111110B
                              MOV P1,#01111111B
                              LCALL DELAY


                              MOV P0,#01111111B
                              MOV P3,#11111110B
                              MOV P2,#11111100B
                              MOV P1,#00111111B
                              LCALL DELAY

                              MOV P0,#0FFH
                              MOV P3,#0FFH



                              MOV P2,#11111100B
                              MOV P1,#00111111B
                              LCALL DELAY

                              MOV P2,#11111000B
                              MOV P1,#00011111B
                              LCALL DELAY

                              MOV P2,#11110001B
                              MOV P1,#10001111B
                              LCALL DELAY

                              MOV P2,#11100011B
                              MOV P1,#11000111B
                              LCALL DELAY

                              MOV P2,#11000111B
                              MOV P1,#11100011B
                              LCALL DELAY

                              MOV P2,#10001111B
                              MOV P1,#11110001B
                              LCALL DELAY

                              MOV P2,#00011111B
                              MOV P1,#11111000B
                              LCALL DELAY

                              MOV P2,#00111111B
                              MOV P1,#11111100B
                              LCALL DELAY

                              MOV P2,#01111111B
                              MOV P1,#11111110B
                              LCALL DELAY

                              MOV P2,#11111111B
                              MOV P1,#11111111B
                              LCALL DELAY
                              RET


                              LEDCHAYKIEU4:

                              MOV P0,#0FFH
                              MOV P2,#0FFH
                              MOV P3,#0FFH
                              MOV P1,#0FFH

                              MOV P0,#11111110B
                              MOV P3,#01111111B
                              LCALL DELAY

                              MOV P0,#11111100B
                              MOV P3,#00111111B
                              LCALL DELAY

                              MOV P0,#11111000B
                              MOV P3,#00011111B
                              LCALL DELAY

                              MOV P0,#11110000B
                              MOV P3,#00001111B
                              LCALL DELAY

                              MOV P0,#11100001B
                              MOV P3,#10000111B
                              LCALL DELAY

                              MOV P0,#11000011B
                              MOV P3,#11000011B
                              LCALL DELAY

                              MOV P0,#10000111B
                              MOV P3,#11100001B
                              LCALL DELAY

                              MOV P0,#00001111B
                              MOV P3,#11110000B
                              LCALL DELAY

                              MOV P0,#00011111B
                              MOV P3,#11111000B
                              MOV P2,#11111110B
                              MOV P1,#01111111B
                              LCALL DELAY


                              MOV P0,#00111111B
                              MOV P3,#11111100B
                              MOV P2,#11111100B
                              MOV P1,#00111111B
                              LCALL DELAY

                              MOV P0,#01111111B
                              MOV P3,#11111110B
                              MOV P2,#11111000B
                              MOV P1,#00011111B
                              LCALL DELAY


                              MOV P0,#0FFH
                              MOV P3,#0FFH



                              MOV P2,#11110000B
                              MOV P1,#00001111B
                              LCALL DELAY

                              MOV P2,#11100001B
                              MOV P1,#10000111B
                              LCALL DELAY

                              MOV P2,#11000011B
                              MOV P1,#11000011B
                              LCALL DELAY

                              MOV P2,#10000111B
                              MOV P1,#11100001B
                              LCALL DELAY

                              MOV P2,#00001111B
                              MOV P1,#11110000B
                              LCALL DELAY

                              MOV P2,#00011111B
                              MOV P1,#11111000B
                              LCALL DELAY

                              MOV P2,#00111111B
                              MOV P1,#11111100B
                              LCALL DELAY

                              MOV P2,#01111111B
                              MOV P1,#11111110B
                              LCALL DELAY

                              MOV P2,#11111111B
                              MOV P1,#11111111B
                              LCALL DELAY
                              RET



                              DELAY: MOV R6,#0FFH
                              LAP1: MOV R7,#70H
                              LAP2: DJNZ R7,LAP2
                              DJNZ R6,LAP1
                              RET
                              END
                              sao nhìn đoạn giữa sao khó hiểu quá bạn ơi.mong bạn chỉ giúp.thanh you.mình chưa hiểu đoạn đó.bạn có thể úp một số tài liệu về lập trình này ko

                              Comment

                              Về tác giả

                              Collapse

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

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

                              Collapse

                              Đang tải...
                              X