1、微机原理综合实验报告LED横向滚动显示方向修改电子钟修改实验微机原理上机实验报告综合实验:1. LED 16x16点阵显示实验竖向显示改横向显示2. 电子钟功能修改微机原理综合实验报告综合实验1:LED 16x16点阵竖向显示改横向显示实验一、 实验目的1、熟悉8255的功能,了解点阵显示的原理及控制方法;2、学会使用LED点阵,通过编程显示不同字符;3、认真预习本节实验内容,可尝试自行编写程序,做好实验准备工作,填写实验报告。二、 实验内容1、编写程序,用B4区的二片74HC273控制16X16点阵的行;8255的PA、PB口控制16X16点阵的列;显示字符。 2、按图连接线路;运行程序,观
2、察实验结果,学会编程控制LED点阵显示字符。三、 实验原理图四、 实验步骤1、 连线说明: D3区:CS(8255)、A0、A1A3区:CS1、A0、A1D3区:JP23(PA)、JP20(PB)A2区:JP21、JP22(列输出线)B4区:JP57(D0.D7)A3区:JP42(D0.D7)B4区:JP56(D8.D15)A3区:JP40(D8.D15)B4(I/O)区:CS273、BLE、BHEA3区:CS5、BLE、BHEB4(I/O)区:RD、WRA3区:IOR、IOWB4(I/O)区:JP51、JP55A2区:JP14、JP15(行输出线)(注意连线方向) 2、 运行程序,观察实验结
3、果。运行演示程序将会看到字符“欢迎使用星研实验仪”在点阵上自下而上循环移动显示。五、 实验代码对实验六中的代码做一定的修改,将原程序中使LED显示屏从上至下显示的功能改为从左至右滚动显示有框线部分为修改部分ADDR_8255_PA EQU 270H ;8255 PA口ADDR_8255_PB EQU 271H ;8255 PB口ADDR_8255_C EQU 273H ;8255控制口ADDR_273 EQU 230H ;IO区74HC273(16位I/O)LINE EQU ADDR_273 ;行线1, 行线2ROW1 EQU ADDR_8255_PA ;列线1ROW2 EQU ADDR_82
4、55_PB ;列线2 _STACK SEGMENT STACK DW 1024 DUP(?) _STACK ENDS _DATA SEGMENT WORD PUBLIC DATA HUAN DB 00H,0C0H,00H,0C0H,0FEH,0C0H,07H,0FFH,0C7H,86H,6FH,6CH,3CH,60H,18H,60HDB 1CH,60H,1CH,70H,36H,0F0H,36H,0D8H,61H,9CH,0C7H,0FH,3CH,06H,00H,00HYING DB 60H,00H,31H,0C0H,3FH,7EH,36H,66H,06H,66H,06H,66H,0F6H,66
5、H,36H,66HDB 37H,0E6H,37H,7EH,36H,6CH,30H,60H,30H,60H,78H,00H,0CFH,0FFH,00H,00HSHI DB 00H,00H,06H,30H,07H,30H,0FH,0FFH,0CH,30H,1FH,0FFH,3BH,33H,7BH,33HDB 1BH,0FFH,1BH,33H,19H,0B0H,18H,0E0H,18H,60H,18H,0FCH,19H,8FH,1FH,03HYONG DB 00,0,1FH,0FEH,18H,0C6H,18H,0C6H,18H,0C6H,1FH,0FEH,018H,0C6H,18H,0C6HDB 1
6、8H,0C6H,1FH,0FEH,18H,0C6H,18H,0C6H,30H,0C6H,30H,0C6H,60H,0DEH,0C0H,0CCHXING DB 00H,00H,1FH,0FCH,18H,0CH,1FH,0FCH,18H,0CH,1FH,0FCH,01H,80H,19H,80HDB 1FH,0FEH,31H,80H,31H,80H,6FH,0FCH,01H,80H,01H,80H,7FH,0FFH,00H,00HYAN DB 00H,00H,0FFH,0FFH,18H,0CCH,18H,0CCH,30H,0CCH,30H,0CCH,7FH,0FFH,7CH,0CCHDB 0FCH,
7、0CCH,3CH,0CCH,3CH,0CCH,3DH,8CH,3DH,8CH,33H,0CH,06H,0CH,0CH,0CHSHI0 DB 01H,80H,00H,0C0H,3FH,0FFH,3CH,06H,67H,0CCH,06H,0C0H,0CH,0C0H,07H,0C0HDB 06H,0C0H,7FH,0FFH,00H,0C0H,01H,0E0H,03H,30H,06H,18H,1CH,1CH,70H,18HYAN0 DB 00H,00H,0FCH,60H,0CH,60H,6CH,0F0H,6CH,0D8H,6DH,8FH,6FH,0F8H,7EH,00HDB 06H,0C6H,07H,
8、66H,3FH,0ECH,0E7H,0ECH,06H,18H,1FH,0FFH,0CH,00H,00H,00HYI DB 0CH,0C0H,0CH,60H,18H,7CH,1BH,6CH,33H,0CH,73H,18H,0F1H,98H,31H,98HDB 30H,0F0H,30H,0F0H,30H,60H,30H,0F0H,31H,98H,33H,0FH,3EH,06H,30H,00HNONE DB 00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00HDB 00H,00H,00H,00H,00H,00H,00H,00H
9、,00H,00H,00H,00H,00H,00H,00H,00HCHANGE_RESULT DB 00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00HDB 00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H_DATA ENDS CODESEGMENTSTARTPROCNEARASSUMECS:CODE, DS:_DATA, SS:_STACKMOVAX,_DATAMOVDS,AXNOPCALLINIT_IOCALLTEST_LED;调用测试子程序
10、,测试LED是否全亮CALLCLEARLEASI,HUAN;取首个汉字的有效地址CHS_SHOW:MOVCX,9;九个汉字CALL WORD_MOVE;字模拷贝CHS_1:PUSHCX;CHS_1可以滚动显示多个字符MOVCX,16CHS_2:CALLDISP_CH ;实现显示,DISP_CH可以把每个汉字的32个字节读完并显示出来;INCSI;原程序用于滚动显示的指令;INCSILEA SI,CHANGE_RESULT;除了第一次,每次的汉字读取都去CHANGE_RESULT找,只显示CHANGE_RESULT开头的32个字节CALL WORD_CHANGE;将WORD_CHANGE中的字模
11、左移一位LOOPCHS_2POPCXLOOPCHS_1;读下一个汉字CALL WORD_MOVE;字模复位LEASI,CHANGE_RESULT;显示复位JMPCHS_SHOWWORD_MOVE PROC NEAR;给CHANGE_RESULT赋初值HUAN,把十个汉字都拷贝过来PUSHCXPUSH ESPUSHDSPUSHSIPUSHDILEA SI,HUAN源字节LEA DI,CHANGE_RESULT;目的字节MOV AX,DSMOVES,AXMOV CX,320CLDWORD_MOVE1:MOVSB;执行完毕后SI,DI自动加一LOOP WORD_MOVE1POPDIPOPSIPOPD
12、SPOPESPOPCXRETWORD_MOVE ENDPWORD_CHANGEPROCNEAR;把字模拷出来,将WORD_CHANGE中的字模全部整体左移一位PUSHCXPUSHDSPUSHESPUSHSIPUSHBXPUSHFXORBX,BXXOR AX,AXLEA SI,CHANGE_RESULTMOVAX,DSMOVES,AXMOVCX,320MOVE_TO_LAST:INCSILOOP MOVE_TO_LASTDEC SIDEC SIMOV CX,16;16行WORD_CHANGE1:CLC;CF寄存器清零,为后续字节移动做准备XOR AX,AXPUSH CXMOV CX,10;10个
13、字WORD_CHANGE2:CMP AL,AHJZ DONT_SAVE_CF2;保存CF标志位XOR AX,AXSTCDONT_SAVE_CF2:MOV BL,BYTE PTR SI;循环右移RCR BL,1MOV SI,BLINC SI;指向该行的下一个字节MOV BL,BYTE PTR SI;循环右移RCRBL,1MOV SI,BLJNC DONT_SAVE_CF;保存CF标志位MOV AL,01HDONT_SAVE_CF:SUB SI,33将SI指向下一个字LOOP WORD_CHANGE2ADD SI,33;补偿SIPOP CXADD SI,285将SI移向上一行起点LOOP WORD
14、_CHANGE1SUB SI,285;补偿SIPOPFPOPBXPOPSIPOPESPOPDSPOPCXRETWORD_CHANGE ENDP;显示一个16*16点阵字子程序,字型码放在DPTR指出的地址DISP_CHPROCNEAR ;把每个汉字的32个字节读完PUSHCXMOVCX,8DISP_CH_1:CALLDISP1LOOPDISP_CH_1POPCXRETDISP_CHENDP;显示一个16*16点阵字子程序,字型码放在显示缓冲区XBUFFDISP1PROCNEARPUSHSIPUSHCXMOVCX,16MOVBL,0FEHMOVBH,0FFHREPEAT:MOVAX,BXOUTD
15、X,AXLODSBCALLADJUSTMOVDX,ROW1OUTDX,ALLODSBCALLADJUSTMOVDX,ROW2OUTDX,ALCALLDL10MSCALLCLEARSTCRCLBL,1RCLBH,1LOOPREPEATPOPCXPOPSIRETDISP1ENDPINIT_IOPROCNEARMOVAL,80HOUTDX,ALRETINIT_IOENDPCLEARPROCNEARMOVAX,0FFFFHMOVDX,LINEMOVAL,0MOVDX,ROW1OUTDX,ALMOVDX,ROW2OUTDX,ALRETCLEARENDP;测试LED子程序,点亮LED并延时1STEST_L
16、EDPROCNEARMOVDX,LINEXORAX,AXOUTDX,AXMOVAL,0FFHMOVDX,ROW1OUTDX,ALMOVDX,ROW2OUTDX,ALCALLDL500msCALLDL500msRETTEST_LEDENDP;调整AL中取到的字型码的一个字节,将最高位调整位最低位,最低位调整为最高位ADJUSTPROCNEARPUSHCXMOVCX,8ADJUST1:RCLAL,1XCHGAL,AHRCRAL,1XCHGAL,AHLOOPADJUST1MOVAL,AHPOPCXRETADJUSTENDPDL10msPROCNEARPUSHCXMOVCX,133LOOP$POPCX
17、RETDL10msENDPDL500msPROCNEARPUSHCXMOVCX,0FFFFHLOOP$POPCXRETDL500msENDPSTARTENDPCODEENDSENDSTARTCODESEGMENTSTARTPROCNEARASSUMECS:CODE, DS:_DATA, SS:_STACKMOVAX,_DATAMOVDS,AXMOVES,AXNOPCALLINIT_IOCALLTEST_LED实验十四:电子钟一、 实验目的进一步熟悉8253、8259、8279 二、 实验内容1、使用8253定时功能,产生0.5S的定时中断给82592、在F5区的数码管上显示时间3、允许设置时钟初值三、 实验步骤1、 连线说明: D3区 :CS、A0、A1A3区:CS1、A0、A1D3区 :PC0、PC1F5区:KL1、KL2D3区 :JP20(PB)、B、CF5区:A、B、CB3区 :CS、A0A3区:CS3、A0B3区:INT、INTAA3区:INTR、INTAB3区:IR0C4区 :OUT0C4区 :CS(8253)、A0、A1A3区:CS2、A0、A1(注意连线方向) 2、 运行程序,按F5区的F键,设置时钟初值。3、 观察F5区数码管上显示的时间是否正确 四、 功能修改实验代码IO8259_0 EQU 0250H I
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1