![]() |
|
Tài trợ cho PIC Vietnam |
Cơ bản về vi điều khiển và PIC Những bài hướng dẫn cơ bản nhất để làm quen với vi điều khiển PIC |
|
Ðiều Chỉnh | Xếp Bài |
![]() |
#26 |
Nhập môn đệ tử
Tham gia ngày: Oct 2010
Bài gửi: 1
: |
mấy a ơi e đang làm led matrix 16x128 có đoạn code nhờ mấy a chi' dùm với????
$mod51 ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx ; chuong trinh xuat du lieu len bang ma tran ; ngang gom co 16 Led matrix 8x8 = 16*8 =128 cot ; cao gom co2Led matrix 8x8 =2*8 =16 hang ; Xuat tin hieu ra cot dung IC 74HC595 gom N con mat noi tiep ;Quet hang dung 1 con IC 74HC154 ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx ; A bit p1.0 ; B bit p1.1 ; C bit p1.2 ; D bit p1.3 E bit p1.4 Clock bit p2.0 Din bit p2.1 Lacth bit p2.2 Colume equ 30h bodem equ 31h contro equ 32h Row equ 33h ABCD equ 34h Length equ 35h contro1 equ 36h org 0000h KhoiTao: mov Length, #600 mov Colume, #40 mov bodem, #0 mov contro, #0 mov row, #0 mov ABCD, #00h mov dptr, #DuLieu mov contro1, #0 mov r1, #5 ;''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''' Main: call Xoamanhinh Call Xuat_Frame call delay inc Row inc ABCD mov a, Row cjne a, #8, main mov ABCD, #00h mov Row, #0 djnz r1, main mov r1,#5 inc contro mov a, contro cjne a, Length,main jmp Khoitao ;''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''' DATA_Cot: mov r2, colume mov r3, Row clr Lacth dichcot: mov a, contro add a, bodem movc a, @a+dptr clr Clock call LuaDong mov Din, c setb Clock inc bodem djnz r2, dichcot mov bodem, #0 mov r2, colume setb Lacth ret ;----------------------------------------------------------- Xuat_Frame: call DATA_cot mov p1, ABCD ret ;---------------------------------------------------------- XoaManHinh: mov r2, colume clr Lacth xoa: clr clock clr Din setb clock djnz r2, xoa setb Lacth ret ;---------------------------------------------------------- LUADONG: cjne r3, #0, dong1 mov c, acc.0 mov din, c call nhay12 sjmp het dong1: cjne r3, #1, dong2 mov c, acc.1 mov din, c call nhay10 sjmp het dong2: cjne r3, #2, dong3 mov c, acc.2 mov din, c call nhay8 sjmp het dong3: cjne r3, #3, dong4 mov c, acc.3 mov din, c call nhay6 sjmp het dong4: cjne r3, #4, dong5 mov c, acc.4 mov din, c call nhay4 sjmp het dong5: cjne r3, #5, dong6 mov c, acc.5 mov din, c nop nop sjmp het dong6: cjne r3, #6, dong7 mov c, acc.6 mov din, c sjmp het dong7: cjne r3, #7, het mov c, acc.7 mov din, c het: ret ;------------------------------------------------- NHAY: nhay14: nop nop nhay12: nop nop nhay10: nop nop nhay8: nop nop nhay6: nop nop nhay4: ret DELAY: mov r7,#15 laplai: mov r6, #60 djnz r6, $ djnz r7, laplai ret Delay1: mov r5, #2 mov r4, #2 tt: djnz r4, $ djnz r5, tt ret ;-------------------------------------------------------- DULIEU: DB 0H,0FFH,0FFH,2H,4H,0FFH,0H,0H DB 0H,7EH,0FFH,0C3H,0D3H,72H,0H,0H DB 0H,7AH,85H,85H,85H,7AH,0H,0H DB 3H,1H,1H,0FFH,0FFH,1H,1H,3H DB 0H,0FFH,0FFH,11H,31H,4EH,80H,0H DB 0H,7FH,0FFH,80H,80H,7FH,0H,0H DB 0H,0FFH,0FFH,2H,4H,0FFH,0H,0H DB 0H,7EH,0FFH,0C3H,0D3H,72H,0H,0H DB 0H,0FFH,0FFH,18H,18H,0FFH,0FFH,0H DB 0H,0H,0H,0FDH,0FDH,0H,0H,0H DB 0H,0FFH,0FFH,99H,99H,99H,0H,0H DB 0H,7FH,0FFH,80H,80H,7FH,0H,0H DB 0H,54H,38H,7CH,38H,54H,0H,0H DB 0H,54H,38H,7CH,38H,54H,0H,0H DB 0H,54H,38H,7CH,38H,54H,0H,0H DB 0H,0FFH,0FFH,2H,4H,2H,0FFH,0H DB 0H,0FCH,12H,12H,12H,0FCH,0H,0H DB 0H,3H,1H,0FFH,0FFH,1H,1H,2H DB 80H,0FFH,91H,11H,0B1H,0CEH,80H,0H DB 0H,0H,0H,0FDH,0FDH,0H,0H,0H DB 81H,0C3H,0A5H,18H,18H,0A5H,0C3H,81H DB 3CH,52H,0A5H,0A1H,0A1H,0A5H,52H,3CH DB 18H,3CH,5AH,18H,18H,18H,3CH,7EH DB 3FH,7FH,80H,60H,80H,40H,3FH,0H DB 0H,0FEH,92H,92H,92H,0H,0H,0H DB 0H,0FEH,80H,80H,80H,40H,0H,0H DB 0H,0FEH,80H,80H,80H,40H,0H,0H DB 0H,3CH,42H,81H,81H,81H,42H,0H DB 0H,7CH,82H,82H,82H,7CH,0H,0H DB 0H,0FEH,4H,8H,4H,0FEH,0H,0H DB 0H,0FEH,92H,92H,92H,0H,0H,0H DB 0H,54H,38H,0FEH,38H,54H,0H,0H DB 0H,54H,38H,0FEH,38H,54H,0H,0H DB 0H,54H,38H,0FEH,38H,54H,0H,0H end cám ơn nhiều |
![]() |
![]() |
|
|