hix, em hiện tại làm đồ án vi xử lý về led ma trận, kiếm được 1 project về led ma trận 16x64 nhưng em ko hiểu về câu lệnh cũng như việc viết lưu đồ thuật toán cho nó ! kính mong được sự giúp đỡ của các bậc tiền bối giúp em hoàn thành cái đồ án này ạ !!
Chương trình của nó đây ạ :-s
Chương trình của nó đây ạ :-s
PHP Code:
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;@@@ CAC TEN BIT DUNG TRONG CHUONG TRINH @@@
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
EN_HC154 BIT P3.3
SH_CP BIT P3.0
DATA_SERIAL BIT P3.1
ST_CP BIT P3.2
F_RUN BIT 7FH
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;@@@ CAC TEN BYTE DUNG TRONG CHUONG TRINH @@@
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
DATA_ROW EQU P2
INDEX_BYTE_ROW EQU 30H
NUM_ROW EQU 16
NUM_BYTE_COLLUM EQU 8
INDEX_POINT EQU 31H
INDEX_REG1 EQU 32H
INDEX_REG2 EQU 33H
NUM_BIT EQU 34H
WIDTH_BYTE EQU 35H
BUFFER_DPTRH EQU 36H
BUFFER_DPTRL EQU 37H
BUFFER_DPTRH1 EQU 38H
BUFFER_DPTRL1 EQU 39H
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;@@@ START@@@
;@@@ OSC 12MHZ@@@
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ORG 0000H
LJMP MAIN
ORG 000BH
LJMP NGAT_TIMER0
ORG 0030H
MAIN:
CLR F_RUN
MOV NUM_BIT,#0
MOV DPTR,#STRING_CODE+2
MOV A,#0
MOVC A,@A+DPTR
MOV WIDTH_BYTE,A
MOV DPTR,#STRING_CODE-6
LCALL SET_INDEX_DPTR
MOV BUFFER_DPTRH1,DPH
MOV BUFFER_DPTRL1,DPL
MOV DPTR,#STRING_CODE+3
MOV BUFFER_DPTRH,DPH
MOV BUFFER_DPTRL,DPL
MOV INDEX_POINT,#0
MOV INDEX_BYTE_ROW,#0
LCALL INIT_INTERRUPT
LJMP BEGIN
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;#######################################################################################
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BEGIN:
___HERE:
MOV IE,#82H
JNB F_RUN,___HERE
MOV IE,#0
CLR F_RUN
INC NUM_BIT
MOV A,NUM_BIT
CJNE A,#9,___HERE
;MOV IE,#0
MOV NUM_BIT,#0
MOV A,DPL
CJNE A,BUFFER_DPTRL1,___SKIP3
MOV A,DPH
CJNE A,BUFFER_DPTRH1,___SKIP3
MOV DPTR,#STRING_CODE+3
MOV BUFFER_DPTRH,DPH
MOV BUFFER_DPTRL,DPL
MOV INDEX_BYTE_ROW,#0
SJMP ___HERE
___SKIP3:
INC DPTR
MOV BUFFER_DPTRH,DPH
MOV BUFFER_DPTRL,DPL
;MOV IE,#82H
SJMP ___HERE
SJMP $
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;#######################################################################################
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INIT_INTERRUPT:
MOV TMOD,#01H
SETB TR0
SETB TF0
MOV IE,#82H
RET
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;#######################################################################################
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NGAT_TIMER0:
MOV TH0,#0F3H
MOV TL0,#0A8H ;12^6/12/50HZ/16=1250(FB1E)
LCALL SHIFT_DATA
LCALL SET_INDEX_DPTR
INC INDEX_BYTE_ROW
MOV A,INDEX_BYTE_ROW
CJNE A,#NUM_ROW,___EXIT
MOV INDEX_BYTE_ROW,#0
MOV DPH,BUFFER_DPTRH
MOV DPL,BUFFER_DPTRL
SETB F_RUN
___EXIT:
RETI
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;#######################################################################################
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SHIFT_DATA:
SETB EN_HC154 ;TA'T MA`NG HI`NH DE^? CHO^'NG LEM LED
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MOV INDEX_REG1,#NUM_BYTE_COLLUM
___LOOP1:
MOV INDEX_REG2,#8
MOV A,INDEX_POINT
MOVC A,@A+DPTR ;LAY DU LIEU TRONG BO NHO CT
___LOOP2:
CLR C
RLC A
MOV DATA_SERIAL,C
CLR SH_CP
SETB SH_CP
DJNZ INDEX_REG2,___LOOP2 ;DICH DU 8 BIT
INC INDEX_POINT
DJNZ INDEX_REG1,___LOOP1 ;DICH DU 8 BYTE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MOV A,NUM_BIT ;DE KIEM TRA CO ZERO
JZ ___SKIP1
MOV INDEX_REG2,NUM_BIT
MOV A,INDEX_POINT
MOVC A,@A+DPTR ;LAY DU LIEU TRONG BO NHO CT
___LOOP3:
CLR C
RLC A
MOV DATA_SERIAL,C
CLR SH_CP
SETB SH_CP
DJNZ INDEX_REG2,___LOOP3 ;DICH DU 8 BIT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
___SKIP1:
CLR ST_CP
SETB ST_CP
MOV DATA_ROW,INDEX_BYTE_ROW ;CHON HANG VA TICH CUC HC154
CLR EN_HC154
MOV INDEX_POINT,#0
RET
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;#######################################################################################
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET_INDEX_DPTR:
MOV A,DPL
ADD A,WIDTH_BYTE
MOV DPL,A
JNC ___SKIP2
INC DPH
___SKIP2:
RET
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;#######################################################################################
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
STRING_CODE:
;UNSIGNED CHAR CODE BMP002:
;-------------------------------------------------------------------------------
; IF FONT DISPLAY DISTORTION, PLEASE CHECK FONTS FORMAT OF SETUP.
; SOURCE FILE / TEXT :ÑOÀ AÙN VI Xöû LYÙ - THöïC HIEäN : VUÕ NGOïC CHöÔûNG - GVHD : NGUYEÃN HAûI DöÔNG - CAûM ÔN CAÙC BAïN ñAÕ UûNG HOä !^^
; WIDTH X HEIGHT (PIXELS) :500X16
; FONT FORMAT/SIZE : MONOCHROME LCD FONTS ,HORIZONTAL SCAN ,BIG ENDIAN ORDER/1008BYTE
; FONT MAKE DATE : 5/30/2011 9:33:23 PM
;-------------------------------------------------------------------------------
DB 0F4H,010H,03FH;WIDTH PIXELS,HEIGHT PIXELS,WIDTH BYTES
DB 000H,000H,080H,006H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB 000H,000H,000H,00FH,080H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB 000H,040H,008H,000H,000H,000H,000H,000H,003H,080H,000H,000H,000H,000H,000H,000H
DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB 000H,000H,001H,0C0H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB 000H,000H,000H,000H,000H,000H,003H,080H,000H,000H,000H,000H,000H,000H,01FH,083H
DB 000H,000H,000H,001H,0F9H,0B0H,03CH,0C3H,080H,07CH,008H,000H,007H,0FFH,0C0H,000H
DB 000H,01FH,079H,08CH,000H,000H,003H,0F3H,03AH,003H,08EH,000H,000H,000H,003H,0F7H
DB 080H,001H,0C0H,000H,000H,000H,007H,0E7H,0E6H,0FBH,0C7H,0E0H,000H,00EH,038H,000H
DB 000H,006H,000H,000H,0FBH,0C3H,086H,003H,0F0H,000H,000H,000H,000H,01CH,0C4H,080H
DB 008H,000H,000H,0C1H,030H,018H,081H,060H,030H,030H,000H,006H,0E9H,080H,00CH,000H
DB 00EH,031H,09AH,000H,000H,001H,082H,00CH,001H,084H,000H,000H,000H,00EH,033H,000H
DB 018H,080H,000H,000H,000H,01CH,063H,004H,071H,087H,030H,000H,006H,010H,000H,000H
DB 009H,000H,000H,071H,081H,006H,003H,098H,006H,000H,000H,000H,018H,060H,000H,01CH
DB 000H,000H,0C2H,000H,01DH,000H,060H,030H,000H,000H,004H,0C1H,080H,00CH,000H,00CH
DB 030H,000H,000H,000H,001H,084H,000H,001H,0C4H,000H,000H,000H,01CH,013H,000H,018H
DB 030H,000H,000H,000H,038H,023H,008H,061H,086H,018H,000H,007H,010H,000H,000H,000H
DB 000H,000H,061H,080H,000H,003H,00CH,006H,00CH,000H,000H,018H,063H,080H,01CH,01DH
DB 080H,0E4H,0E0H,01EH,038H,0C0H,070H,04CH,000H,000H,0C1H,0B7H,018H,070H,00CH,077H
DB 00EH,076H,003H,001H,0C9H,0CCH,002H,0C8H,070H,038H,038H,018H,003H,06EH,033H,0F7H
DB 063H,080H,000H,030H,003H,090H,063H,086H,018H,018H,00BH,021H,0C7H,032H,063H,09DH
DB 080H,063H,086H,09CH,003H,00FH,08CH,0FFH,0B1H,0C0H,07EH,06CH,0C0H,02CH,00FH,080H
DB 06CH,060H,00CH,018H,080H,060H,06CH,000H,001H,0C1H,0F3H,011H,0B0H,01FH,0E3H,036H
DB 03EH,003H,000H,0D8H,0CCH,002H,0E8H,0DCH,0CCH,0D8H,030H,003H,0E6H,026H,0C3H,0E6H
DB 0E0H,000H,061H,0F1H,0B0H,0FFH,006H,018H,018H,00BH,0A3H,073H,033H,06DH,08FH,080H
DB 0FFH,009H,08CH,003H,00DH,089H,0B1H,0F3H,070H,030H,06CH,0C0H,04CH,019H,080H,068H
DB 060H,00EH,019H,080H,060H,02CH,000H,001H,083H,033H,031H,000H,018H,063H,024H,066H
DB 000H,000H,0D0H,0CCH,002H,069H,098H,0CCH,080H,030H,006H,066H,064H,0E6H,06CH,0C0H
DB 000H,060H,0E1H,0A0H,0C3H,00EH,018H,000H,009H,0A6H,063H,031H,069H,019H,080H,0C3H
DB 019H,08CH,007H,00DH,099H,03BH,036H,060H,030H,0F8H,0C0H,07CH,01BH,080H,070H,040H
DB 016H,019H,000H,060H,028H,01EH,001H,083H,073H,023H,000H,018H,0E2H,068H,06EH,000H
DB 000H,0E0H,0D8H,004H,079H,099H,08DH,080H,030H,006H,0E6H,04CH,0E6H,0ECH,0C0H,0F0H
DB 060H,0C1H,0C0H,0C7H,00CH,038H,000H,011H,0E6H,063H,061H,05AH,01BH,080H,0C7H,031H
DB 008H,006H,01DH,093H,03BH,076H,060H,070H,0D9H,080H,08EH,013H,000H,070H,0C0H,026H
DB 033H,000H,0C1H,038H,01EH,001H,082H,066H,063H,020H,018H,0C6H,070H,04CH,000H,000H
DB 0E1H,098H,004H,031H,0B9H,099H,090H,030H,004H,0CCH,0CCH,0C4H,0CDH,0C0H,0F0H,060H
DB 0C1H,0C0H,0C6H,00CH,030H,000H,010H,0C6H,0E6H,061H,0DCH,013H,000H,0C6H,033H,018H
DB 006H,01BH,033H,032H,066H,0E0H,063H,099H,081H,006H,033H,080H,060H,0E0H,043H,037H
DB 000H,0C2H,030H,000H,003H,006H,076H,0E3H,020H,030H,0C7H,064H,0CEH,00CH,000H,0C1H
DB 0B8H,004H,030H,071H,099H,090H,018H,04CH,0EDH,0CDH,08CH,0E3H,080H,000H,031H,0C1H
DB 081H,086H,00CH,060H,060H,010H,0C1H,0C6H,0E1H,099H,033H,081H,086H,037H,01CH,006H
DB 033H,073H,066H,071H,0C0H,07EH,00EH,003H,01FH,033H,000H,040H,0C0H,0EFH,0BBH,081H
DB 0FEH,030H,000H,007H,0C6H,067H,071H,0C0H,03BH,0E6H,038H,0CCH,00CH,000H,081H,0DCH
DB 00EH,011H,0C0H,0E0H,0E0H,00FH,08CH,0CEH,0E7H,00CH,0CEH,000H,000H,01FH,081H,001H
DB 0DFH,01FH,080H,060H,038H,047H,007H,071H,08EH,033H,001H,0DFH,03BH,098H,00FH,0C3H
DB 0B9H,0C6H,067H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB 020H,000H,000H,000H,001H,080H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB 001H,030H,0C0H,000H,000H,000H,000H,000H,000H,009H,080H,000H,000H,000H,000H,000H
DB 000H,000H,000H,000H,004H,0C0H,001H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB 000H,004H,0C0H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,001H,0C0H
DB 000H,000H,000H,001H,080H,000H,000H,000H,030H,000H,000H,000H,000H,000H,000H,003H
DB 030H,0C0H,000H,000H,000H,000H,000H,000H,019H,080H,000H,000H,000H,000H,000H,000H
DB 000H,000H,000H,00CH,0C0H,00EH,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB 00CH,0C0H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,001H,080H,000H
DB 000H,000H,001H,080H,000H,000H,000H,030H,000H,000H,000H,000H,000H,000H,003H,0E0H
DB 0C0H,000H,000H,000H,000H,000H,000H,01FH,000H,000H,000H,000H,000H,000H,000H,000H
DB 000H,000H,00FH,080H,00CH,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,00FH
DB 080H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
END
Comment