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
-
Code này bạn lấy ở đâu vậy thấy quen quá. Sao bạn ko tự viết lấyNguyê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
-
bởi Andrea14Chào mọi người,
Tôi muốn mô phỏng sự thay đổi các mùa bằng cách từ từ nghiêng một quả địa cầu 16 inch bằng một động cơ bước nhỏ. Một động cơ bước khác sẽ quay quả địa cầu theo thời gian thực. Hệ thống truyền động...-
Channel: Điện tử truyền hình
hôm nay, 12:42 -
-
Trả lời cho Đấu tắt điện cho máy tính bảngbởi bqvietBqv cáo lỗi vì chưa đủ khả năng diễn giải để người đọc hiểu. Người làm kỹ thuật sâu đôi khi như thế đó. Về việc nạp pin không vào dù cell mới, khả năng cái mạch quản lý đó đã hỏng - cũng chính là nguyên nhân đám cell cũ hỏng từ đầu.
-
Channel: Thiết bị điện tử cá nhân
06-12-2025, 17:17 -
-
Trả lời cho Xin hỏi về mạch thu FM/AM trong catsettebởi nguyendinhvanTheo tôi, nó chỉ là cái Tuy- ê - nơ, hoặc là khối Trung Văn Tần, nó một phần trong cái Da đì ô thôi. Vì có thấy một chỗ có ba chân hàn, giiống như chân Cờ rít sờ tăng 455 ki nô hẹc. Còn khối Tuy ê nơ thì không nhìn thây cái Di ốt Va di cáp...
-
Channel: Điện thanh
05-12-2025, 19:59 -
-
Trả lời cho Đấu tắt điện cho máy tính bảngbởi afrendlyCó vẻ ngoài hiểu biết của mình rồi. Cuối cùng mình quyết định tìm mua 2 pin trên Shopee, giá 200K thay vào. Tuy nhận pin được 1%, sạc mãi không vào nhưng cũng mở được máy lên. Vậy cũng tạm. Cảm ơn bạn đã hỗ trợ nhé....
-
Channel: Thiết bị điện tử cá nhân
04-12-2025, 01:27 -

Comment