Thông báo

Collapse
No announcement yet.

Xoay led tạo hình

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

  • Xoay led tạo hình

    Cho mình hỏi có bạn nào làm cái này chưa , up len cho mình học hỏi với ! thanks

  • #2
    http://www.efbdu.com/forum/viewtopic.php?f=8&t=332

    Comment


    • #3
      Dùng 89c2051 để làm Propeller Display

      em đang dùng con 89c2051 để làm Propeller Display nhưng đoạn code sao em bien dịch bằng chuong trình MCS-51 IDE nó cứ báo lỗi hoài à(line#:operand expected),em đã bỏ dòng $include(reg51.inc) mà vẫn chưa được.nhờ các anh giúp em nhé!!
      code:
      $include(reg51.inc)




      ;T0 interrupt
      org 000h
      ajmp main

      org 000BH
      acall interr
      mov p3,#0ffH
      reti

      ;EXT0 interrupt

      org 0003H
      acall interr1
      reti


      org 230h
      lookup:
      db 10000010b,01111100b,01111100b,01111100b,10000010b, 11111110b,10111100b,00000000b,11111100b,11111110b, 10111100b,01110010b,01110100b,01101100b,10011100b
      db 01111010b,01111100b,01011100b,00101100b,01110010b, 11100110b,11010110b,10110110b,00000000b,11110110b, 00001100b,01101100b,01101100b,01101100b,01110010b
      db 10000010b,01101100b,01101100b,01101100b,11110010b, 00111100b,01111010b,01110110b,01101110b,00011110b, 11100000b,00001100b,01101100b,00001100b,11100000b
      db 10011110b,01101100b,01101100b,01101100b,10000010b

      org 285h
      db 10000000b,01101110b,01101110b,01101110b,10000000b, 00000000b,01101100b,01101100b,10001100b,11110010b, 10000010b,01111100b,01111100b,01111100b,01111100b
      db 01111100b,00000000b,01111100b,01111100b,10000010b, 00000000b,01101100b,01101100b,01111100b,01111100b, 00000000b,01101110b,01101110b,01111110b,01111110b
      db 00000000b,01111100b,01101100b,01101100b,01100000b, 00000000b,11101110b,11101110b,11101110b,00000000b, 11111110b,01111100b,00000000b,01111100b,11111110b
      db 11111010b,01111100b,00000010b,01111110b,11111110b, 00000000b,11101110b,11010110b,10111010b,01111100b, 00000000b,11111100b,11111100b,11111100b,11111100b
      db 00000000b,01111110b,11001110b,01111110b,00000000b, 00000000b,10011110b,11101110b,11110010b,00000000b, 00000000b,01111100b,01111100b,01111100b,00000000b
      db 00000000b,01101110b,01101110b,01101110b,10011110b, 10000010b,01111100b,01110100b,01111000b,10000000b, 00000000b,01101110b,01100110b,01101010b,10011100b
      db 10011000b,01101100b,01101100b,01101100b,10110010b, 01111110b,01111110b,00000000b,01111110b,01111110b, 00000000b,11111100b,11111100b,11111100b,00000000b
      db 00000110b,11111010b,11111100b,11111010b,00000110b, 00000010b,11111100b,11110010b,11111100b,00000010b, 00111000b,11010110b,11101110b,11010110b,00111000b
      db 00111110b,11011110b,11100000b,11011110b,00111110b, 01111000b,01110100b,01101100b,01011100b,00111100b, 11111111b,11111111b,11111111b,11111111b,11111111b,

      ;Main Function
      org 0100h
      main:
      mov ie,#83H
      mov ip,01H
      mov tmod,#12H
      mov th0,#00h
      mov tl0,#00h
      setb it0
      mov p3,#0FFh

      acall ramc
      mov th1,#00h
      mov tl1,#00h
      setb tr0
      setb tr1
      here: ajmp here


      interr: ;T0 interrupt
      cjne r6,#0ffh,sk
      mov r6,#00h
      acall disp
      sjmp sk1
      sk:
      mov r6,#0ffh
      sk1:
      clr tf0
      ret


      ; EXT0 interruupt
      interr1:
      clr tr1
      clr tr0
      mov a,th1
      mov r1,a
      mov a,tl1
      mov r0,a
      mov r3,#00h
      mov r2,#160
      acall div16_16
      mov a,r2
      subb a,0ffh
      mov th0,a
      mov tl0,a
      mov th1,#00h
      mov tl1,#00h
      setb tr1
      setb tr0
      mov r0,#23h
      mov r5,#00h
      mov r6,#00h
      ret

      ramc:
      mov dptr,#600h
      mov r7,#30
      mov r0,#40h

      loop1:
      mov a,r7
      subb a,#01h
      movc a,@a+dptr
      mov @r0,a
      dec r0
      djnz r7,loop1
      ret

      disp:
      cjne r5,#5,continue
      mov a,@r0
      cjne a,#'[',space
      mov p1,#11111111b
      sjmp cont
      space:
      mov p1,#11111110b
      cont:
      inc r0
      mov r5,#00h
      ajmp neglect
      continue:
      mov a,@r0 ; moves ASCII from RAM to R0
      clr c
      subb A,#30h ;
      mov b,#05 ; ASCII to Adress conversion
      mul AB ;
      mov dptr,#230h
      add a,r5 ; Memory offset
      movc A,@A+DPTR
      mov p1,a
      inc r5
      neglect:
      ret


      org 600h
      msg:
      db 'PROPELLER[DISPLAY[[[[[[[[[[[[[[[[[[[[',0



      div16_16:
      CLR C ;Clear carry initially
      MOV R4,#00h ;Clear R4 working variable initially
      MOV R5,#00h ;CLear R5 working variable initially
      MOV B,#00h ;Clear B since B will count the number of left-shifted bits
      div1:
      INC B ;Increment counter for each left shift
      MOV A,R2 ;Move the current divisor low byte into the accumulator
      RLC A ;Shift low-byte left, rotate through carry to apply highest bit to high-byte
      MOV R2,A ;Save the updated divisor low-byte
      MOV A,R3 ;Move the current divisor high byte into the accumulator
      RLC A ;Shift high-byte left high, rotating in carry from low-byte
      MOV R3,A ;Save the updated divisor high-byte
      JNC div1 ;Repeat until carry flag is set from high-byte
      div2: ;Shift right the divisor
      MOV A,R3 ;Move high-byte of divisor into accumulator
      RRC A ;Rotate high-byte of divisor right and into carry
      MOV R3,A ;Save updated value of high-byte of divisor
      MOV A,R2 ;Move low-byte of divisor into accumulator
      RRC A ;Rotate low-byte of divisor right, with carry from high-byte
      MOV R2,A ;Save updated value of low-byte of divisor
      CLR C ;Clear carry, we don't need it anymore
      MOV 07h,R1 ;Make a safe copy of the dividend high-byte
      MOV 06h,R0 ;Make a safe copy of the dividend low-byte
      MOV A,R0 ;Move low-byte of dividend into accumulator
      SUBB A,R2 ;Dividend - shifted divisor = result bit (no factor, only 0 or 1)
      MOV R0,A ;Save updated dividend
      MOV A,R1 ;Move high-byte of dividend into accumulator
      SUBB A,R3 ;Subtract high-byte of divisor (all together 16-bit substraction)
      MOV R1,A ;Save updated high-byte back in high-byte of divisor
      JNC div3 ;If carry flag is NOT set, result is 1
      MOV R1,07h ;Otherwise result is 0, save copy of divisor to undo subtraction
      MOV R0,06h
      div3:
      CPL C ;Invert carry, so it can be directly copied into result
      MOV A,R4
      RLC A ;Shift carry flag into temporary result
      MOV R4,A
      MOV A,R5
      RLC A
      MOV R5,A
      DJNZ B,div2 ;Now count backwards and repeat until "B" is zero
      MOV R3,05h ;Move result to R3/R2
      MOV R2,04h ;Move result to R3/R2
      RET


      end
      mail:dqnam952@gmail.com

      Comment


      • #4
        bạn thử thêm cái $MOD51 xem sao?

        abc.zip

        Comment


        • #5
          vẫn chưa được bạn à,file bạn up lên là file bạn dịch từ code trên à.nếu dịch được rồi bạn giúp mình luôn nhé.thank!!!
          mail:dqnam952@gmail.com

          Comment


          • #6
            Nguyên văn bởi lovedt Xem bài viết
            vẫn chưa được bạn à,file bạn up lên là file bạn dịch từ code trên à.nếu dịch được rồi bạn giúp mình luôn nhé.thank!!!
            Code này bạn lấy ở đâu vậy thấy quen quá. Sao bạn ko tự viết lấy

            Comment


            • #7
              bạn nào cho mình cai code C để mình tham khảo .

              Comment


              • #8
                à code này mình tìm được trên trang 8051project có thể nó được viết bằng Keil uVision,mình mới học năm 2 à chưa được học vđk.Vì thích vđk quá nên tự học trước mong các anh các bạn chỉ giúp!
                mail:dqnam952@gmail.com

                Comment


                • #9
                  mấy anh có thể giúp em được không!!
                  mail:dqnam952@gmail.com

                  Comment


                  • #10
                    code dư dấu "," ở dòng thứ 1 từ Main Function đếm lên

                    Comment


                    • #11
                      bạn nào có code C cho mình tham khảo với!

                      Comment


                      • #12
                        $mod51

                        ;T0 interrupt
                        org 000h
                        ajmp main

                        org 0003H
                        acall interr1
                        reti


                        org 000BH
                        acall interr
                        mov p3,#0ffH
                        reti

                        ;EXT0 interrupt




                        lookup:
                        db 10000010b,01111100b,01111100b,01111100b,10000010b, 11111110b,10111100b,00000000b,11111100b,11111110b, 10111100b,01110010b,01110100b,01101100b,10011100b
                        db 01111010b,01111100b,01011100b,00101100b,01110010b, 11100110b,11010110b,10110110b,00000000b,11110110b, 00001100b,01101100b,01101100b,01101100b,01110010b
                        db 10000010b,01101100b,01101100b,01101100b,11110010b, 00111100b,01111010b,01110110b,01101110b,00011110b, 11100000b,00001100b,01101100b,00001100b,11100000b
                        db 10011110b,01101100b,01101100b,01101100b,10000010b


                        db 10000000b,01101110b,01101110b,01101110b,10000000b, 00000000b,01101100b,01101100b,10001100b,11110010b, 10000010b,01111100b,01111100b,01111100b,01111100b
                        db 01111100b,00000000b,01111100b,01111100b,10000010b, 00000000b,01101100b,01101100b,01111100b,01111100b, 00000000b,01101110b,01101110b,01111110b,01111110b
                        db 00000000b,01111100b,01101100b,01101100b,01100000b, 00000000b,11101110b,11101110b,11101110b,00000000b, 11111110b,01111100b,00000000b,01111100b,11111110b
                        db 11111010b,01111100b,00000010b,01111110b,11111110b, 00000000b,11101110b,11010110b,10111010b,01111100b, 00000000b,11111100b,11111100b,11111100b,11111100b
                        db 00000000b,01111110b,11001110b,01111110b,00000000b, 00000000b,10011110b,11101110b,11110010b,00000000b, 00000000b,01111100b,01111100b,01111100b,00000000b
                        db 00000000b,01101110b,01101110b,01101110b,10011110b, 10000010b,01111100b,01110100b,01111000b,10000000b, 00000000b,01101110b,01100110b,01101010b,10011100b
                        db 10011000b,01101100b,01101100b,01101100b,10110010b, 01111110b,01111110b,00000000b,01111110b,01111110b, 00000000b,11111100b,11111100b,11111100b,00000000b
                        db 00000110b,11111010b,11111100b,11111010b,00000110b, 00000010b,11111100b,11110010b,11111100b,00000010b, 00111000b,11010110b,11101110b,11010110b,00111000b
                        db 00111110b,11011110b,11100000b,11011110b,00111110b, 01111000b,01110100b,01101100b,01011100b,00111100b, 11111111b,11111111b,11111111b,11111111b,11111111b,

                        ;Main Function

                        main:
                        mov ie,#83H
                        mov ip,01H
                        mov tmod,#12H
                        mov th0,#00h
                        mov tl0,#00h
                        setb it0
                        mov p3,#0FFh

                        acall ramc
                        mov th1,#00h
                        mov tl1,#00h
                        setb tr0
                        setb tr1
                        here: ajmp here


                        interr: ;T0 interrupt
                        cjne r6,#0ffh,sk
                        mov r6,#00h
                        acall disp
                        sjmp sk1
                        sk:
                        mov r6,#0ffh
                        sk1:
                        clr tf0
                        ret


                        ; EXT0 interruupt
                        interr1:
                        clr tr1
                        clr tr0
                        mov a,th1
                        mov r1,a
                        mov a,tl1
                        mov r0,a
                        mov r3,#00h
                        mov r2,#160
                        acall div16_16
                        mov a,r2
                        subb a,0ffh
                        mov th0,a
                        mov tl0,a
                        mov th1,#00h
                        mov tl1,#00h
                        setb tr1
                        setb tr0
                        mov r0,#23h
                        mov r5,#00h
                        mov r6,#00h
                        ret

                        ramc:
                        mov dptr,#msg
                        mov r7,#30
                        mov r0,#40h

                        loop1:
                        mov a,r7
                        subb a,#01h
                        movc a,@a+dptr
                        mov @r0,a
                        dec r0
                        djnz r7,loop1
                        ret

                        disp:
                        cjne r5,#5,continue
                        mov a,@r0
                        cjne a,#'[',space
                        mov p1,#11111111b
                        sjmp cont
                        space:
                        mov p1,#11111110b
                        cont:
                        inc r0
                        mov r5,#00h
                        ajmp neglect
                        continue:
                        mov a,@r0 ; moves ASCII from RAM to R0
                        clr c
                        subb A,#30h ;
                        mov b,#05 ; ASCII to Adress conversion
                        mul AB ;
                        mov dptr,#230h
                        add a,r5 ; Memory offset
                        movc A,@A+DPTR
                        mov p1,a
                        inc r5
                        neglect:
                        ret



                        msg:
                        db 'PROPELLER[DISPLAY[[[[[[[[[[[[[[[[[[[[',0



                        div16_16:
                        CLR C ;Clear carry initially
                        MOV R4,#00h ;Clear R4 working variable initially
                        MOV R5,#00h ;CLear R5 working variable initially
                        MOV B,#00h ;Clear B since B will count the number of left-shifted bits
                        div1:
                        INC B ;Increment counter for each left shift
                        MOV A,R2 ;Move the current divisor low byte into the accumulator
                        RLC A ;Shift low-byte left, rotate through carry to apply highest bit to high-byte
                        MOV R2,A ;Save the updated divisor low-byte
                        MOV A,R3 ;Move the current divisor high byte into the accumulator
                        RLC A ;Shift high-byte left high, rotating in carry from low-byte
                        MOV R3,A ;Save the updated divisor high-byte
                        JNC div1 ;Repeat until carry flag is set from high-byte
                        div2: ;Shift right the divisor
                        MOV A,R3 ;Move high-byte of divisor into accumulator
                        RRC A ;Rotate high-byte of divisor right and into carry
                        MOV R3,A ;Save updated value of high-byte of divisor
                        MOV A,R2 ;Move low-byte of divisor into accumulator
                        RRC A ;Rotate low-byte of divisor right, with carry from high-byte
                        MOV R2,A ;Save updated value of low-byte of divisor
                        CLR C ;Clear carry, we don't need it anymore
                        MOV 07h,R1 ;Make a safe copy of the dividend high-byte
                        MOV 06h,R0 ;Make a safe copy of the dividend low-byte
                        MOV A,R0 ;Move low-byte of dividend into accumulator
                        SUBB A,R2 ;Dividend - shifted divisor = result bit (no factor, only 0 or 1)
                        MOV R0,A ;Save updated dividend
                        MOV A,R1 ;Move high-byte of dividend into accumulator
                        SUBB A,R3 ;Subtract high-byte of divisor (all together 16-bit substraction)
                        MOV R1,A ;Save updated high-byte back in high-byte of divisor
                        JNC div3 ;If carry flag is NOT set, result is 1
                        MOV R1,07h ;Otherwise result is 0, save copy of divisor to undo subtraction
                        MOV R0,06h
                        div3:
                        CPL C ;Invert carry, so it can be directly copied into result
                        MOV A,R4
                        RLC A ;Shift carry flag into temporary result
                        MOV R4,A
                        MOV A,R5
                        RLC A
                        MOV R5,A
                        DJNZ B,div2 ;Now count backwards and repeat until "B" is zero
                        MOV R3,05h ;Move result to R3/R2
                        MOV R2,04h ;Move result to R3/R2
                        RET


                        end

                        Comment


                        • #13
                          thu coi nhe co j lien he voi minh
                          con day la code hex
                          :0200000001CA33
                          :0300030011FA32BD
                          :10000B0011EC75B0FF32827C7C7C82FEBC00FCFE66
                          :10001B00BC72746C9C7A7C5C2C72E6D6B600F60CC7
                          :10002B006C6C6C72826C6C6CF23C7A766E1EE00CB3
                          :10003B006C0CE09E6C6C6C82806E6E6E80006C6CD7
                          :10004B008CF2827C7C7C7C7C007C7C82006C6C7C6B
                          :10005B007C006E6E7E7E007C6C6C6000EEEEEE00C3
                          :10006B00FE7C007CFEFA7C027EFE00EED6BA7C00A3
                          :10007B00FCFCFCFC007ECE7E00009EEEF200007CC1
                          :10008B007C7C00006E6E6E9E827C747880006E6647
                          :10009B006A9C986C6C6CB27E7E007E7E00FCFCFCD5
                          :1000AB000006FAFCFA0602FCF2FC0238D6EED63851
                          :1000BB003EDEE0DE3E78746C5C3CFFFFFFFFFF75BD
                          :1000CB00A8838501B8758912758C00758A00D28852
                          :1000DB0075B0FF3122758D00758B00D28CD28E01DD
                          :1000EB00EABEFF067E00313280027EFFC28D22C245
                          :1000FB008EC28CE58DF9E58BF87B007AA0317DEA19
                          :10010B0095FFF58CF58A758D00758B00D28ED28C90
                          :10011B0078237D007E00229001577F1E7840EF945C
                          :10012B000193F618DFF822BD0511E6B45B05759057
                          :10013B00FF80037590FE087D002156E6C394307551
                          :10014B00F005A49002302D93F5900D2250524F5094
                          :10015B00454C4C45525B444953504C41595B5B5B9E
                          :10016B005B5B5B5B5B5B5B5B5B5B5B5B5B5B5B5BD4
                          :10017B005B00C37C007D0075F00005F0EA33FAEB01
                          :10018B0033FB50F6EB13FBEA13FAC389078806E837
                          :10019B009AF8E99BF95004A907A806B3EC33FCEDD8
                          :0A01AB0033FDD5F0DFAB05AA0422F6
                          :00000001FF

                          Comment


                          • #14
                            thanhdat_1983@yahoo.com
                            Dt: 0944808168

                            Comment


                            • #15
                              hic.ai cho minh tai lieu xoay led tao hinh nay voi
                              mih kam on nhieu

                              Comment

                              Về tác giả

                              Collapse

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

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

                              Collapse

                              Đang tải...
                              X