* lcd1602显示 遥控键值读取器 * * lcd1602显示 遥控器接p3.2 * * 喇叭接p3.7 继电器接p1.0 * * 17(40H)键按下,继电器吸合。19(04h)键按下,继电器关闭。
上传时间: 2014-01-22
上传用户:来茴
比如第二行第一个字符的地址是40H,那么是否直接写入40H就可以将光标定位在第二行第一个字符的位置呢?这样不行,因为写入显示地址时要求最高位D7恒定为高电平1所以实际写入的数据应该是01000000B(40H)+10000000B(80H)=11000000B(C0H)
上传时间: 2017-01-29
上传用户:wpwpwlxwlx
从1302中读出的数据放在 52H(小时)51H(分钟)50H(秒) 显示缓冲单元 72H-73H(45H-44H)小时,75H-76H(43H-42H)分钟,78H-79H(41H-40H)秒 定时器T1为调整时候闪烁用。 显示式样第一行为: 时间: 15:38:12 显示式样第二行为: 中文字符共7个
上传时间: 2013-12-26
上传用户:日光微澜
1数据传送与多字节十进制加法实验 1. 数据传送实验 把数据0A0H放到地址为40H内存单元,并将数值和地址分别递增1,要求一共做十次这样的操作。 将内存空间40H-49H的数值分别传递给50H-59H的内存空间中 2. 多字节十进制加法实验 将存放在单片机内部RAM中以40H为首的3个地址单元中的一十进制数与存放在50H为首的3个地址单元中的一十进制数相加,将相加结果存放在以60H为首的地址RAM地址单元中。 2要求在8个LED数码管显示8个指定的数(例如学号)。 编程提示:数码管模块具有两个地址:片选地址和数据(段码)地址,要在某个数码管上显示1个数,需要先向片选地址上送一个数选中其中一个数码管,在向数据地址送要显示的数据的段码值。要8位同时显示,需要采用动态刷新的方式将8位数码管轮流显示。 共阳极数码管段码:C0H,F9H,A4H,B0H,99H,92H,82H,F8H,80H,90H对应0~9
上传时间: 2014-01-20
上传用户:lanjisu111
带中文字库的128X64是一种具有4位/8位并行、2线或3线串行多种接口方式,内部含有国标一级、二级简体中文字库的点阵图形液晶显示模块;其显示分辨率为128×64, 内置8192个16*16点汉字,和128个16*8点ASCII字符集.利用该模块灵活的接口方式和简单、方便的操作指令,可构成全中文人机交互图形界面。可以显示8×4行16×16点阵的汉字. 也可完成图形显示.低电压低功耗是其又一显著特点。由该模块构成的液晶显示方案与同类型的图形点阵液晶显示模块相比,不论硬件电路结构或显示程序都要简洁得多,且该模块的价格也略低于相同点阵的图形液晶模块。 基本特性: 低电源电压(VDD:+3.0--+5.5V) 显示分辨率:128×64点 内置汉字字库,提供8192个16×16点阵汉字(简繁体可选) 内置 128个16×8点阵字符 2MHZ时钟频率 显示方式:STN、半透、正显 驱动方式:1/32DUTY,1/5BIAS 视角方向:6点 背光方式:侧部高亮白色LED,功耗仅为普通LED的1/5—1/10 通讯方式:串行、并口可选 内置DC-DC转换电路,无需外加负压 无需片选信号,简化软件设计 工作温度: 0℃ - +55℃ ,存储温度: -20℃ - +60℃ 12864(带字库汉字显示演示程序) ;*************************************************************************** ;* sxj1974@163.com (51c51 test web) www.8951.com * ;* Create by :石学军 www.51c51.com 更多例程请登陆网站 * ;*************************************************************************** RS EQU P2.0 RW EQU P2.1 E EQU P2.2 PSB EQU P2.3 RST EQU P2.5 ;----------------------------------------------- LCD_X EQU 30H LCD_Y EQU 31H COUNT EQU 32H COUNT1 EQU 33H COUNT2 EQU 34H COUNT3 EQU 35H ;----------------------------------------------- LCD_DATA EQU 36H LCD_DATA1 EQU 37H LCD_DATA2 EQU 38H STORE EQU 39H ;----------------------------------------------- ORG 0000H LJMP MAIN ORG 0100H ;----------------------------------------------- MAIN: MOV SP,#5FH CLR RST ;复位 LCALL DELAY4 SETB RST NOP SETB PSB ;通讯方式为8位数据并口 ;********************初始化********************** LGS0: MOV A,#34H ;34H--扩充指令操作 LCALL SEND_I MOV A,#30H ;30H--基本指令操作 LCALL SEND_I MOV A,#01H ;清除显示 LCALL SEND_I MOV A,#06H ;指定在资料写入或读取时,光标的移动方向 LCALL SEND_I ;DDRAM 的地址计数器(AC)加1 MOV A,#0CH ;开显示,关光标,不闪烁 LCALL SEND_I ;=============================================== TU_PLAY1: MOV DPTR,#TU_TAB1 ;显示图形 LCALL PHO_DISP LCALL DELAY3 ;================================================= ;;显示汉字和字符 ;加入80ms的延时,使你能够看清楚显示的过程 ;根据汉字显示坐标分段写入(顺序写入) ;================================================= HAN_WR2: LCALL CLEAR_P HAN_WR2A: MOV DPTR,#TAB1A ;显示汉字和字符 MOV COUNT,#10H ;地址计数器设为16。 MOV A,#80H ;第一行起始地址 LCALL SEND_I LCALL QUSHU HAN_WR2B: MOV DPTR,#TAB1B ;显示汉字和字符 MOV COUNT,#10H ;地址计数器设为16。 MOV A,#90H ;第二行起始地址 LCALL SEND_I LCALL QUSHU HAN_WR2C: MOV DPTR,#TAB1C ;显示汉字和字符 MOV COUNT,#10H ;地址计数器设为16。 MOV A,#88H ;第三行起始地址 LCALL SEND_I LCALL QUSHU HAN_WR2D: MOV DPTR,#TAB1D ;显示汉字和字符 MOV COUNT,#10H ;地址计数器设为16。 MOV A,#98H ;第四行起始地址 LCALL SEND_I LCALL QUSHU LCALL DELAY3 LCALL FLASH LCALL CLEAR_P JMP TU_PLAY2 ;---------------------------------------------- ;TU_PLAY1: MOV DPTR,#TU_TAB1 ;显示图形 LCALL PHO_DISP LCALL DELAY3 ;---------------------------------------------- TU_PLAY2: MOV DPTR,#TU_TAB2 ;显示图形 LCALL PHO_DISP LCALL DELAY3 ;---------------------------------------------- TU_PLAY3: MOV DPTR,#TU_TAB4 ;显示图形 LCALL PHO_DISP LCALL DELAY3 ;----------------------------------------------- ;显示点阵 ;----------------------------------------------- LATPLAY1: MOV A,#01H ;清屏 LCALL SEND_I MOV LCD_DATA1,#0CCH ;显示点阵 MOV LCD_DATA2,#0CCH LCALL LAT_DISP LCALL DELAY3 LCALL CLEAR_P KU_PLAY2: LJMP TU_PLAY1 ;=============================================== ;全屏显示图形子程序 ;=============================================== PHO_DISP: MOV COUNT3,#02H MOV LCD_X,#80H PHO_DISP1: MOV LCD_Y,#80H MOV COUNT2,#20H PHO_DISP2: MOV COUNT1,#10H LCALL WR_ZB PHO_DISP3: CLR A MOVC A,@A+DPTR LCALL SEND_D INC DPTR DJNZ COUNT1,PHO_DISP3 INC LCD_Y DJNZ COUNT2,PHO_DISP2 MOV LCD_X,#88H DJNZ COUNT3,PHO_DISP1 MOV A,#36H LCALL SEND_I MOV A,#30H LCALL SEND_I RET ;---------------------------------------------- CLRRAM: MOV LCD_DATA1,#00H ;GDRAM写0子程序 MOV LCD_DATA2,#00H LCALL LAT_DISP RET ;============================================== ;显示点阵子程序 ;============================================== LAT_DISP: MOV COUNT3,#02H MOV LCD_X,#80H LAT_DISP1: MOV LCD_Y,#80H CLR F0 MOV COUNT2,#20H LAT_DISP2: MOV COUNT1,#10H LCALL WR_ZB LAT_DISP3: JB F0,LAT_DISP32 MOV LCD_DATA,LCD_DATA1 AJMP LAT_DISP31 LAT_DISP32: MOV LCD_DATA,LCD_DATA2 LAT_DISP31: MOV A,LCD_DATA LCALL SEND_D DJNZ COUNT1,LAT_DISP31 INC LCD_Y CPL F0 DJNZ COUNT2,LAT_DISP2 MOV LCD_X,#88H DJNZ COUNT3,LAT_DISP1 MOV A,#36H LCALL SEND_I MOV A,#30H LCALL SEND_I RET ;--------------------------------------------- WR_ZB: MOV A,#34H LCALL SEND_I MOV A,LCD_Y LCALL SEND_I MOV A,LCD_X LCALL SEND_I MOV A,#30H LCALL SEND_I RET ;=============================================== FLASH: MOV A,#08H ;关闭显示 LCALL SEND_I LCALL DELAY5 MOV A,#0CH ;开显示,关光标,不闪烁 LCALL SEND_I LCALL DELAY5 MOV A,#08H ;关闭显示 LCALL SEND_I LCALL DELAY5 MOV A,#0CH ;开显示,关光标,不闪烁 LCALL SEND_I LCALL DELAY5 MOV A,#08H ;关闭显示 LCALL SEND_I LCALL DELAY5 RET ;================================================== ;清屏 ;================================================== CLEAR_P: MOV A,#01H ;清屏 LCALL SEND_I MOV A,#34H LCALL SEND_I MOV A,#30H LCALL SEND_I RET ;================================================== ;查表取数据送显示 ;================================================== QUSHU: CLR A MOVC A,@A+DPTR ;查表取数据 LCALL SEND_D ;送显示 INC DPTR LCALL DELAY4 ;延时80ms, DJNZ COUNT,QUSHU RET ;=============================================== ;写数据子程序 ;RS=1,RW=0,E=高脉冲,D0-D7=数据 ;=============================================== SEND_D: LCALL CHK_BUSY ;写数据子程序 SETB RS CLR RW MOV P0,A SETB E NOP NOP CLR E RET ;=============================================== ;写指令子程序 ;RS=0,RW=0,E=高脉冲,D0-D7=指令码 ;=============================================== SEND_I: LCALL CHK_BUSY CLR RS CLR RW MOV P0,A SETB E NOP NOP CLR E RET ;================================================ ;读数据子程序 ;RS=1,RW=1,E=H,D0-D7=数据 ;================================================ READ_D: LCALL CHK_BUSY ;读数据子程序 SETB RS SETB RW SETB E NOP MOV A,P0 CLR E MOV STORE,A RET ;================================================ ;;测忙碌子程序 ;RS=0,RW=1,E=H,D0-D7=状态字 ;================================================ CHK_BUSY: MOV P0,#0FFH ;测忙碌子程序 CLR RS SETB RW SETB E JB P0.7,$ CLR E RET ;================================================ ;延时子程序 DELAY3: MOV R5,#16H DEL31: MOV R6,#100 DEL32: MOV R7,#0FFH DEL33: DJNZ R7,DEL33 DJNZ R6,DEL32 DJNZ R5,DEL31 RET DELAY2: MOV R6,#0CH DEL21: MOV R7,#18H DEL22: DJNZ R7,DEL22 DJNZ R6,DEL21 RET DELAY1: MOV R6,#06H DEL11: MOV R7,#08H DEL12: DJNZ R7,DEL12 DJNZ R6,DEL11 RET DELAY4: MOV R6,#100 DEL41: MOV R7,#200 DEL42: DJNZ R7,DEL42 DJNZ R6,DEL41 RET DELAY5: MOV R5,#05H DEL51: MOV R6,#100 DEL52: MOV R7,#0FFH DEL53: DJNZ R7,DEL53 DJNZ R6,DEL52 DJNZ R5,DEL51 RET ;*********************************************** TAB1: TAB1A: DB ' 51单片机学习网(深圳学林电子有限公司) ' ;显示在第一行 TAB1C: DB '自学单片机第一站' ;显示在第三行 TAB1B: DB ' WWW.8951.COM ' ;显示在第二行 TAB1D: DB 'TEL 755-89956892' ;显示在第四行 ;*-------------------------------------------------------------------- * ;* Bitmap点阵数据表 * ;* 图片: E:\图形8.bmp,横向取模左高位,数据排列:从左到右从上到下 * ;* 图片尺寸: 128 * 64 * ;*-------------------------------------------------------------------- * TU_TAB1: ; 数据表 db 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 00h, 3Ch, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 00h, 7Fh, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 00h,0FFh,0C0h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 01h,0BFh,0F8h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 01h,0FFh,0DCh, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 01h, 1Fh,0FEh, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 01h,0DFh,0FFh, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 00h,0FFh,0FFh, 19h, 8Ch, 03h, 06h, 00h, 18h, 00h,0FFh,0E1h db 80h, 00h, 00h, 00h, 00h, 3Fh,0FFh, 0Ch,0CCh, 03h, 06h, 00h, 18h, 00h,0FFh,0E1h db 80h, 00h, 00h, 00h, 00h, 7Fh,0FFh, 04h, 58h, 03h, 06h, 01h,0FFh,0C0h, 00h,0C1h db 80h, 00h, 00h, 00h, 00h, 7Fh,0DAh, 3Fh,0FEh, 0Fh,0DFh,0C1h,0FFh,0C0h, 01h, 81h db 80h, 00h, 00h, 00h, 00h, 7Fh, 8Ch, 3Fh,0FEh, 0Fh,0DFh,0C1h, 98h,0C0h, 07h, 01h db 80h, 00h, 00h, 00h, 00h, 7Fh,0B8h, 30h, 06h, 03h, 06h, 01h, 98h,0C0h, 06h, 01h db 80h, 00h, 00h, 00h, 00h,0FEh,0C0h, 0Fh,0F8h, 03h, 8Eh, 01h,0FFh,0C3h,0FFh,0F9h db 80h, 00h, 00h, 00h, 00h, 7Eh, 00h, 0Fh,0F8h, 07h,0CFh, 01h, 98h,0C3h,0FFh,0F9h db 80h, 00h, 00h, 00h, 00h, 7Fh, 00h, 00h, 60h, 07h, 5Fh, 81h, 98h,0C0h, 06h, 01h db 80h, 00h, 00h, 00h, 00h, 7Fh, 80h, 3Fh,0FEh, 0Fh, 36h,0C1h,0FFh,0C0h, 06h, 01h db 80h, 00h, 00h, 00h, 00h, 1Fh, 80h,0BFh,0FEh, 0Bh, 36h, 61h,0FFh,0C0h, 06h, 01h db 80h, 00h, 00h, 00h, 00h, 1Fh,0C7h, 00h,0C0h, 03h, 66h, 21h, 98h, 30h, 06h, 01h db 80h, 00h, 00h, 00h, 15h, 5Fh,0C7h, 00h,0C0h, 03h, 06h, 00h, 18h, 30h, 06h, 01h db 80h, 00h, 02h,0E0h, 06h, 7Fh,0CEh, 03h,0C0h, 03h, 06h, 00h, 1Fh,0F0h, 1Eh, 01h db 80h, 00h, 04h, 54h, 4Fh,0FFh,0FCh, 01h, 80h, 03h, 06h, 00h, 0Fh,0E0h, 0Ch, 01h db 80h, 00h, 03h,0FDh, 3Fh,0FFh,0D9h,0C0h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 1Dh,0FFh,0FFh,0FFh, 87h, 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 2Bh,0FFh,0F8h, 7Fh, 06h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 3Fh,0BFh,0F8h, 09h, 0Fh, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 1Fh, 9Fh,0F0h, 00h,0BCh, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 9Dh,0FEh, 1Fh, 8Fh,0F0h, 00h,0F8h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 9Fh,0FCh, 17h, 8Fh,0F0h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 81h,0FFh,0CFh, 9Fh,0E0h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 82h,0FFh,0FFh, 9Ch, 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 81h, 7Fh,0FFh,0FCh, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 6Fh,0FEh, 30h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 03h,0FCh, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 34h, 14h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 0Eh, 18h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 02h, 30h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 01h,0E0h, 00h, 00h, 7Fh, 04h, 00h, 3Fh, 82h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 00h, 00h, 7Fh, 0Ch, 00h, 3Fh, 86h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 00h, 00h, 7Fh, 1Ch, 00h, 3Fh, 8Eh, 00h, 00h, 00h, 00h, 01h db 83h,0BBh, 9Dh,0DCh,0EEh,0E0h, 70h, 7Ch, 38h, 38h, 3Eh, 00h,0E0h, 38h, 3Bh, 31h db 83h,0BBh, 9Dh,0DCh,0EEh,0E0h, 70h, 7Ch, 3Ch, 38h, 3Eh, 00h,0F0h, 7Ch, 3Fh,0F9h db 83h,0BBh, 9Dh,0DCh,0EEh,0E0h, 76h, 1Ch, 7Eh, 3Bh, 0Eh, 01h,0F8h,0FEh, 3Fh,0F9h db 83h,0BBh, 9Dh,0DCh,0EEh,0E0h, 7Fh, 1Ch, 76h, 3Fh, 8Eh, 01h,0D8h,0EEh, 3Bh,0B9h db 83h,0BBh, 9Dh,0DCh,0EEh,0E0h, 7Fh, 1Ch, 76h, 3Fh, 8Eh, 01h,0D8h,0EEh, 3Bh,0B9h db 83h,0BBh, 9Dh,0DCh,0EEh,0E0h, 77h, 1Ch, 76h, 3Bh, 8Eh, 01h,0D8h,0EEh, 3Bh,0B9h db 81h,0BBh, 0Dh,0D8h, 6Eh,0C0h, 07h, 1Ch, 70h, 03h, 8Eh, 01h,0C0h,0EEh, 3Bh,0B9h db 81h,0ABh, 0Dh, 58h, 6Ah,0C0h, 07h, 1Ch, 70h, 03h, 8Eh, 01h,0C0h,0EEh, 3Bh,0B9h db 81h,0ABh, 0Dh, 58h, 6Ah,0C0h, 77h, 1Ch, 70h, 3Bh, 8Eh, 01h,0C0h,0EEh, 3Bh,0B9h db 81h,0ABh, 0Dh, 58h, 6Ah,0C0h, 77h, 1Ch, 76h, 3Bh, 8Eh, 01h,0D8h,0EEh, 3Bh,0B9h db 81h,0EFh, 0Fh, 78h, 7Bh,0C0h, 77h, 1Ch, 76h, 3Bh, 8Eh, 01h,0D8h,0EEh, 3Bh,0B9h db 81h,0EFh, 0Fh, 78h, 7Bh,0DCh, 77h, 1Ch, 76h, 3Bh, 8Eh, 39h,0D8h,0EEh, 3Bh,0B9h db 81h,0EFh, 0Fh, 78h, 7Bh,0DCh, 7Fh, 1Ch, 7Eh, 3Fh, 8Eh, 39h,0F8h,0FEh, 3Bh,0B9h db 81h,0EFh, 0Fh, 78h, 7Bh,0DCh, 3Eh, 1Ch, 3Ch, 1Fh, 0Eh, 38h,0F0h, 7Ch, 3Bh,0B9h db 81h,0EFh, 0Fh, 78h, 7Bh,0DCh, 1Ch, 1Ch, 3Ch, 0Eh, 0Eh, 38h,0F0h, 78h, 3Bh,0B9h db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh ;*-------------------------------------------------------------------- * ;* Bitmap点阵数据表 * ;* 图片: E:\图形12.bmp,横向取模左高位,数据排列:从左到右从上到下 * ;* 图片尺寸: 128 * 64 * ;*-------------------------------------------------------------------- * TU_TAB2: ; 数据表 db 40H, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 03h, 65h,0E8h, 80h, 00h, 01h db 9Ah,0D6h,0B4h, 42h, 00h, 00h, 00h, 00h, 00h, 00h, 34h,0DAh,0D0h, 00h, 00h, 01h db0A4h, 00h, 02h, 10h, 6Bh, 30h, 00h, 00h, 00h, 00h, 8Bh,0FFh, 30h, 00h, 00h, 01h db 42h,0D6h,0B0h, 42h, 80h, 00h, 00h, 00h, 00h, 16h, 77h,0FEh,0C0h, 00h, 00h, 01h db 42h,0D6h,0B0h, 42h, 80h, 00h, 00h, 00h, 00h, 16h, 77h,0FEh,0C0h, 00h, 00h, 01h db0B9h, 20h, 04h, 00h, 00h, 02h, 10h, 00h, 00h, 00h,0BCh,0BCh, 00h, 00h, 00h, 01h db 46h,0D6h,0B1h,0ACh, 6Bh, 30h, 00h, 00h, 02h, 29h,0CBh, 40H, 00h, 00h, 00h, 01h db0FFh,0F9h, 04h, 01h, 00h, 00h, 00h, 00h, 01h, 16h,0B4h,0A0h, 00h, 00h, 00h, 01h db0FFh,0FFh,0F2h, 50h, 00h, 40H, 00h, 00h, 00h, 29h, 4Bh, 00h, 00h, 00h, 00h, 01h db0FFh,0FFh,0F2h, 50h, 00h, 40H, 00h, 00h, 00h, 29h, 4Bh, 00h, 00h, 00h, 00h, 01h db0FFh,0FFh,0BDh, 82h, 94h, 00h, 40H, 00h, 00h,0C9h, 30h, 02h, 00h, 00h, 00h, 01h db0FFh,0FFh,0FBh,0B0h, 00h, 08h, 00h, 00h, 05h, 16h, 44h, 40H, 00h, 00h, 00h, 01h db0FFh,0FFh,0FFh,0EFh, 90h, 40H, 00h, 00h, 00h, 21h, 00h, 04h,0C8h, 30h, 00h, 01h db0A5h,0FFh,0FFh,0FDh, 6Bh, 00h, 00h, 00h, 00h,0C8h, 00h, 99h, 16h,0FAh, 40H, 01h db0A5h,0FFh,0FFh,0FDh, 6Bh, 00h, 00h, 00h, 00h,0C8h, 00h, 99h, 16h,0FAh, 40H, 01h db 82h, 2Fh,0FFh,0FFh,0E8h, 84h, 00h, 00h, 00h, 00h, 08h, 00h,0DFh,0FFh,0ECh, 01h db 24h,0C1h, 7Fh,0FFh,0F4h, 30h, 00h, 00h, 00h, 00h, 00h,0A7h,0FFh,0FFh,0FCh, 01h db 42h, 28h, 05h,0BFh,0FBh, 80h, 00h, 00h, 00h, 00h, 04h, 1Bh,0FFh,0FFh,0FFh, 81h db 98h,0C1h, 4Ah, 53h,0ECh, 48h, 00h, 00h, 00h, 00h, 40H, 7Fh,0FFh,0FFh,0FFh,0E1h db 98h,0C1h, 4Ah, 53h,0ECh, 48h, 00h, 00h, 00h, 00h, 40H, 7Fh,0FFh,0FFh,0FFh,0E1h db 42h, 28h, 00h, 0Ch, 77h, 82h, 00h, 00h, 00h, 00h, 33h,0BFh,0FFh,0FFh,0FFh, 89h db 18h,0C1h, 4Ah, 51h, 9Bh, 74h, 00h, 00h, 00h, 00h, 04h,0FFh, 3Fh,0FFh,0DFh,0F1h db0C2h, 28h, 00h, 0Ch, 04h, 80h, 00h, 00h, 00h, 00h, 40H,0FEh, 1Fh,0F9h,0C3h,0F9h db 1Ah,0D6h,0B5h,0A1h, 6Bh, 75h, 80h, 00h, 00h, 00h, 8Fh,0FCh, 3Fh,0F2h, 0Fh, 1Fh db 1Ah,0D6h,0B5h,0A1h, 6Bh, 75h, 80h, 00h, 00h, 00h, 8Fh,0FCh, 3Fh,0F2h, 0Fh, 1Fh db0C5h, 29h, 79h, 8Ch, 00h, 88h, 00h, 00h, 00h, 00h, 03h,0F8h, 1Fh,0C8h, 52h, 81h db 22h,0FFh,0FFh,0F2h, 6Bh, 35h, 80h, 00h, 00h, 00h, 37h,0C2h, 3Fh,0FBh,0FCh, 09h db 9Ah,0FFh,0FFh,0FFh, 00h, 48h, 00h, 00h, 00h, 00h, 07h,0D8h, 1Fh,0FFh,0E3h, 81h db 9Ah,0FFh,0FFh,0FFh, 00h, 48h, 00h, 00h, 00h, 00h, 07h,0D8h, 1Fh,0FFh,0E3h, 81h db 47h,0FFh,0FFh,0FFh,0F3h, 35h, 80h, 00h, 00h, 00h, 8Fh,0C1h, 0Fh,0FFh,0ACh, 01h db0B9h,0FFh,0FFh,0FFh,0FCh, 4Ah, 20h, 00h, 00h, 00h, 0Fh,0A4h, 07h,0FEh, 40H, 01h db 5Fh,0FFh,0C7h,0FFh,0FCh,0B5h, 80h, 00h, 00h, 00h, 4Fh,0DAh,0FFh,0F8h, 00h, 01h db0A7h,0FFh,0B7h,0FFh,0FFh, 8Ah, 20h, 00h, 00h, 00h, 0Fh,0FFh,0EFh, 40H, 00h, 01h db0A7h,0FFh,0B7h,0FFh,0FFh, 8Ah, 20h, 00h, 00h, 00h, 0Fh,0FFh,0EFh, 40H, 00h, 01h db 7Fh,0FFh, 47h,0FDh, 7Fh,0C5h, 80h, 00h, 00h, 00h, 3Fh,0DAh,0D0h, 00h, 00h, 01h db0A7h,0FEh, 37h,0FFh, 7Ch,0FAh, 50h, 00h, 00h, 00h, 0Ch,0A4h, 08h, 00h, 00h, 01h db0DFh,0FEh, 43h,0FFh,0F8h,0C1h, 80h, 00h, 00h, 00h, 48h, 01h, 00h, 00h, 00h, 01h db 27h,0FFh, 4Bh,0FFh,0FFh,0FAh, 2Ch, 00h, 00h, 00h, 03h, 58h, 20h, 00h, 00h, 01h db 27h,0FFh, 4Bh,0FFh,0FFh,0FAh, 2Ch, 00h, 00h, 00h, 03h, 58h, 20h, 00h, 00h, 01h db 9Bh,0FFh,0C3h,0FFh,0FFh,0F1h,0C0h, 00h, 00h, 00h, 08h, 00h, 00h, 00h, 00h, 01h db 64h, 3Fh,0FDh,0FFh, 6Bh, 7Ch, 10h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 03h,0D7h,0FFh,0FDh, 10h, 01h,0A0h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db0D8h, 29h, 4Fh,0A2h, 80h,0B5h, 90h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db0D8h, 29h, 4Fh,0A2h, 80h,0B5h, 90h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 05h, 10h,0B0h, 4Ch, 0Bh, 08h, 40H, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db0A0h,0C9h, 0Ah, 00h, 00h, 42h, 10h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 04h, 10h, 40H, 21h, 64h, 09h,0A0h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db0A2h,0C1h, 35h, 8Ch, 00h, 44h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db0A2h,0C1h, 35h, 8Ch, 00h, 44h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 00h, 16h, 00h, 21h, 14h, 09h,0A0h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db0A5h, 00h,0B5h, 80h, 83h, 44h, 0Ch, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 00h, 26h, 00h, 12h, 08h, 09h,0A0h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db0DAh, 00h,0B4h, 40H, 60h, 44h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db0DAh, 00h,0B4h, 40H, 60h, 44h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h,0C8h, 00h, 00h, 04h, 01h,0A0h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db0A2h, 20h, 89h, 91h, 10h, 8Ah, 10h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 44h, 06h, 00h, 00h, 00h, 30h, 40H, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 44h, 06h, 00h, 00h, 00h, 30h, 40H, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh ;*-------------------------------------------------------------------- * ;*-------------------------------------------------------------------- * ;* Bitmap点阵数据表 * ;* 图片: E:\图形13.bmp,横向取模左高位,数据排列:从左到右从上到下 * ;* 图片尺寸: 128 * 64 * ;*-------------------------------------------------------------------- * TU_TAB4: ; 漂亮姑娘看过来 db 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 11h,0FFh, 80h, 40H, 08h, 30h, 10h, 20h, 00h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Ch, 68h, 3Fh,0FFh, 08h, 30h, 11h,0F8h, 00h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Ch, 68h, 3Fh,0FFh, 08h, 30h, 11h,0F8h, 00h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h,0FFh, 00h, 00h, 7Fh,0FEh, 7Dh, 08h, 00h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 11h, 6Bh, 07h,0FCh, 16h, 30h, 2Dh,0F8h, 00h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Dh,0FFh, 04h, 0Ch, 16h, 30h, 2Dh, 08h, 00h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Ch, 00h, 3Fh,0FFh, 16h, 30h, 2Dh,0F8h, 00h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Ch, 00h, 3Fh,0FFh, 16h, 30h, 2Dh,0F8h, 00h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Ch,0FFh, 30h, 01h, 66h,0FEh, 2Dh, 26h, 00h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 1Ch, 00h, 03h,0F0h, 76h, 82h, 2Dh, 28h, 00h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Dh,0FFh, 82h, 11h, 08h, 82h, 11h, 10h, 00h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Ch, 8Bh, 04h, 11h, 16h, 82h, 2Dh, 28h, 00h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Ch, 8Bh, 04h, 11h, 16h, 82h, 2Dh, 28h, 00h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Dh, 18h,0B8h, 1Fh, 60h,0FEh, 41h,0C6h, 00h db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h db 00h, 07h, 8Fh,0FFh, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h db 00h, 08h, 70h, 40H,0EFh, 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h db 00h, 08h, 70h, 40H,0EFh, 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h db 00h, 10h, 00h, 80h, 10h, 60h, 00h, 0Fh,0FFh, 30h, 0Ch, 00h, 80h, 00h, 00h, 00h db 00h, 20h, 18h, 38h, 20h, 60h, 00h, 00h, 60h, 08h, 0Ch, 1Fh,0FCh, 1Ch, 00h, 00h db 00h,0C0h, 64h, 45h, 00h, 60h, 00h, 03h,0FCh, 0Bh,0FFh, 00h, 80h, 3Eh, 00h, 00h db 00h,0C1h, 00h, 01h, 00h, 10h, 00h, 00h, 80h, 00h, 0Ch, 08h, 88h, 3Eh, 00h, 00h db 00h,0C1h, 00h, 01h, 00h, 10h, 00h, 00h, 80h, 00h, 0Ch, 08h, 88h, 3Eh, 00h, 00h db 01h, 01h, 00h, 00h,0C0h, 10h, 00h, 1Fh,0FFh,0BDh, 8Ch, 06h,0B0h, 3Eh, 00h, 00h db 02h, 0Eh, 18h, 1Ch,0C0h, 10h, 00h, 01h, 00h, 04h, 4Ch, 7Fh,0FEh, 1Ch, 00h, 00h db 02h, 16h, 64h, 22h, 20h, 10h, 00h, 03h,0FCh, 04h, 4Ch, 01h,0C0h, 1Ch, 00h, 00h db 02h, 16h, 64h, 22h, 20h, 10h, 00h, 03h,0FCh, 04h, 4Ch, 01h,0C0h, 1Ch, 00h, 00h db 04h,0E8h, 83h, 41h, 1Ch, 08h, 00h, 0Dh, 04h, 04h, 0Ch, 06h,0B0h, 00h, 00h, 00h db 07h, 10h, 8Fh, 47h, 03h, 88h, 00h, 11h,0FCh, 04h, 3Ch, 08h, 88h, 1Ch, 00h, 00h db 00h, 20h, 6Ch, 26h, 01h, 78h, 00h, 01h, 04h, 0Ah, 00h, 70h, 86h, 1Ch, 00h, 00h db 00h,0C0h, 18h, 1Ch, 00h, 80h, 00h, 01h,0FCh, 31h,0FFh, 00h, 80h, 00h, 00h, 00h db 00h,0C0h, 18h, 1Ch, 00h, 80h, 00h, 01h,0FCh, 31h,0FFh, 00h, 80h, 00h, 00h, 00h db 00h,0C1h, 87h, 80h, 00h, 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h db 01h, 06h, 78h, 3Ch, 20h, 60h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h db 01h, 08h, 07h,0C2h,0C0h, 60h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h db 01h, 08h, 00h, 01h,0C0h, 60h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h db 01h, 08h, 00h, 01h,0C0h, 60h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h db 01h, 08h, 18h, 01h,0C0h, 60h, 00h, 00h, 00h,0F1h,0F3h, 87h,0C0h, 00h, 00h, 00h db 00h,0C6h, 18h,0C2h, 20h, 80h, 00h, 00h, 03h, 0Eh, 1Ch, 78h, 70h, 00h, 00h, 00h db 00h,0C1h, 00h,0C2h, 00h, 80h, 00h, 00h, 04h, 44h, 11h, 10h, 38h, 00h, 00h, 00h db 00h, 26h,0E0h, 04h, 01h, 00h, 00h, 00h, 04h, 80h, 12h, 00h, 38h, 00h, 00h, 00h db 00h, 26h,0E0h, 04h, 01h, 00h, 00h, 00h, 04h, 80h, 12h, 00h, 38h, 00h, 00h, 00h db 00h, 11h, 18h, 38h, 03h, 00h, 00h, 00h, 04h, 80h, 12h, 00h, 38h, 00h, 00h, 00h db 00h, 0Eh, 87h,0C2h, 1Ch, 00h, 00h, 00h, 04h, 00h, 10h, 00h, 38h, 00h, 00h, 00h db 00h, 01h,0E0h, 04h,0E0h, 00h, 00h, 00h, 03h, 00h, 1Ch, 00h, 70h, 00h, 00h, 00h db 00h, 1Eh, 18h, 3Fh, 1Eh, 00h, 00h, 00h, 00h, 80h, 32h, 00h,0C0h, 00h, 00h, 00h db 00h, 1Eh, 18h, 3Fh, 1Eh, 00h, 00h, 00h, 00h, 80h, 32h, 00h,0C0h, 00h, 00h, 00h db 00h, 38h, 07h,0C0h, 0Fh, 00h, 00h, 00h, 00h, 40H, 61h, 01h, 80h, 00h, 00h, 00h db 00h,0E9h,0FFh,0FFh, 0Dh, 80h, 00h, 00h, 00h, 31h,0C0h, 87h, 00h, 00h, 00h, 00h db 01h,0E9h, 1Bh,0B9h, 0Dh,0E0h, 00h, 00h, 00h, 0Bh, 80h, 6Eh, 00h, 00h, 00h, 00h db 03h,0C9h,0F0h, 1Fh, 0Ch,0F0h, 00h, 00h, 00h, 06h, 00h, 18h, 00h, 00h, 00h, 00h db 03h,0C9h,0F0h, 1Fh, 0Ch,0F0h, 00h, 00h, 00h, 06h, 00h, 18h, 00h, 00h, 00h, 00h db 07h, 06h,0E0h, 06h, 10h, 78h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h db 07h,0C1h, 00h, 00h, 20h,0F8h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h db 07h,0E0h, 80h, 00h,0C1h,0F8h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h db 07h,0E0h, 80h, 00h,0C1h,0F8h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h db0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh end
上传时间: 2013-10-13
上传用户:123啊
单片机指令系统 3.1 MCS-51指令简介 3.2 指令系统 3.1 MCS-51指令简介 二、MCS-51系列单片机指令系统分类 按寻址方式分为以下七种:按功能分为以下四种: 1、立即立即寻址 1、数据传送指令位操 2、直接寻址 2、算术运算指令 3、寄存器寻址 3、逻辑运算指令 4、寄存器间接寻址指令 4、控制转移类指令 5、相对寻址 5、位操作指令 6、变址寻址 7、位寻址 三、寻址方式 3、寄存器间接寻址 MOV A, @R1 操作数是通过寄存器间接得到的。 4、立即寻址 MOV A, #40H 操作数在指令中直接给出。 5、基址寄存器加变址寄存器寻址 以DPTR或PC为基址寄存器,以A为变址寄存器, 以两者相加形成的16位地址为操作数的地址。 MOVC A, @A+DPTR MOVC A, @A+PC 四、指令中常用符号说明 Rn——当前寄存器区的8个工作寄存器R0~R7(n=0~7); Ri——当前寄存器区可作地址寄存器的2个工作寄存器R0和R1(i=0,1); direct——8位内部数据存储器单元的地址及特殊功能寄存器的地址; #data——表示8位常数(立即数); #datal6——表示16位常数; add 16——表示16位地址; addrll——表示11位地址; rel——8位带符号的地址偏移量; bit——表示位地址; @——间接寻址寄存器或基址寄存器的前缀; ( )——表示括号中单元的内容 (( ))——表示间接寻址的内容; 五、MCS-51指令简介 1. 以累加器A为目的操作数的指令 2. 以Rn为目的操作数的指令 3. 以直接地址为目的操作数的指令 4. 以寄存器间接地址为目的操作数指令 应用举例1 8段数码管显示 应用举例2 3.2 指令系统 2、堆栈操作指令 3. 累加器A与外部数据传输指令 4. 查表指令 MOVC A, @A+PC 例子: 5. 字节交换指令 6. 半字节交换指令 二、算术操作类指令 PSW寄存器 2. 带进位加法指令 3. 加1指令 4. 十进制调整指令 5. 带借位减法指令(Subtraction) 6. 减1指令(Decrease) 7. 乘法指令(Multiplication) 8. 除法指令(Division) 三、逻辑运算指令 1. 简单逻辑操作指令 2. 循环指令 带进位左循环指令(Rotate Accumulator Left through Carry flag) 右循环指令(Rotate Accumulator Right) 带进位右循环指令(Rotate A Right with C) 3. 逻辑与指令 4. 逻辑或指令 5. 逻辑异或指令 四、控制转移类指令 1. 跳转指令 相对转移指令 SJMP rel PC←(PC)+2 PC←(PC)+rel 程序中标号与地址之间的关系 2. 条件转移指令 3. 比较不相等转移指令 4. 减 1 不为 0 转移指令 5. 调用子程序指令 7. 中断返回指令 五、位操作指令 1. 数据位传送指令 2. 位变量逻辑指令 3. 条件转移类指令
上传时间: 2013-10-27
上传用户:xuanjie
全遥控6声道AV机的汇编程序:;;;;;;;;;;;;;;;;;;;6CH AMPLIFIER;;;;;;;;;;;;;;;;;----脚位定义-----;;;;;;;;;;;;;;;;;;;6CH AMPLIFIER;;;;;;;;;;;;;;;;;----脚位定义----- PT6311_CLK EQU P3.4PT6311_STB EQU P3.5PT6311_DATA EQU P3.3 UP EQU P3.1DOEN EQU P3.0 PT2313_DATA EQU P0.7PT2313_CLK EQU P2.7 AC3 EQU P2.6 ;(控制4053的信号) M62429_DA EQU P2.3 ;(SURL/R)M62429_CK EQU P2.4 M62429_CK1 EQU P2.5 ;(C/BW) M62429_CK3 EQU P0.0 ;(ECHO,MVOL)M62429_DA3 EQU P1.7M_DELAY1 EQU P0.1M_DELAY2 EQU P0.2 AD_OUT BIT P0.5AD_IN BIT P0.6 ;----片内RAM定义--------GIF_SIGN EQU 40H ; 动画进程标记(=1,走过场字幕 )GIF_TIME1 EQU 41H ; 动画跑字的时间间隔速度GIF_LONG EQU 42H ; 动画字幕的长度 DISP_BUFFER EQU 43H ; 显示缓冲区地址指针DISP_INDEX EQU 44H ; PT6311片内地址指针
上传时间: 2013-10-19
上传用户:fac1003
微型计算机课程设计论文—通用微机发声程序的汇编设计 本文讲述了在微型计算机中利用可编程时间间隔定时器的通用发声程序设计,重点讲述了程序的发声原理,节拍的产生,按节拍改变的动画程序原理,并以设计一个简单的乐曲评分程序为引子,分析程序设计的细节。关键字:微机 8253 通用发声程序 动画技术 直接写屏 1. 可编程时间间隔定时器8253在通用个人计算机中,有一个可编程时间间隔定时器8253,它能够根据程序提供的计数值和工作方式,产生各种形状和各种频率的计数/定时脉冲,提供给系统各个部件使用。本设计是利用计算机控制发声的原理,编写演奏乐曲的程序。 在8253/54定时器内部有3个独立工作的计数器:计数器0,计数器1和计数器2,每个计数器都分配有一个断口地址,分别为40H,41H和42H.8253/54内部还有一个公用的控制寄存器,端地址为43H.端口地址输入到8253/54的CS,AL,A0端,分别对3个计数器和控制器寻址. 对8353/54编程时,先要设定控制字,以选择计数器,确定工作方式和计数值的格式.每计数器由三个引脚与外部联系,见教材第320页图9-1.CLK为时钟输入端,GATE为门控信号输入端,OUT为计数/定时信号输入端.每个计数器中包含一个16位计数寄存器,这个计数器时以倒计数的方式计数的,也就是说,从计数初值逐次减1,直到减为0为止. 8253/54的三个计数器是分别编程的,在对任一个计数器编程时,必须首先讲控制字节写入控制寄存器.控制字的作用是告诉8253/54选择哪个计数器工作,要求输出什么样的脉冲波形.另外,对8253/54的初始化工作还包括,向选定的计数器输入一个计数初值,因为这个计数值可以是8为的,也可以是16为的,而8253/5的数据总线是8位的,所以要用两条输出指令来写入初值.下面给出8253/54初始化程序段的一个例子,将计数器2设定为方式3,(关于计数器的工作方式参阅教材第325—330页)计数初值为65536. MOV AL,10110110B ;选择计数器2,按方式3工作,计数值是二进制格式 OUT 43H,AL ; j将控制字送入控制寄存器 MOV AL,0 ;计数初值为0 OUT 42H,AL ;将计数初值的低字节送入计数器2 OUT 42H,AL ;将计数初值的高字节送入计数器2 在IBM PC中8253/54的三个时钟端CLK0,CLK1和CLK2的输入频率都是1.1931817MHZ. PC机上的大多数I/O都是由主板上的8255(或8255A)可编程序外围接口芯片(PPI)管理的.关于8255A的结构和工作原理及应用举例参阅教材第340—373页.教材第364页的”PC/XT机中的扬声器接口电路”一节介绍了扬声器的驱动原理,并给出了通用发声程序.本设计正是基于这个原理,通过编程,控制加到扬声器上的信号的频率,奏出乐曲的.2.发声程序的设计下面是能产生频率为f的通用发声程序:MOV AL, 10110110B ;8253控制字:通道2,先写低字节,后写高字节 ;方式3,二进制计数OUT 43H, AL ;写入控制字MOV DX, 0012H ;被除数高位MOV AX, 35DEH ;被除数低位 DIV ID ;求计数初值n,结果在AX中OUT 42H, AL ;送出低8位MOV AL, AHOUT 42H,AL ;送出高8位IN AL, 61H ;读入8255A端口B的内容MOV AH, AL ;保护B口的原状态OR AL, 03H ;使B口后两位置1,其余位保留OUT 61H,AL ;接通扬声器,使它发声
上传时间: 2013-10-17
上传用户:sunjet
九.输入/输出保护为了支持多任务,80386不仅要有效地实现任务隔离,而且还要有效地控制各任务的输入/输出,避免输入/输出冲突。本文将介绍输入输出保护。 这里下载本文源代码。 <一>输入/输出保护80386采用I/O特权级IPOL和I/O许可位图的方法来控制输入/输出,实现输入/输出保护。 1.I/O敏感指令输入输出特权级(I/O Privilege Level)规定了可以执行所有与I/O相关的指令和访问I/O空间中所有地址的最外层特权级。IOPL的值在如下图所示的标志寄存器中。 标 志寄存器 BIT31—BIT18 BIT17 BIT16 BIT15 BIT14 BIT13—BIT12 BIT11 BIT10 BIT9 BIT8 BIT7 BIT6 BIT5 BIT4 BIT3 BIT2 BIT1 BIT0 00000000000000 VM RF 0 NT IOPL OF DF IF TF SF ZF 0 AF 0 PF 1 CF I/O许可位图规定了I/O空间中的哪些地址可以由在任何特权级执行的程序所访问。I/O许可位图在任务状态段TSS中。 I/O敏感指令 指令 功能 保护方式下的执行条件 CLI 清除EFLAGS中的IF位 CPL<=IOPL STI 设置EFLAGS中的IF位 CPL<=IOPL IN 从I/O地址读出数据 CPL<=IOPL或I/O位图许可 INS 从I/O地址读出字符串 CPL<=IOPL或I/O位图许可 OUT 向I/O地址写数据 CPL<=IOPL或I/O位图许可 OUTS 向I/O地址写字符串 CPL<=IOPL或I/O位图许可 上表所列指令称为I/O敏感指令,由于这些指令与I/O有关,并且只有在满足所列条件时才可以执行,所以把它们称为I/O敏感指令。从表中可见,当前特权级不在I/O特权级外层时,可以正常执行所列的全部I/O敏感指令;当特权级在I/O特权级外层时,执行CLI和STI指令将引起通用保护异常,而其它四条指令是否能够被执行要根据访问的I/O地址及I/O许可位图情况而定(在下面论述),如果条件不满足而执行,那么将引起出错码为0的通用保护异常。 由于每个任务使用各自的EFLAGS值和拥有自己的TSS,所以每个任务可以有不同的IOPL,并且可以定义不同的I/O许可位图。注意,这些I/O敏感指令在实模式下总是可执行的。 2.I/O许可位图如果只用IOPL限制I/O指令的执行是很不方便的,不能满足实际要求需要。因为这样做会使得在特权级3执行的应用程序要么可访问所有I/O地址,要么不可访问所有I/O地址。实际需要与此刚好相反,只允许任务甲的应用程序访问部分I/O地址,只允许任务乙的应用程序访问另一部分I/O地址,以避免任务甲和任务乙在访问I/O地址时发生冲突,从而避免任务甲和任务乙使用使用独享设备时发生冲突。 因此,在IOPL的基础上又采用了I/O许可位图。I/O许可位图由二进制位串组成。位串中的每一位依次对应一个I/O地址,位串的第0位对应I/O地址0,位串的第n位对应I/O地址n。如果位串中的第位为0,那么对应的I/O地址m可以由在任何特权级执行的程序访问;否则对应的I/O地址m只能由在IOPL特权级或更内层特权级执行的程序访问。如果在I/O外层特权级执行的程序访问位串中位值为1的位所对应的I/O地址,那么将引起通用保护异常。 I/O地址空间按字节进行编址。一条I/O指令最多可涉及四个I/O地址。在需要根据I/O位图决定是否可访问I/O地址的情况下,当一条I/O指令涉及多个I/O地址时,只有这多个I/O地址所对应的I/O许可位图中的位都为0时,该I/O指令才能被正常执行,如果对应位中任一位为1,就会引起通用保护异常。 80386支持的I/O地址空间大小是64K,所以构成I/O许可位图的二进制位串最大长度是64K个位,即位图的有效部分最大为8K字节。一个任务实际需要使用的I/O许可位图大小通常要远小于这个数目。 当前任务使用的I/O许可位图存储在当前任务TSS中低端的64K字节内。I/O许可位图总以字节为单位存储,所以位串所含的位数总被认为是8的倍数。从前文中所述的TSS格式可见,TSS内偏移66H的字确定I/O许可位图的开始偏移。由于I/O许可位图最长可达8K字节,所以开始偏移应小于56K,但必须大于等于104,因为TSS中前104字节为TSS的固定格式,用于保存任务的状态。 1.I/O访问许可检查细节保护模式下处理器在执行I/O指令时进行许可检查的细节如下所示。 (1)若CPL<=IOPL,则直接转步骤(8);(2)取得I/O位图开始偏移;(3)计算I/O地址对应位所在字节在I/O许可位图内的偏移;(4)计算位偏移以形成屏蔽码值,即计算I/O地址对应位在字节中的第几位;(5)把字节偏移加上位图开始偏移,再加1,所得值与TSS界限比较,若越界,则产生出错码为0的通用保护故障;(6)若不越界,则从位图中读对应字节及下一个字节;(7)把读出的两个字节与屏蔽码进行与运算,若结果不为0表示检查未通过,则产生出错码为0的通用保护故障;(8)进行I/O访问。设某一任务的TSS段如下: TSSSEG SEGMENT PARA USE16 TSS <> ;TSS低端固定格式部分 DB 8 DUP(0) ;对应I/O端口00H—3FH DB 10000000B ;对应I/O端口40H—47H DB 01100000B ;对用I/O端口48H—4FH DB 8182 DUP(0ffH) ;对应I/O端口50H—0FFFFH DB 0FFH ;位图结束字节TSSLen = $TSSSEG ENDS 再假设IOPL=1,CPL=3。那么如下I/O指令有些能正常执行,有些会引起通用保护异常: in al,21h ;(1)正常执行 in al,47h ;(2)引起异常 out 20h,al ;(3)正常实行 out 4eh,al ;(4)引起异常 in al,20h ;(5)正常执行 out 20h,eax ;(6)正常执行 out 4ch,ax ;(7)引起异常 in ax,46h ;(8)引起异常 in eax,42h ;(9)正常执行 由上述I/O许可检查的细节可见,不论是否必要,当进行许可位检查时,80386总是从I/O许可位图中读取两个字节。目的是为了尽快地执行I/O许可检查。一方面,常常要读取I/O许可位图的两个字节。例如,上面的第(8)条指令要对I/O位图中的两个位进行检查,其低位是某个字节的最高位,高位是下一个字节的最低位。可见即使只要检查两个位,也可能需要读取两个字节。另一方面,最多检查四个连续的位,即最多也只需读取两个字节。所以每次要读取两个字节。这也是在判别是否越界时再加1的原因。为此,为了避免在读取I/O许可位图的最高字节时产生越界,必须在I/O许可位图的最后填加一个全1的字节,即0FFH。此全1的字节应填加在最后一个位图字节之后,TSS界限范围之前,即让填加的全1字节在TSS界限之内。 I/O许可位图开始偏移加8K所得的值与TSS界限值二者中较小的值决定I/O许可位图的末端。当TSS的界限大于I/O许可位图开始偏移加8K时,I/O许可位图的有效部分就有8K字节,I/O许可检查全部根据全部根据该位图进行。当TSS的界限不大于I/O许可位图开始偏移加8K时,I/O许可位图有效部分就不到8K字节,于是对较小I/O地址访问的许可检查根据位图进行,而对较大I/O地址访问的许可检查总被认为不可访问而引起通用保护故障。因为这时会发生字节越界而引起通用保护异常,所以在这种情况下,可认为不足的I/O许可位图的高端部分全为1。利用这个特点,可大大节约TSS中I/O许可位图占用的存储单元,也就大大减小了TSS段的长度。 <二>重要标志保护输入输出的保护与存储在标志寄存器EFLAGS中的IOPL密切相关,显然不能允许随便地改变IOPL,否则就不能有效地实现输入输出保护。类似地,对EFLAGS中的IF位也必须加以保护,否则CLI和STI作为敏感指令对待是无意义的。此外,EFLAGS中的VM位决定着处理器是否按虚拟8086方式工作。 80386对EFLAGS中的这三个字段的处理比较特殊,只有在较高特权级执行的程序才能执行IRET、POPF、CLI和STI等指令改变它们。下表列出了不同特权级下对这三个字段的处理情况。 不同特权级对标志寄存器特殊字段的处理 特权级 VM标志字段 IOPL标志字段 IF标志字段 CPL=0 可变(初POPF指令外) 可变 可变 0 不变 不变 可变 CPL>IOPL 不变 不变 不变 从表中可见,只有在特权级0执行的程序才可以修改IOPL位及VM位;只能由相对于IOPL同级或更内层特权级执行的程序才可以修改IF位。与CLI和STI指令不同,在特权级不满足上述条件的情况下,当执行POPF指令和IRET指令时,如果试图修改这些字段中的任何一个字段,并不引起异常,但试图要修改的字段也未被修改,也不给出任何特别的信息。此外,指令POPF总不能改变VM位,而PUSHF指令所压入的标志中的VM位总为0。 <三>演示输入输出保护的实例(实例九)下面给出一个用于演示输入输出保护的实例。演示内容包括:I/O许可位图的作用、I/O敏感指令引起的异常和特权指令引起的异常;使用段间调用指令CALL通过任务门调用任务,实现任务嵌套。 1.演示步骤实例演示的内容比较丰富,具体演示步骤如下:(1)在实模式下做必要准备后,切换到保护模式;(2)进入保护模式的临时代码段后,把演示任务的TSS段描述符装入TR,并设置演示任务的堆栈;(3)进入演示代码段,演示代码段的特权级是0;(4)通过任务门调用测试任务1。测试任务1能够顺利进行;(5)通过任务门调用测试任务2。测试任务2演示由于违反I/O许可位图规定而导致通用保护异常;(6)通过任务门调用测试任务3。测试任务3演示I/O敏感指令如何引起通用保护异常;(7)通过任务门调用测试任务4。测试任务4演示特权指令如何引起通用保护异常;(8)从演示代码转临时代码,准备返回实模式;(9)返回实模式,并作结束处理。
上传时间: 2013-12-11
上传用户:nunnzhy
PLC TM卡开发系统汇编程序(ATM8051) ;***************** 定义管脚*************************SCL BIT P1.0SDA BIT P1.1GC BIT P1.2BZ BIT P3.6LEDI BIT P1.4LEDII BIT P1.5OK BIT 20H.1OUT1 BIT P1.3OUT2 BIT P1.0OUT3 BIT P1.1RXD BIT P3.0TXD BIT P3.1PCV BIT P3.2WPC BIT P3.3RPC BIT P3.5LEDR BIT P3.4LEDL BIT P3.6TM BIT P3.7;********************定义寄存器***********************ROMDTA EQU 30H;NUMBY EQU 61H;SLA EQU 60H;MTD EQU 2FH;MRD EQU 40H;TEMP EQU 50H;;ORG 00H;;INDEX:MOV P1, #00H;MOV P2, #0FFHMOV MTD ,#00HCALL REEMOV R0,40HCJNE R0,#01,NO;MOV P2,#1CHLJMP VIMEN MOV P2,#79HACALL TOUCHRESET ;JNC NO ;CALL READTM ;CJNE A,#01H,NO;NOPMOV MTD, #00HCALL WEENOPMOV P2,#4AHSETB BZCALL TIMECLR BZMOV PCON, #0FFHVIME:CALL TIME1CALL TOUCHRESETJNC VIMECALL READTMCJNE A, #01H,VIME;NOPNOPNOPIII: MOV MTD,#00HCALL REECALL BBJNB OK,NO1LJMP ZHUNO1:MOV MTD,#10H
上传时间: 2014-03-24
上传用户:448949