1、A8255_PA XDATA 0FF00HA8255_PB XDATA 0FF01HA8255_PC XDATA 0FF02HA8255_CTL XDATA 0FF03HROW XDATA A8255_PALINE XDATA A8255_PCORG 0000HAJMP STARTORG 0100HSTART: MOV SP,#60HCALL INIT_IOCALL TEST_LEDCALL CLEARCHS_SHOW: MOV R7,12HMOV DPTR,#CHAR_TABCHS_1: MOV R1,#8CHS_2: ACALL DISP_CHINC DPTRDJNZ R1,CHS_2DJ
2、NZ R7,CHS_1SJMP CHS_SHOWDISP_CH: PUSH 07HMOV R7,#10HDISP_CH_1: ACALL DISP1DJNZ R7,DISP_CH_1POP 07HRETDISP1: PUSH DPLPUSH DPHMOV R6,#8MOV R2,#7FHREPEAT: MOV P2,#HIGH(LINE)MOV R0,#LOW(LINE)MOV A,R2MOVX R0,ACLR AMOVC A,A+DPTRINC DPTRACALL ADJUSTMOV R0,#LOW(ROW)MOVX R0,AACALL DL10msACALL CLEARSETB CMOV
3、A,R2RRC AMOV R2,ADJNZ R6,REPEATPOP DPHPOP DPLRETINIT_IO: MOV DPTR,#A8255_CTLMOV A.#80HMOVX DPTR,ARETCLEAR: MOV A.#0FFHMOV P2,#HIGH(LINE)MOV R0,#LOW(LINE)MOVX R0,ACLP AMOV R0,#LOW(ROW0MOVX R0,ARETADJUST: MOV R5,#8ADJUST1: RLC AXCH A,BRRC AXCH A,BDJNZ R5,ADJUST1MOV A,BRETTEST_LED: MOV DPTR,#LINECLR AMOVX DPTR,AMOV DPTR,#ROWMOV A,#0FFHMOVX DPTR,ACALL DL500msCALL DL500msRETDL10ms: MOV R4,#2DL10ms1: MOV R5,#230DJNZ R5,$DJNZ R4, DL10ms1RETDL500ms: MOV R5,#10DL500ms1: MOV R6,#200DL500ms2: MOV R7,#123DJNZ R7,$DJNZ R6, DL500ms2DJNZ R6, DL500ms1RETCHAR_TAB: DB 000H,18H,24H,24H,24H,24H,24H,18H