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
Thông báo
Collapse
No announcement yet.
Xoay led tạo hình
Collapse
X
-
-
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
endmail:dqnam952@gmail.com
Comment
-
Nguyên văn bởi lovedt Xem bài viếtvẫ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!!!
Comment
-
$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
-
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
-
Bài viết mới nhất
Collapse
-
Trả lời cho Kiểm tra biến ápbởi lamvu0677nhân tiện cho mình hỏi thêm về cái phần test hipot (cao áp),là để kiểm tra độ bền cách điện giưa các cuộn dây,mà thấy thông số test thường ở mức 4kvac,vậy nếu mấy con fail đó xài bình thường vẫn dduocj phải không ạ,vì điện mình làm gì lên tới mức đó
-
Channel: Điện tử dành cho người mới bắt đầu
Hôm qua, 08:52 -
-
Trả lời cho Kiểm tra biến ápbởi lamvu0677máy đo số vòng thì cty có ,mà nó to quá,tưởng có máy nào gọn gọn bỏ túi được thì tiện hơn,vì đi lại nhiều...
-
Channel: Điện tử dành cho người mới bắt đầu
Hôm qua, 08:47 -
-
bởi tmcodonMình thấy diễn đàn có chuyên mục quảng cáo rồi mà. Bạn đóng góp để mở luồng riêng
-
Channel: Hướng dẫn sử dụng diễn đàn
09-11-2024, 13:36 -
-
bởi Nicole08Xin chào mọi người, tôi đã sử dụng Flashforge Inventor 2 được gần 5 năm và rất hài lòng với nó, nhưng tuần trước đã xảy ra sự cố. Có vẻ như động cơ bước đưa sợi in vào đầu nóng đã bị hỏng. Mọi thứ khác có vẻ ổn trên máy...
-
Channel: Điện tử dành cho người mới bắt đầu
09-11-2024, 12:55 -
-
Trả lời cho Hỏi về test hipot cao ápbởi nguyendinhvanCách nghĩ của bạn là theo duy tâm thôi. Còn trong công việc thì phải theo duy lý.
Bạn vào goggle và gõ từ : tiêu chuẩn an toàn cách điện.
Bạn sẽ thấy vô vàn các quy định, VN cũng có , quốc tế cũng có. Mỗi vùng , mỗi khu vực,...-
Channel: Điện tử dành cho người mới bắt đầu
02-11-2024, 20:04 -
-
bởi lamvu0677Chào mọi người, ai làm về điện, đặc biệt biến áp xung, mâý con nho nhỏ gắn vào mạch nguồn, cho e hỏi tí ą, e cũng làm trong ty về biển áp thì đo kiểm thành phẩm sẽ kiểm cao áp, tức là kiểm xem có phóng điện giữa các cuộn dây với...
-
Channel: Điện tử dành cho người mới bắt đầu
01-11-2024, 21:05 -
Comment