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
Xoay led tạo hình
Collapse
X
-
Tags: None
-
-
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
-
-
dự án của bạn Tra theo mã, xem datasheet và đặt hàng trực tuyến. MicrochipROHMEpsonTaejin
Đặt hàng & tư vấn
Hà Nội024.3640 8561
TP.HCM028.3811 9870
Quét mã hoặc bấm để chat Zalo với R&PChat Zalo
Quét mã hoặc bấm để chat Zalo với R&PChat Zalo
Bài viết mới nhất
Collapse
-
Trả lời cho Tìm bạn thân quen cũ.bởi nhathung1101Còn sống không lão??? Mất một thời gian chữa bệnh nên quên hỏi thăm.......
-
Channel: Tâm tình dân kỹ thuật
Hôm qua, 03:09 -
-
Trả lời cho Công suất truyền qua lõi máy biến ápbởi nhathung1101Thời buổi năng lượng xanh, nhất là xanh cả mặt... Thì Điện mặt giời, điện gió, sẽ lên ngôi.
Nếu không nắm bắt được cái cơ bản đó thì đi làm coder à? Mà coder giờ thất nghiệp cả lũ vì AI rồi!!!









...
-
Channel: Điện tử công suất
Hôm qua, 03:03 -
-
Trả lời cho Công suất truyền qua lõi máy biến ápbởi quangdonguehChà, lâu lắm rồi nhưng diễn đàn vẫn còn những chủ đề cốt lõi của điện tử công suất...-
Channel: Điện tử công suất
24-10-2026, 07:53 -
-
bởi bqvietNếu muốn tăng công suất cần tăng con chip và tăng biến áp lên lớn hơn. Thiết kế ban đầu dùng TNY25x và biến áp EE16 hoặc EE13. Tăng con chip lên TNY268 vẫn mạch nguyên lý đó và biến áp lên EE19 sẽ nâng công suất ra thêm nhiều. Tăng tối đa...-
Channel: Điện tử công suất
24-10-2026, 02:14 -
-
bởi Nexus 6PMạch này chỉ chạy cho LED 10W trở xuống, còn muốn chạy Led công suất cao thì sao bác thớt ơi?-
Channel: Điện tử công suất
22-10-2026, 14:33 -
-
bởi Nexus 6PMạch này chỉ chạy cho LED 10W trở xuống, còn muốn chạy Led công suất cao thì sao bác thớt ơi?-
Channel: Điện tử công suất
22-10-2026, 10:49 -
-
Trả lời cho Tìm VR 5 chânbởi dinhthuong80Cảm ơn bác bqviet . Nhưng hình như các VR 5 chân của linhkienchatluong là loại có 2 chân là công tắc đóng mở. Thấy trên Shopee có chỗ bán linh kiện đàn Organ, mà không biết đúng loại không, với lại sao ... mắc dữ dội luôn ấy!!!
...-
Channel: Hướng dẫn tìm thông tin linh kiện
19-10-2026, 11:30 -
-
Trả lời cho Tìm VR 5 chânbởi bqvietTrang sản phẩm này có loại 5 chân và 8 chân
https://linhkienchatluong.vn/chiet-a...doi_s1595.aspx
Ngoài ra một trang cùng cấp với nó có loại 6 chân nữa, chắc đủ cho người muốn tìm....-
Channel: Hướng dẫn tìm thông tin linh kiện
17-10-2026, 17:19 -
-
bởi dinhthuong80Chào cả nhà, chúc cuối tuần vui vẻ!
Hôm nay mình lên đây nhờ ai biết chỉ dùm biến trở 5 chân này tên gọi là gì, có thể mua ở đâu vậy? Xin cám ơn nhiều! ...-
Channel: Hướng dẫn tìm thông tin linh kiện
-
Comment