LCD汇编程序示例
DS18B20+LCD(原理图+汇编程序)
;****************************************************************************** ***;****************************************************************************** **;* 描述: *;* DS18B20温度控制1602LCD显示*;**;* 使用方法参考readme.txt文档*;**;**;****************************************************************************** ***;****************************************************************************** **TEMP_ZH DATA 24H ;实时温度值存放单元TEMPL DATA 25H ;TEMPH DATA 26H ;TEMP_TH DATA 27H ;高温报警值存放单元TEMP_TL DATA 28H ;低温报警值存放单元TEMPHC DATA 29H ;TEMPLC DATA 2AHK1 EQU P1.4K2 EQU P1.5K3 EQU P1.6K4 EQU P1.7BEEP EQU P3.7RELAY EQU P1.3LCD_X EQU 2FH ;LCD 地址变量LCD_RS EQU P2.0LCD_RW EQU P2.1LCD_EN EQU P2.2flag1 equ 20H.0 ;DS18B20是否存在标记KEY_UD EQU 20H.1 ;设定KEY 的UP与DOWN 标记date_line equ p3.3;=====================================================ORG 0000HJMP MAINORG 0030HMAIN: MOV SP,#60HMOV A,#00HMOV R0,#20H ;将20H-2FH 单元清零MOV R1,#10HCLEAR: MOV @R0,AINC R0DJNZ R1,CLEARCALL SET_LCDCALL RE_18B20start: CALL RESET ;18B20复位子程序JNB FLAG1,START1 ;DS1820不存在CALL MENU_OKCALL READ_E2CALL TEMP_BJ ;显示温度标记JMP START2START1: CALL MENU_ERRORCALL TEMP_BJ ;显示温度标记JMP $START2:CALL RESETJNB FLAG1,START1 ;DS1820不存在MOV A,#0CCH ; 跳过ROM匹配CALL WRITEMOV A,#44H ; 发出温度转换命令CALL WRITECALL RESETMOV A,#0CCH ; 跳过ROM匹配CALL WRITEMOV A,#0BEH ; 发出读温度命令CALL WRITECALL READcall CONVTEMPCall DISPBCDCALL CONVCALL TEMP_COMPCALL PROC_KEY ; 键扫描SJMP START2;-----------------------------------------------------PROC_KEY:JB K1,PROC_K1 ; 按键K1处理CALL BEEP_BLJNB K1,$MOV DPTR,#M_ALAX1MOV A,#1CALL LCD_PRINTCALL LOOK_ALARMJB K3,$CALL BEEP_BLJMP PROC_K2PROC_K1: ; 按键K2处理JB K2,PROC_ENDCALL BEEP_BLJNB K2,$MOV DPTR,#RESET_A1MOV A,#1CALL LCD_PRINTCALL SET_ALARMCALL RE_18B20 ;将设定的TH,TL值写入DS18B20内CALL WRITE_E2PROC_K2:CALL MENU_OKCALL TEMP_BJPROC_END:RET;============================================;设定报警值TH、TL;============================================SET_ALARM:;CALL RESET_ALARMCALL LOOK_ALARMAS0:JB K1,AS00CALL BEEP_BLJNB K1,$CPL 20H.1 ;UP/DOWN 标记AS00: JB 20H.1,ASZ01 ;20H.1=1,UPJMP ASJ01 ;20H.1=0,DOWNASZ01: JB K2,ASZ02 ;TH值调整(增加)CALL BEEP_BLINC TEMP_THMOV A,TEMP_THCJNE A,#120,ASZ011MOV TEMP_TH,#0ASZ011: CALL LOOK_ALARMMOV R5,#10CALL DELAYJMP ASZ01ASZ02: JB K3,ASZ03 ;TL值调整(增加)CALL BEEP_BLINC TEMP_TLMOV A,TEMP_TLCJNE A,#99,ASZ021MOV TEMP_TL,#00HASZ021: CALL LOOK_ALARM ;MOV R5,#10CALL DELAYJMP ASZ02ASZ03: JB K4,AS0 ;确定调整OKCALL BEEP_BLJNB K4,$RETASJ01:JB K2,ASJ02 ;TH值调整(减少)CALL BEEP_BLDEC TEMP_THMOV A,TEMP_THCJNE A,#0FFH,ASJ011JMP ASJ022ASJ011: CALL LOOK_ALARMMOV R5,#10CALL DELAYJMP AS0ASJ02: JB K3,ASJ03 ;TL值调整(减少)CALL BEEP_BLDEC TEMP_TLMOV A,TEMP_TLCJNE A,#0FFH,ASJ021JMP ASJ022ASJ021: CALL LOOK_ALARM ;MOV R5,#10CALL DELAYJMP AS0ASJ022: CPL 20H.1JMP ASZ01ASJ03: JMP ASZ03RETRESET_ALARM:MOV DPTR,#RESET_A1 ;指针指到显示信息区MOV A,#1 ;显示在第一行CALL LCD_PRINTRETRESET_A1:DB "RESET ALERT CODE";==================================================== ;实际温度值与标记温度值比较子程序;==================================================== TEMP_COMP:MOV A,TEMP_THSUBB A,TEMP_ZH ;减数>被减数,则JC CHULI1 ;借位标志位C=1,转MOV A,TEMP_ZHSUBB A,TEMP_TL ;减数>被减数,则JC CHULI2 ;借位标志位C=1,转MOV DPTR,#BJ5CALL TEMP_BJ3CLR RELAY ;继电器吸合RETCHULI1:MOV DPTR,#BJ3CALL TEMP_BJ3SETB RELAY ;继电器关闭CALL BEEP_BLRETCHULI2:MOV DPTR,#BJ4CALL TEMP_BJ3CALL BEEP_BLRET;-----------------------------------------TEMP_BJ3:MOV A,#0CEHCALL WCOMMOV R1,#0MOV R0,#2BBJJ3: MOV A,R1MOVC A,@A+DPTRCALL WDATAINC R1DJNZ R0,BBJJ3RETBJ3:DB ">H"BJ4:DB "<L"BJ5:DB " !";================================================== ;显示温度标记子程序;================================================== TEMP_BJ:MOV A,#0CBHCALL WCOMMOV DPTR,#BJ1 ;指针指到显示消息MOV R1,#0MOV R0,#2BBJJ1: MOV A,R1MOVC A,@A+DPTRCALL WDATAINC R1DJNZ R0,BBJJ1RETBJ1:DB 00H,"C";================================================= MENU_OK:MOV DPTR,#M_OK1 ;指针指到显示消息MOV A,#1 ;显示在第一行CALL LCD_PRINTMOV DPTR,#M_OK2 ;指针指到显示消息MOV A,#2 ;显示在第一行CALL LCD_PRINTRETM_OK1:DB " DS18B20 OK ",0M_OK2:DB " TEMP: ",0;-----------------------------------------------MENU_ERROR:MOV DPTR,#M_ERROR1 ;指针指到显示消息1MOV A,#1 ;显示在第一行CALL LCD_PRINTMOV DPTR,#M_ERROR2 ;指针指到显示消息1MOV A,#2 ;显示在第一行CALL LCD_PRINTRETM_ERROR1:DB " DS18B20 ERROR ",0M_ERROR2:DB " TEMP: ---- ",0;==================================================== reset: setb date_linenopclr date_linemov r0,#6bh ;主机发出延时复位低脉冲mov r1,#04htsr1: djnz r0,$mov r0,#6bhdjnz r1,tsr1setb date_line ;然后拉高数据线nopnopnopmov r0,#32htsr2: jnb date_line,tsr3 ;等待DS18B20回应djnz r0,tsr2jmp tsr4 ; 延时tsr3: setb flag1 ; 置标志位,表示DS1820存在jmp tsr5tsr4: clr flag1 ; 清标志位,表示DS1820不存在jmp tsr7tsr5: mov r0,#06bhtsr6: djnz r0,$ ; 时序要求延时一段时间tsr7: setb date_lineret;=======================================================RE_18B20:JB FLAG1,RE_18B20ARETRE_18B20A:CALL RESETMOV A,#0CCH ;跳过ROM匹配LCALL WRITEMOV A,#4EH ;写暂存寄存器LCALL WRITEMOV A,TEMP_TH ;TH(报警上限)LCALL WRITEMOV A,TEMP_TL ;TL(报警下限)LCALL WRITEMOV A,#7FH ;12位精确度LCALL WRITERET;------------------------------------------------------------WRITE_E2:CALL RESETMOV A,#0CCH ;跳过ROM匹配LCALL WRITEMOV A,#48H ;把暂存器里的温度报警值拷贝到EEROMLCALL WRITERET;--------------------------------------------------------------READ_E2:CALL RESETMOV A,#0CCH ;跳过ROM匹配LCALL WRITEMOV A,#0B8H ;把EEROM里的温度报警值拷贝回暂存器CALL WRITERET;--------------------------------------------------------------;将自定义字符写入LCD1602的CGRAM中;--------------------------------------------------------------STORE_DATA:MOV A,#40HCALL WCOMMOV R2,#08HMOV DPTR,#D_DATAMOV R3,#00HS_DATA:MOV A,R3MOVC A,@A+DPTRCALL WDATA ;写入数据INC R3DJNZ R2,S_DATARETD_DATA:DB 0CH,12H,12H,0CH,00H,00H,00H,00H;============================================================== write: mov r2,#8 ;一共8位数据CLR Cwr1:clr date_line ;开始写入DS18B20总线要处于复位(低)状态mov r3,#07djnz r3,$ ;总线复位保持16微妙以上rrc a ;把一个字节DATA 分成8个BIT环移给Cmov date_line,c ;写入一个BITmov r3,#3CHdjnz r3,$ ;等待100微妙setb date_line ;重新释放总线nopdjnz r2,wr1 ;写入下一个BITsetb date_lineret;--------------------------------------------------------------------read: mov r4,#4 ; 将温度低位、高位、TH、TL从DS18B20中读出mov r1,#TEMPL ; 存入25H、26H、27H、28Hre00: mov r2,#8re01: clr cysetb date_linenopnopclr date_line ;读前总线保持为低nopnopnopsetb date_line ;开始读总线释放mov r3,#09 ;延时18微妙djnz r3,$mov c,date_line ;从DS18B20总线读得一个BITmov r3,#3CHdjnz r3,$ ;等待100微妙rrc a ;把读得的位值环移给Adjnz r2,re01 ;读下一个BITmov @r1,ainc r1djnz r4,re00ret;*****************************************************; 处理温度BCD 码子程序;**************************************************** CONVTEMP: MOV A,TEMPH ;判温度是否零下ANL A,#80HJZ TEMPC1 ;温度零上转CLR CMOV A,TEMPL ;二进制数求补(双字节)CPL A ;取反加1ADD A,#01HMOV TEMPL,AMOV A,TEMPHCPL AADDC A,#00HMOV TEMPH,ASJMP TEMPC11TEMPC1: MOV TEMPHC,#0AH ;+TEMPC11: MOV A,TEMPHCSWAP AMOV TEMPHC,AMOV A,TEMPLANL A,#0FH ;乘0.0625MOV DPTR,#TEMPDOTTABMOVC A,@A+DPTRMOV TEMPLC,A ;TEMPLC LOW=小数部分BCDMOV A,TEMPL ;整数部分ANL A,#0F0H ;取出高四位SWAP AMOV TEMPL,AMOV A,TEMPH ;取出低四位ANL A,#0FHSWAP AORL A,TEMPL ;重新组合MOV TEMP_ZH,ALCALL HEX2BCD1MOV TEMPL,AANL A,#0F0HSWAP AORL A,TEMPHC ;TEMPHC LOW = 十位数BCDMOV TEMPHC,AMOV A,TEMPLANL A,#0FHSWAP A ;TEMPLC HI = 个位数BCDORL A,TEMPLCMOV TEMPLC,AMOV A,R4JZ TEMPC12ANL A,#0FHSWAP AMOV R4,AMOV A,TEMPHC ;TEMPHC HI = 百位数BCDANL A,#0FHORL A,R4MOV TEMPHC,ATEMPC12: RET;---------------------------------------------------------------HEX2BCD1:MOV B,#064H ;十六进制-> BCDDIV AB ;B= A % 100MOV R4,A ;R7 = 百位数MOV A,#0AHXCH A,BDIV AB ;B = A % BSWAP AORL A,BRET;-------------------------------------------------------------; 小数部分码表;------------------------------------------------------------- TEMPDOTTAB:DB 00H,00H,01H,01H,02H,03H,03H,04HDB 05H,05H,06H,06H,07H,08H,08H,09H;===================================================== LOOK_ALARM:MOV DPTR,#M_ALAX2 ;指针指到显示信息区MOV A,#2 ;显示在第二行CALL LCD_PRINTMOV A,#0C6HCALL TEMP_BJ1MOV A,TEMP_TH ;加载TH数据MOV LCD_X,#3 ;设置位置CALL SHOW_DIG2H ;显示数据MOV A,#0CEHCALL TEMP_BJ1MOV A,TEMP_TL ;加载TL数据MOV LCD_X,#12 ;设置位置CALL SHOW_DIG2L ;显示数据RET;--------------------------------------------M_ALAX1:DB " LOOK ALERT CODE",0M_ALAX2:DB "TH: TL: ",0;--------------------------------------------TEMP_BJ1:CALL WCOMMOV DPTR,#BJ2 ;指针指到显示信息区MOV R1,#0MOV R0,#2BBJJ2: MOV A,R1MOVC A,@A+DPTRCALL WDATAINC R1DJNZ R0,BBJJ2RETBJ2:DB 00H,"C";---------------------------------------------------SHOW_DIG2H: ;在LCD 的第二行显示数字MOV B,#100DIV ABADD A,#30HPUSH BMOV B,LCD_XCALL LCDP2POP BMOV A,#0AHXCH A,BDIV ABADD A,#30HINC LCD_XPUSH BMOV B,LCD_XCALL LCDP2POP BINC LCD_XMOV A,BMOV B,LCD_XADD A,#30HCALL LCDP2RETSHOW_DIG2L: ;在LCD 的第二行显示数字MOV B,#100DIV ABMOV A,#0AHXCH A,BDIV ABADD A,#30HPUSH BMOV B,LCD_XCALL LCDP2POP BINC LCD_XMOV A,BMOV B,LCD_XADD A,#30HCALL LCDP2RET;-------------------------------------------------------------;显示区BCD 码温度值刷新子程序;-------------------------------------------------------------DISPBCD:MOV A,TEMPLCANL A,#0FHMOV 70H,A ;小数位MOV A,TEMPLCSWAP AANL A,#0FHMOV 71H,A ;个位MOV A,TEMPHCANL A,#0FHMOV 72H,A ;十位MOV A,TEMPHCSWAP AANL A,#0FHMOV 73H,A ;百位MOV A,TEMPHCANL A,#0F0HCJNE A,#010H,DISPBCD0SJMP DISPBCD2DISPBCD0: MOV A,TEMPHCANL A,#0FHJNZ DISPBCD2 ;十位数是0MOV A,TEMPHCSWAP AANL A,#0FHMOV 73H,#0AH ;符号位不显示MOV 72H,A ;十位数显示符号DISPBCD2: RET;========================================================== ; LCD 1602 显示子程序;========================================================== CONV:MOV A,73H ;加载百位数据MOV LCD_X,#6 ;设置位置CJNE A,#1,CONV1JMP CONV2CONV1: MOV A,#" "MOV B,LCD_XCALL LCDP2JMP CONV3CONV2: CALL SHOW_DIG2 ;显示数据CONV3: INC LCD_X ;mov a,72h ;十位CALL SHOW_DIG2inc LCD_Xmov a,71h ;个位CALL SHOW_DIG2inc LCD_XMOV A,#'.'MOV B,LCD_XCALL LCDP2MOV A,70h ;加载小数点位INC LCD_X ;设置位置CALL SHOW_DIG2 ;显示数据RET;-------------------------------------------------------SHOW_DIG2: ;在LCD 的第二行显示数字ADD A,#30HMOV B,LCD_XCALL LCDP2RET;---------------------------------------------------------LCDP2: ;在LCD的第二行显示字符PUSH ACC ;MOV A,B ;设置显示地址ADD A,#0C0H ;设置LCD的第二行地址CALL WCOM ;写入命令POP ACC ;由堆栈取出ACALL WDATA ;写入数据RET;---------------------------------------------------------SET_LCD: ;对LCD 做初始化设置及测试CLR LCD_ENCALL INIT_LCD ;初始化LCDCALL STORE_DATA ;将自定义字符存入LCD的CGRAMRETINIT_LCD: ;8位I/O控制LCD 接口初始化MOV A,#38H ;双列显示,字形5*7点阵CALL WCOMcall delay1MOV A,#38HCALL WCOMcall delay1MOV A,#38HCALL WCOMcall delay1MOV A,#0CH ;开显示,显示光标,光标不闪烁CALL WCOMcall delay1MOV A,#01H ;清除LCD 显示屏CALL WCOMcall delay1RET;==================================================CLR_LINE1: ;清除LCD的第一行字符MOV A,#80H ;设置LCD 的第一行地址CALL WCOM ;MOV R0,#24 ;设置计数值C1: MOV A,#' ' ;载入空格符至LCDCALL WDATA ;输出字符至LCDDJNZ R0,C1 ;计数结束RET;==================================================LCD_PRINT: ;在LCD的第一行或第二行显示字符CJNE A,#1,LINE2 ;判断是否为第一行LINE1: MOV A,#80H ;设置LCD 的第一行地址CALL WCOM ;写入命令CALL CLR_LINE ;清除该行字符数据MOV A,#80H ;设置LCD 的第一行地址CALL WCOM ;写入命令JMP FILLLINE2: MOV A,#0C0H ;设置LCD 的第二行地址CALL WCOM ;写入命令CALL CLR_LINE ;清除该行字符数据MOV A,#0C0H ;设置LCD 的第二行地址CALL WCOMFILL: CLR A ;填入字符MOVC A,@A+DPTR ;由消息区取出字符CJNE A,#0,LC1 ;判断是否为结束码RETLC1: CALL WDATA ;写入数据INC DPTR ;指针加1JMP FILL ;继续填入字符RET;=========================================CLR_LINE: ;清除该行LCD 的字符MOV R0,#24CL1: MOV A,#' 'CALL WDATADJNZ R0,CL1RETDE: MOV R7,#250DJNZ R7,$RET;============================================WCOM: ;以8位控制方式将命令写至LCD MOV P0,A ;写入命令CLR LCD_RS ;RS=L,RW=L,D0-D7=指令码,E=高脉冲CLR LCD_RWSETB LCD_ENACALL DELAY1CLR LCD_ENRET;=============================================WDATA: ;以8位控制方式将数据写至LCD MOV P0,A ;写入数据SETB LCD_RSCLR LCD_RWSETB LCD_ENCALL DECLR LCD_ENCALL DERET;=============================================;PRINT A CHAR ON LINE 1;A=ASC DATA, B=LINE X POS;==============================================LCDP1: ;在LCD的第一行显示字符PUSH ACC ;MOV A,B ;设置显示地址ADD A,#80H ;设置LCD的第一行地址CALL WCOM ;写入命令POP ACC ;由堆栈取出ACALL WDATA ;写入数据RET;============================================== BEEP_BL:MOV R6,#100BL2: CALL DEX1CPL BEEPDJNZ R6,BL2MOV R5,#10CALL DELAYRETDEX1: MOV R7,#180DE2: NOPDJNZ R7,DE2RETDELAY: ;(R5)*延时10MSMOV R6,#50DL1: MOV R7,#100DJNZ R7,$DJNZ R6,DL1DJNZ R5,DELAYRETDELAY1: ;延时5MSMOV R6,#25DL2: MOV R7,#100DJNZ R7,$DJNZ R6,DL2RET;================================================ END。
16位单片机 LCD程序代码
16位单片机LCD程序代码#include <hidef.h> /* common defines and macros */#include <MC9S12XS128.h> /* derivative information */#include "shujuku.h" //专门放的数据图片#pragma LINK_INFO DERIVATIVE "mc9s12xs128"#define uint unsigned int#define uchar unsigned char#define x1 0x80#define x2 0x88#define y 0x80#define cs PORTA_PA0#define sid PORTA_PA1#define sclk PORTA_PA2#define comm 0#define dat 1void Lcd_Write (uchar dat_comm,uchar content); //申明写入函数/*-----------------延时程序----------------*/void delay_1us(void) //1us延时函数{asm("nop");}void delay_nus(unsigned int n) //N us延时函数{unsigned int i=0;for (i=0;i<n;i++)delay_1us();}void delay_1ms(void) //1ms延时函数{unsigned int i;for (i=0;i<1140;i++);}void delay_nms(unsigned int n) //N ms延时函数{unsigned int i=0;for (i=0;i<n;i++)delay_1ms();}/*------------------初始化-----------------*/ void init_lcd (void){Lcd_Write (comm,0x30); /*30---基本指令动作*/Lcd_Write (comm,0x01); /*清屏,地址指针指向00H*/delay_nus(100); //100usLcd_Write (comm,0x06); /*光标的移动方向*/Lcd_Write (comm,0x0c); /*开显示,关游标*/ }/*--------------清DDRAM------------------*/ void Lcd_Clrram(void){Lcd_Write (comm,0x30);Lcd_Write (comm,0x01);delay_nus(180); //delay 180us}/*---------------------------------------*//*---写入命令或者数据,内容-----如果需要设定地址写入的就是命令状态,如果需要写入数据就是数据状态--*/void Lcd_Write(uchar dat_comm,uchar content){ uchar a,i,j;delay_nus(50);a=content;cs=1;sclk=0;sid=1;for(i=0;i<5;i++){ sclk=1;delay_nus(10);sclk=0;delay_nus(10);}sid=0;sclk=1;sclk=0;if(dat_comm)sid=1;elsesid=0;sclk=1;delay_nus(10);sclk=0;delay_nus(10);sid=0;sclk=1;delay_nus(10);sclk=0;delay_nus(10);for(j=0;j<2;j++){for(i=0;i<4;i++){ if(a>=0x80) sid=1;else sid=0;a=a<<1;sclk=1;delay_nus(10);sclk=0;delay_nus(10);}sid=0;for(i=0;i<4;i++){sclk=1;delay_nus(10);sclk=0;delay_nus(10);}}}/*----------------显示图形-----------------*/ void Lcd_Img_display (uchar *img){uchar i,j;for(j=0;j<32;j++){ for(i=0;i<8;i++){Lcd_Write (comm,0x34);Lcd_Write (comm,y+j);Lcd_Write (comm,x1+i);Lcd_Write (comm,0x30);Lcd_Write (dat,img[j*16+i*2]);Lcd_Write (dat,img[j*16+i*2+1]);}}for(j=32;j<64;j++){for(i=0;i<8;i++){Lcd_Write (comm,0x34);Lcd_Write (comm,y+j-32);Lcd_Write (comm,x2+i);Lcd_Write (comm,0x30);Lcd_Write (dat,img[j*16+i*2]);Lcd_Write (dat,img[j*16+i*2+1]);}}Lcd_Write (comm,0x36);}/*--------------显示点阵----------------*/void lat_disp (uchar data1,uchar data2){ uchar i,j,k,x;x=x1;for(k=0;k<2;k++){for(j=0;j<16;j++){for(i=0;i<8;i++){Lcd_Write(comm,0x34);Lcd_Write(comm,y+j*2);Lcd_Write(comm,x+i);Lcd_Write(comm,0x30);Lcd_Write(dat,data1);Lcd_Write(dat,data1);}for(i=0;i<8;i++){ Lcd_Write(comm,0x34);Lcd_Write(comm,y+j*2+1);Lcd_Write(comm,x+i);Lcd_Write(comm,0x30);Lcd_Write(dat,data2);Lcd_Write(dat,data2);}}x=x2;}Lcd_Write (comm,0x36);}/*-----------------------------------------------* //*----------------显示汉字的函数---------------*/ void Lcd_Printf(uchar xx,uchar yy,char *Lcd_Pr,uchar Num){uchar i,addr;switch(yy){ case 0:addr=0x80+xx;break;case 1:addr=0x90+xx;break;case 2:addr=0x88+xx;break;case 3:addr=0x98+xx;break;default:addr=0x80+xx;break;}Lcd_Write(comm,addr); //设置DDRAM地址for (i=0;i<Num;i++){Lcd_Write(dat,Lcd_Pr[i]); //本行显示}}/*-----------------------显示字-----------------------*/void Lcd_chinese_display(uchar *chn){uchar i,j;Lcd_Write (comm,0x30);Lcd_Write (comm,0x80);for (j=0;j<4;j++){for (i=0;i<16;i++)Lcd_Write (dat,chn[j*16+i]);}}/*------------------要显示的字-------------------*/ uchar tab1[]={"飞思卡尔智能车赛""我们一定全力以赴""精诚所至金石为开""盐城工学院吴胡伟"};/*---------------------------------------------*/ /*--------------主函数-----------------------*/ void main (){DDRA=0XFF;DDRB=0XFF;PORTB=0XFF;init_lcd (); //初始化屏幕delay_nus(10);//lat_disp (0xcc,0xcc);//delay_nms(5000);//lat_disp (0xff,0x00);//delay_nms(5000);//img_disp (tab5);//delay_nms(5000);//Lcd_Clrram();//Lcd_chinese_display(tab1);//Lcd_Clrram();/*Lcd_Img_display(rmb);delay_nms(3000);Lcd_Clrram() ;Lcd_Img_display(qiche);delay_nms(3000) ;Lcd_Clrram();Lcd_Img_display(gongji);delay_nms(3000);Lcd_Clrram() ;Lcd_Img_display(LCDsheji);delay_nms(3000);Lcd_Clrram() ;Lcd_Printf(1,1,"盐城工学院",10);*///Lcd_Img_display(ycit);Lcd_Img_display(ai);delay_nms(3000);while(1) {PORTB=~PORTB;delay_nms(1000);}}2009-04-28。
LCD1602-51单片机汇编程序.
1602汇编程序,刃单片机汇编程序,仅需修改引脚定义即可。
晶振大小12M,程序测试完全正确。
内部包含写数据、写命令(包括读忙和不读忙、初始化等子函数。
调用时先给LCD_DAT赋值,给出需要写入的数据或命令,然后调用。
;端口引脚定义区LCD_RS BIT P2.4 ;1602数据命令选择端口LCD_RW BIT P2.5 ;1602 读写选择端口LCD_EN BIT P2.6 ;1602 使能端口LCD_DATA EQU P0 ;1602 数据端口;变量声明区ALL_FLAG EQU 20H ;标志位LCD_FLAG EQU AL「FLAG.7 ;1602 读忙标志位LCD_DAT EQU 30H ;1602 数据命令字DELAYED EQU 31H 涎时字广★★★****★★★★★★★*★*★★**★*★★★*★*★★★★★*★*★*★1602读命令函数,高位存至LCD_LAG中★★★★★★★★★★★★★★★★★★★★★if******************* /LCD_R_DATA:MOV LCD_DATA,#OFFHSETB L CD RWNOPSETB L CD_ENNOPMOV Acc丄CD_DATAMOV C,Acc.7MOV LCD_FLAG,CCLR LCD_ENNOPJB LCD_FLAG ,L CD_BUSYRET/★****★***★*★***********************★*★*★*1602写数据函数,数据存在LCD_DAT★ if*************************************** /LCD_W_DATA:LCALLLCD_R_DATASETB L CD_RSNOPMOV LCD_DATA丄CD_DATSETB L CD_ENNOPCLR LCD_ENRET/* 1602LCD_DAT,检测忙信号LCD_W_CMD:LCALLLCD_R_DATACLR LCD_RSCLR LCD_RWNOPMOV LCD_DATA, LCD_DAT SETB L CD_ENNOPCLR LCD_ENRET /* 1602 与命令函数,命令存在LCD_DAT,不检测忙信号LCD CMD: 才***********才********************才才*****7写命令函数,命令存F在CLR LCD RWNOPMOV LCD_DATA, LCD_DAT SETB L CD_ENNOPCLR LCD_ENRET/***************************************** 4 QCC初始化函数★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★*/ LCD INIT:MOV DELAYED,#30LCALL DELAY_MSMOV LCD_DAT,#38HLCALL LCD_CMDMOV DELAYED,#10LCALL DELAY_MSMOV LCD_DAT,#38HLCALL LCD_CMDMOV DELAYED,#10LCALL DELAY_MSMOV LCD_DAT,#38HLCALL LCD CMDMOV DELAYED,#®LCALL DELAY_MSMOV LCD_DAT,#038HLCALL LCD_W_CMDMOV LCD_DAT,#08HLCALL LCD_W_CMDMOV LCD_DAT,#01HLCALL LCD_W_CMDMOV LCD_DAT,#06HLCALL LCD_W_CMDMOV LCD_DAT,#OCHLCALL LCD_W_CMDRET****************************************延时函数,延时时间为DELAYEDP.5毫秒0-100毫秒的延时***************************************** /DELAY_MS:MOV R7QELAYEDD1: MOV R6,#0F8HD2: DJNZ R6,D2DJNZ R7,D1RET广****************************************延时函数,延时时间为DELAYED*2微秒0-500微秒的延时***************************************** /DELAY_US:MOV R乙ADU1:DJNZ R7,DU1RET。
51单片机驱动1602液晶汇编语言程序
LCMRS EQU P2.4 LCMRW EQU P2.5 LCMEN EQU P2.6 LCMDATA EQU P0 ORG 0000H LJMP MAIN ORG 0030H MAIN: MOV SP,#60H LCALL LCMSET LCALL LCMCLR MOV A,#80H LCALL LCMWR0 MOV DPTR,#TAB0 LCALL LCMWR2 MOV A,#0C0H LCALL LCMWR0 MOV DPTR,#TAB1 LCALL LCMWR2 SJMP $
LCALL LCMLAY CLR LCMEN CLR LCMRS CLR LCMRW SETB LCMEN MOV LCMDATA,A
CLR LCMEN RET LCMWR1: ;写入数据
LCALL LCMLAY CLR LCMEN SETB LCMRS CLR LCMRW SETB LCMEN MOV LCMDATA,A CLR LCMEN RET LCMWR2: PUSH ACC LOOP1: CLR A MOVC A,@A+DPTR JZ LOOP2 LCALL LCMWR1 INC DPTR LJMP LOOP1 LOOP2: POP ACC 写入字符串(字符串属于数据)
TAB0: DB "I AM YUAN MING",00H TAB1: DB "NICE TO MEET YOU",00H LCMLAY: PUSH ACC LOOP: CLR LCMEN CLR LCMRS SETB LCMRW SETB LCMEN MOV A,LCMDATA CLR LCMEN JB ACC.7,LOOP POP ACC LCALL DELAY RET LCMWR0: ;写入指令 ;读忙程序,用于判断 d7 是否为 0
2.8吋彩色液晶屏汇编语言实验程序
上一次发表的是用C语言编写的2.8 吋彩色液晶屏实验程序,这一次是汇编语言编写的2.8 吋彩色液晶屏实验程序,两个程序的运行结果是完全一样的,只是编程用的编程语言不同而已。
对于初学C51单片机的朋友们学习不同语言编程能有所帮助,本程序是经过本人上机测试完全通过Keil 4 验证的,可以放心的使用。
本程序驱动ILI9341 或RM68090 芯片驱动的2.8 吋彩色液晶屏。
显示点阵数:240RGB(W)×320(H)。
芯片为宏晶科技公司的STC12C5A60S2或STC12LE5A60S2 芯片。
注:RGB 为565 格式的16bit。
$INCLUDE(STC12C5A.INC);===============================================;编程日期:2014年09月25日;===============================================;初始化定义和数据单元;;===============================================RSB BIT P3.3 ;寄存器选择,0:寄存器,1:参数CSB BIT P3.4 ;片选,低电平有效RESET BIT P3.5 ;复位WRB BIT P3.6 ;写数据信号RDB BIT P3.7 ;读数据信号;===============================================;主程序开始;===============================================ORG 0000HLJMP MAIN ;开始ORG 0100HMAIN:MOV R0,#7FHCLR ACLEARED:MOV @R0,ADJNZ R0, CLEAREDMOV SP,#0E0HSETB RESETLCALL DELAY1MSCLR RESETLCALL DELAY10MSSETB RESETLCALL DELAY120MSLCALL REGISTER_SETTINGS ;配置9341;===============================================;循环程序;===============================================CYCLE:MOV R7,#0FFHMOV R6,#0FFHLCALL DISPLAY ;显示白色MOV R7,#00HMOV R6,#00HLCALL DISPLAY ;显示黑色LCALL DELAY1SLCALL PICTURES ;显示图片LCALL DELAY1SMOV R7,#0F8HMOV R6,#00HLCALL DISPLAY ;显示红色ACALL DELAY1SMOV R7,#07HMOV R6,#0E0HLCALL DISPLAY ;显示绿色ACALL DELAY1SMOV R7,#00HMOV R6,#1FHLCALL DISPLAY ;显示蓝色LCALL DELAY1SMOV R7,#0FFHMOV R6,#0E0HLCALL DISPLAY ;显示黄色LCALL DELAY1SMOV R7,#0F8HMOV R5,#1FHLCALL DISPLAY ;显示紫色LCALL DELAY1SMOV R7,#07HMOV R6,#0FFHLCALL DISPLAY ;显示青色LCALL DELAY1SCPL P4.3LJMP CYCLE ;返回循环程序;=============================================== ;显示设置,区域和数据240x320;=============================================== DISPLAY:MOV 22H,R7MOV 23H,R6LCALL SETTINGS_AREA ;设置区域CLR AMOV R3,AMOV R2,ADISPLAY01:MOV R4,#0F0HDISPLAY02:MOV R7,22HLCALL TWO_DATA ;写双字节显示数据DJNZ R4, DISPLAY02 ;240列INC R3CJNE R3,#00H,DISPLAY03INC R2DISPLAY03:CJNE R2,#01H,DISPLAY01CJNE R3,#40H,DISPLAY01 ;320行RET;=============================================== ;显示图片;=============================================== PICTURES:LCALL SETTINGS_AREA ;设置区域MOV R1,#04H ;显示4幅图片PICTURES01:MOV DPTR,#IMAGE_PIXELSMOV R2,#50HPICTURES02:MOV R3,#0F0HPICTURES03:CLR AMOVC A,@A+DPTRMOV R7,AINC DPTRCLR AMOVC A,@A+DPTRMOV R6,AINC DPTRLCALL TWO_DATA ;写DAT文件,双字节DJNZ R3,PICTURES03DJNZ R2,PICTURES02DJNZ R1,PICTURES01RET;=============================================== ;设置区域;=============================================== SETTINGS_AREA:MOV R7,#2AH ;列地址时钟LCALL COMMAND ;写8位命令MOV R7,#00HLCALL WRITE_DATA ;写8位数据参数MOV R7,#00HLCALL WRITE_DATA ;写8位数据参数LCALL WRITE_DATA ;写8位数据参数MOV R7,#0EFHLCALL WRITE_DATA ;写8位数据参数MOV R7,#2BH ;页地址设置LCALL COMMAND ;写8位命令MOV R7,#00HLCALL WRITE_DATA ;写8位数据参数MOV R7,#00HLCALL WRITE_DATA ;写8位数据参数MOV R7,#01HLCALL WRITE_DATA ;写8位数据参数MOV R7,#3FHLCALL WRITE_DATA ;写8位数据参数MOV R7,#2CH ;存储器写LJMP COMMAND ;写8位命令RET;=============================================== ;写寄存器命令;=============================================== COMMAND:CLR RSBSETB RDBCLR CSBMOV P0,R7CLR WRBSETB WRBSETB CSBRET;=============================================== ;写数据参数;=============================================== WRITE_DATA:SETB RSBSETB RDBCLR CSBMOV P0,R7CLR WRBSETB WRBSETB CSBRET;=============================================== ;写双字节显示数据;===============================================SETB RSBSETB RDBCLR CSBMOV P2,R7MOV P0,R6CLR WRBSETB WRBSETB CSBRET;=============================================== ;延时1mS;=============================================== DELAY1MS:MOV R6,#8DHDL0:MOV R5,#39HDJNZ R5,$DJNZ R6,DL0NOPRET;=============================================== ;延时10mS;=============================================== DELAY10MS:MOV R7,#0BDHDL1:MOV R6,#0AEHDL2:MOV R5,#01HDJNZ R5,$DJNZ R6,DL2DJNZ R7,DL1RET;=============================================== ;延时120mS;=============================================== DELAY120MS:MOV R7,#75HDL3:MOV R6,#78HDL4:MOV R5,#45HDJNZ R5,$DJNZ R6,DL4DJNZ R7,DL3DJNZ R5,$RET;=============================================== ;延时1S;=============================================== DELAY1S:MOV R7,#0DFHDL5:MOV R6,#0D4HDL6:MOV R5,#0ADHDJNZ R5,$DJNZ R6,DL6DJNZ R7,DL5MOV R5,#03HDJNZ R5,$NOPRET;=============================================== ;ILI9341寄存器配置;=============================================== REGISTER_SETTINGS:MOV R7,#0CFH ;LCALL COMMAND ;写寄存器命令MOV R7,#00H ;LCALL WRITE_DATA ;写8位数据MOV R7,#0D9HLCALL WRITE_DATAMOV R7,#30HLCALL WRITE_DATAMOV R7,#0EDHLCALL COMMANDMOV R7,#64HLCALL WRITE_DATAMOV R7,#03HLCALL WRITE_DATAMOV R7,#12HLCALL WRITE_DATAMOV R7,#81HLCALL WRITE_DATAMOV R7,#0E8HLCALL COMMANDMOV R7,#85HLCALL WRITE_DATAMOV R7,#10HMOV R7,#78H LCALL WRITE_DATA MOV R7,#0CBH LCALL COMMAND MOV R7,#39H LCALL WRITE_DATA MOV R7,#2CH LCALL WRITE_DATA MOV R7,#00H LCALL WRITE_DATA MOV R7,#34H LCALL WRITE_DATA MOV R7,#02H LCALL WRITE_DATA MOV R7,#0F7H LCALL COMMAND MOV R7,#20H LCALL WRITE_DATA MOV R7,#0EAH LCALL COMMAND MOV R7,#00H LCALL WRITE_DATA MOV R7,#00H LCALL WRITE_DATA MOV R7,#0C0H LCALL COMMAND MOV R7,#21H LCALL WRITE_DATA MOV R7,#0C1H LCALL COMMAND MOV R7,#12H LCALL WRITE_DATA MOV R7,#0C5H LCALL COMMAND MOV R7,#32H LCALL WRITE_DATA MOV R7,#3CH LCALL WRITE_DATA MOV R7,#0C7H LCALL COMMAND MOV R7,#0C1H LCALL WRITE_DATA MOV R7,#36H LCALL COMMAND MOV R7,#08HLCALL COMMAND MOV R7,#55H LCALL WRITE_DATA MOV R7,#0B1H LCALL COMMAND MOV R7,#00H LCALL WRITE_DATA MOV R7,#18H LCALL WRITE_DATA MOV R7,#0B6H LCALL COMMAND MOV R7,#0AH LCALL WRITE_DATA MOV R7,#0A2H LCALL WRITE_DATA MOV R7,#0F2H LCALL COMMAND MOV R7,#00H LCALL WRITE_DATA MOV R7,#26H LCALL COMMAND MOV R7,#01H LCALL WRITE_DATA MOV R7,#0E0H LCALL COMMAND MOV R7,#0FH LCALL WRITE_DATA MOV R7,#20H LCALL WRITE_DATA MOV R7,#1EH LCALL WRITE_DATA MOV R7,#09H LCALL WRITE_DATA MOV R7,#12H LCALL WRITE_DATA MOV R7,#0BH LCALL WRITE_DATA MOV R7,#50H LCALL WRITE_DATA MOV R7,#0BAH LCALL WRITE_DATA MOV R7,#44H LCALL WRITE_DATA MOV R7,#09HLCALL WRITE_DATA MOV R7,#05H LCALL WRITE_DATA MOV R7,#23H LCALL WRITE_DATA MOV R7,#21H LCALL WRITE_DATA MOV R7,#00H LCALL WRITE_DATA MOV R7,#0E1H LCALL COMMAND MOV R7,#00H LCALL WRITE_DATA MOV R7,#19H LCALL WRITE_DATA MOV R7,#19H LCALL WRITE_DATA MOV R7,#00H LCALL WRITE_DATA MOV R7,#12H LCALL WRITE_DATA MOV R7,#07H LCALL WRITE_DATA MOV R7,#2DH LCALL WRITE_DATA MOV R7,#28H LCALL WRITE_DATA MOV R7,#3FH LCALL WRITE_DATA MOV R7,#02H LCALL WRITE_DATA MOV R7,#0AH LCALL WRITE_DATA MOV R7,#08H LCALL WRITE_DATA MOV R7,#25H LCALL WRITE_DATA MOV R7,#2DH LCALL WRITE_DATA MOV R7,#0FH LCALL WRITE_DATA MOV R7,#11H LCALL COMMAND LCALL DELAY120MSLJMP COMMANDRET;===============================================;显示图像38400字节;===============================================IMAGE_PIXELS:DB 0xC4,0x8,0xBC,0x2A,0x8B,0x6A,0x49,0xA8,0x18,0x88,0x31,0x4D,0x41,0xCE,0x31,0x4B DB 0x18,0xA8,0x18,0x87,0x10,0x85,0x10,0x85,0x10,0x85,0x10,0xA5,0x10,0xA5,0x18,0xA6 DB 0x10,0xA5,0x10,0x85,0x10,0xA6,0x8,0xA6,0x8,0x64,0x38,0x64,0x88,0xE7,0xD1,0x69 DB 0xD1,0x6,0xD1,0x7,0xD1,0x8,0xD9,0x8,0xD8,0xE8,0xD0,0xE7,0xC9,0x7,0xC1,0x47DB 0xD0,0xE8,0xD0,0xE8,0xD0,0xE7,0xD0,0xE7,0xD1,0x7,0xD1,0x7,0xD1,0x7,0xD1,0x7 DB 0xD0,0xE7,0xC8,0xE6,0xC9,0x7,0xD0,0xE7,0xD0,0xA6,0xC0,0xE7,0xC2,0x4B,0xCB,0xF0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41,0xCF,0x41,0xB1,0x51,0xF1,0x5A,0x71 DB 0x5A,0x73,0x5A,0x73,0x62,0x93,0x62,0x94,0x62,0x94,0x62,0x94,0x62,0x94,0x62,0x94 DB 0x62,0x93,0x62,0x93,0x62,0x93,0x62,0x94,0x62,0x94,0x62,0x93,0x62,0x73,0x5A,0x73。
单片机LCD1602显示字符和数字的汇编程序
单片机LCD1602显示字符和数字的汇编程序1,单片机和LCD1602的连线,和程序结果显示如下图:2,LCD第一行显示字符XIAORENGUANG第二行显示RAM中40H到46H中的数字。
程序如下:RS EQU P2.4RW EQU P2.5E EQU P2.6ORG 0000HAJMP MAINORG 0030HMAIN: MOV SP,#60HMOV 40H,#01HMOV 41H,#02HMOV 42H,#03HMOV 43H,#04HMOV 44H,#05HMOV 45H,#06HMOV 46H,#07HACALL DD1 ;DD1是LCD初始化MOV DPTR,#TABLE1ACALL DD2;DD2是LCD第一行显示TABLE1ACALL PPP ;PPP是LCD第二行显示RAM中40H到46H中的数据SJMP $DD1: MOV p0,#01H ;清屏CALL ENABLEMOV p0,#38H ;显示功能CALL ENABLEMOV p0,#0FH ;显示开关控制CALL ENABLEMOV p0,#06H ;显示光标右移加1CALL ENABLERETDD2: MOV p0,#80H;第一行的开始位置cALL ENABLECALL WRITE1;到TABLE1取码?RETENABLE: CLR RS ;送命令CLR RWCLR ECALL DELAYSETB ERETWRITE1: MOV R1,#00H ;显示table中的值A1: MOV A,R1;到table取码MOVC A,@A+DPTRcall wRITE2 ;显示到lcdINC R1CJNE A,#00H,A1 ;是否到00hRETWRITE2:MOV p0,A ;显示SETB RSCLR RWCLR ECALL DELAYSETB ERET(动态显示频率、幅度核心程序设计思想:可以利用如下程序)MOV40H,#01HMOV41H,#02HMOV42H,#03H)MOV R1,#40H;显示table中的值MOV A,R1;到table取码MOVC A,@A+DPTRMOV P0,AINC R1LJMP LOOPDELAY: PUSH ACCMOV A,R4MOV R4,#05D1: MOV R5,#0FFHDJNZ R5,$DJNZ R4,D1MOV R4,APOP ACCRETPPP: MOV p0,#0C0H;第二行的位置CALL ENABLEMOV DPTR,#TAB;显示CALL WRITE3;到TABLE2 取码RETWRITE3: MOV R1,#40H ;显示table中的值MOV R7,#07HA2: MOV A,@R1;到table取码MOVC A,@A+DPTRcall wRITE2 ;显示到lcdINC R1DJNZ R7,A2 ;是否到00hRETtable1: db"XIAORENGUANG ",00H TAB: DB 30H, 31H, 32H, 33HDB 34H, 35H, 36H, 37HDB 38H, 39HEND。
LCD驱动实验汇编程序
;******************************************************************;******************************************************************;程序名:STC单片机I/O直接驱动段式LCD程序(实验版);编辑:周诗谋;使用芯片:STC89C54RD+;程序编辑日期:20111216;公司:深圳宝安沙井步涌晶辉科技;******************************************************************;******************************************************************;版权申明:程序版权属本人所有,仅供个人学习使用,请勿用于商业用途,违者必究;******************************************************************;******************************************************************;端口寄存器定义;******************************************************************;******************************************************************sfr P0M0 = 0x94; // 0000,0000sfr P0M1 = 0x93; // 0000,0000sfr P1M0 = 0x92; // 0000,0000sfr P1M1 = 0x91; // 0000,0000sfr P1ASF = 0x9D; //P1 analog special functionsfr P2M0 = 0x96; // 0000,0000sfr P2M1 = 0x95; // 0000,0000sfr P3M0 = 0xB2; // 0000,0000sfr P3M1 = 0xB1; // 0000,0000;******************************************************************;******************************************************************COM0 EQU P2.0 ;SBIT COM0=P2.0COM1 EQU P2.1 ; SBIT COM1=P2.1COM2 EQU P2.2 ; SBIT COM2=P2.2COM3 EQU P2.3 ; SBIT COM3=P2.3/*;******************************************************************;******************************************************************;显示数据缓冲区;******************************************************************;******************************************************************DISPLAY _SBUF 0 EQU 30H ;第一位显示数据缓冲DISPLAY_SBUF 1 EQU 31H ;第二位显示数据缓冲DISPLAY_SBUF 2 EQU 32H ;第三位显示数据缓冲DISPLAY_SBUF 3 EQU 33H ;第四位显示数据缓冲*/;******************************************************************;******************************************************************;段码数据缓冲区;******************************************************************;******************************************************************SEG_SBUF0 EQU 34H ;第一位段码数据缓冲SEG_SBUF1 EQU 35H ;第二位段码数据缓冲SEG_SBUF2 EQU 35H ;第三位段码数据缓冲SEG_SBUF3 EQU 36H ;第四位段码数据缓冲;****************************************************************** 43 SCAN_COUN EQU 37H ;显示扫描指针;******************************************************************;主程序;******************************************************************;******************************************************************ORG 0000HLJMP MAINORG 001BH ;计时中断跳转入口LJMP TIMER_INTERORG 0050HMAIN:MOV SCAN_COUN, #0 ; ScanCoun=0 动态扫描显示位数计数器MOV TMOD, #01H; TMOD=0x01; //T0工作方式1(16位定时器)MOV TH1, #078H; TL0=0x78; T0定时器辅初值定时5msMOV TL1, #0ECH; TH0=0xec;SETB TR0 ; TR0=1 允许T0定时SETB ET0 ; ET0=1 允许T0中断SETB EA; EA=1 开全局中断LOOP:MOV SEG_SBUF0,#00HMOV SEG_SBUF1,#00HMOV SEG_SBUF2,#00HMOV SEG_SBUF3,#00H/*LOOP:MOV A, SCAN_COUNLOOP1:CJNE A, #10, LOOP1CPL P1.0MOV SCAN_COUN, #0 */LJMP $;******************************************************************;******************************************************************;LCD扫描显示子程序;******************************************************************;******************************************************************DISPLAY_SCAN:;/定时器0中断服务程序,5ms定时器,4位数码管动态显示驱动; switch(ScanCoun) //动态扫描显示;{MOV A, SCAN_COUNCJNE A, #0, SCAN_0MOV P1, #SEG_SBUF0MOV P2M1, #1FH ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN MOV P2M0, #00H ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN SETB COM0;MOV P2M1, #0FH ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN;MOV P2M0, #00H ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN ;******************************************************************;******************************************************************SCAN_0:;******************************************************************;******************************************************************MOV A, SCAN_COUNCJNE A, #01, SCAN_1MOV A, #SEG_SBUF0CPL AMOV P1, AMOV P2M1, #0FH ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN MOV P2M0, #00H ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN CLR COM0;MOV P2M1, #0FH ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN;MOV P2M0, #00H ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN ;******************************************************************;******************************************************************SCAN_1:;******************************************************************;******************************************************************MOV A, SCAN_COUNCJNE A, #02, SCAN_2MOV P1, #SEG_SBUF1MOV P2M1, #0FH ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN MOV P2M0, #00H ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN SETB COM1;MOV P2M1, #0FH ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN;MOV P2M0, #00H ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN ;******************************************************************;******************************************************************SCAN_2:;******************************************************************;******************************************************************MOV A, SCAN_COUNCJNE A, #03, SCAN_3MOV A, #SEG_SBUF1CPL AMOV P1, AMOV P2M1, #0FH ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN MOV P2M0, #00H ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN CLR COM1;MOV P2M1, #0FH ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN;MOV P2M0, #00H ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN ;******************************************************************;******************************************************************SCAN_3:;******************************************************************;******************************************************************MOV A, SCAN_COUNCJNE A, #04, SCAN_4MOV P1, #SEG_SBUF2MOV P2M1, #0FH ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN MOV P2M0, #00H ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN SETB COM2;MOV P2M1, #0FH ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN;MOV P2M0, #00H ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN;******************************************************************;******************************************************************SCAN_4:;******************************************************************;******************************************************************MOV A, SCAN_COUNCJNE A, #05, SCAN_5MOV A, #SEG_SBUF2CPL AMOV P1, AMOV P2M1, #0FH ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN MOV P2M0, #00H ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN CLR COM2;MOV P2M1, #0FH ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN;MOV P2M0, #00H ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN ;******************************************************************;******************************************************************SCAN_5:;******************************************************************;******************************************************************MOV A, SCAN_COUNCJNE A, #06, SCAN_6MOV P1, # SEG_SBUF3MOV P2M1, #0FH ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN MOV P2M0, #00H ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN SETB COM3;MOV P2M1, #0FH ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN;MOV P2M0, #00H ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN ;******************************************************************;******************************************************************SCAN_6:;******************************************************************;******************************************************************MOV A, SCAN_COUNCJNE A, #07, SCAN_7MOV A, #SEG_SBUF3CPL AMOV P1, AMOV P2M1, #0FH ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN MOV P2M0, #00H ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN CLR COM3;MOV P2M1, #0FH ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN;MOV P2M0, #00H ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN ;******************************************************************;******************************************************************;扫描结束;******************************************************************;******************************************************************SCAN_7:MOV A, SCAN_COUNCJNE A, #08, SCAN_RT ;扫描指针为8吗不为8则跳转至计数器加一子指SCAN_RTMOV SCAN_COUN, #0 ;指针为8则清除SCAN--COUN扫描计数指针JMP SCAN_FINISH ;跳转退出SCAN_RT:INC SCAN_COUN ;扫描器计数清零SCAN_FINISH: ;扫描退出RET;******************************************************************;******************************************************************;******************************************************************;******************************************************************;******************************************************************;******************************************************************;定时中断服子程序;******************************************************************TIMER_INTER:PUSH ACCPUSH PSWMOV TH1, #078H ;TL0=0x78重新定时5msMOV TL1, #0ECH ;TH0=0xecMOV P2M1, #0FH ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN MOV P2M0, #00H ;定义P2口状态P2.0-P2.3为高阻输入COM0-COM4驱动PIN CALL DISPLAY_SCANPOP PSWPOP ACCRETIEND。
LCD可调电子万年历 汇编代码(已调试)韩威巍QQ282172088
RS BIT P2.5
RW BIT P2.6
E BIT P2.7
D1602_ADDR DATA 62H
/******************************* KEY_1 ***************************************/
KEY_1_PAUSE:
DEC KEY_NUM
MOV A,KEY_NUM
SETB EX0
SETB P3.2 ;键盘初始化
SETB P3.3
SETB P3.4
MOV KEY_NUM,#07H
MOV D1602_GANG1,#3AH ;显示区横杠码
MOV A,@R0
MOV D1602_DATA,A
ACALL WRITE_1602_DATA
DEC R0
INC D1602_ADDR
DJNZ R5,LOOP2
JMP ROLL
NEXT1_1: MOV A,KEY_NUM
CJNE A,#05H,NEXT1_2 ;预写“分”
MOV D1302_ADDR,#82H
JMP OVER
NEXT1_2: MOV A,KEY_NUM
/******************************* 键盘中断INTO子程序 **************************/
START0: JNB KEY_1,KEY_1_PAUSE
JNB KEY_2,KEY_2_START
ACALL WRITE_1602_C
MOV D1602_DATA,#54H
ACALL WRITE_1602_DATA
12864液晶屏汇编程序
12864液晶屏汇编程序[ 作者:佚名 | 转贴自:本站原创 | 点击数:211 | 更新时间:2005-3-28 | 文章录入:qwll20000 ] XCS BIT 00H ;显示器片选0=CS1,1=CS2 ;20H-2FH为位寻址区,位地址从00H-7FH BZPD BIT 01H ;0=上8X8半字,1=下8X8半字HHBZ BIT 02H ;换行标志HZDH BIT 03H ;0=显示汉字,1=显示动画LCD_RW BIT P3.0LCD_DI BIT P3.1LCD_E BIT P3.3LCD_CS1 BIT P3.5LCD_CS2 BIT P3.4LCD_OPEN DA TA 30HLCD_LINE DATA 31HLCD_PAGE DATA 32HLCD_Y DA TA 33HYCPD DA TA 34H ;左右半屏溢出判断HHPD DA TA 35H ;换行判断XWPD DA TA 36H ;写完一整屏判断ORG 0000HMOV SP,#40HSETB XCS ;选择CS2MOV LCD_OPEN,#01H ;开显示器1,关显示器0LCALL LCDOPENMOV LCD_LINE,#00H ;设置起始行LCALL SETLINEMOV LCD_PAGE,#00H ;设置页地址 LCALL SETPAGEMOV LCD_Y,#00H ;设置列地址 LCALL SETYLJMP CLRST1CLR4:INC LCD_PAGECLRST1:LCALL SETPAGEMOV R7,#40HCLR5:MOV A,#0FFH ;显示校验LCALL LCDWRDATADJNZ R7,CLR5MOV A,LCD_PAGECJNE A,#07H,CLR4MOV LCD_LINE,#00HLCALL SETLINEMOV LCD_PAGE,#00HLCALL SETPAGEMOV LCD_Y,#00HLCALL SETYLJMP CLRST2CLR6:INC LCD_PAGECLRST2:LCALL SETPAGEMOV R7,#40HCLR7:MOV A,#00H ;清显示LCALL LCDWRDATADJNZ R7,CLR7MOV A,LCD_PAGECJNE A,#07H,CLR6CLR XCS ;选择CS1MOV LCD_OPEN,#01H ;开显示器1, 关显示器0 LCALL LCDOPENMOV LCD_LINE,#00HLCALL SETLINE ;设置起始行MOV LCD_PAGE,#00HLCALL SETPAGE ;设置页地址MOV LCD_Y,#00HLCALL SETY ;设置列地址LJMP CLRST3CLR0:INC LCD_PAGECLRST3:LCALL SETPAGEMOV R7,#40HCLR1:MOV A,#0FFH ;显示校验LCALL LCDWRDATADJNZ R7,CLR1MOV A,LCD_PAGECJNE A,#07H,CLR0MOV LCD_LINE,#00HLCALL SETLINEMOV LCD_PAGE,#00HLCALL SETPAGEMOV LCD_Y,#00HLCALL SETYLJMP CLRST4CLR2:INC LCD_PAGECLRST4:LCALL SETPAGEMOV R7,#40HCLR3:MOV A,#00H ;清显示LCALL LCDWRDATADJNZ R7,CLR3MOV A,LCD_PAGECJNE A,#07H,CLR2;初始化完毕************************************************************************* CLR HZDHWRLCD:JNB HZDH,XZFXDH:MOV DPTR,#DHDOT ;写动画或图片LJMP DH0XZF:MOV DPTR,#HZDOT ;写字符(汉字或字母或符号)MOV XWPD,#00HHZ0:CLR XCSMOV LCD_LINE,#00H ;置起始行LCALL SETLINEMOV LCD_PAGE,#00HLCALL SETPAGE ;置页MOV LCD_Y,#00H ;置列LCALL SETYMOV HHPD,#00HHZ7:MOV YCPD,#00HHZ8:CLR BZPDHZ3:MOV R0,#08H ;写左上8个Y列HZ1:MOV A,#00HMOVC A,@A+DPTRLCALL LCDWRDATAINC DPTRINC LCD_YDJNZ R0,HZ1JB BZPD,HZ2CLR C ;Y列减8, 即返回扫描MOV A,LCD_YSUBB A,#08HMOV LCD_Y,ALCALL SETYINC LCD_PAGE ;页地址加1,即换第2页扫描 LCALL SETPAGESETB BZPDLJMP HZ3HZ2:DEC LCD_PAGE ;返回到第1页中,准备下一个半字扫描 LCALL SETPAGEINC YCPDMOV A,YCPDCJNE A,#08H,HZ8JB XCS,HZ9SETB XCS ;换屏LCALL SETPAGEMOV LCD_Y,#00H ;置列LCALL SETYLJMP HZ7HZ9:CLR XCS ;写完一行后从CS2返回到CS1中INC LCD_PAGEINC LCD_PAGELCALL SETPAGE ;下一行开始MOV LCD_Y,#00HLCALL SETYINC HHPDMOV A,HHPDCJNE A,#04H,HZ7INC XWPD ;换第二幅画面MOV A,XWPDCJNE A,#02H,HZ0LJMP$DH0:MOV XWPD,#00HDH1:CLR XCSMOV LCD_LINE,#00H ;置起始行 LCALL SETLINEMOV LCD_PAGE,#00HLCALL SETPAGE ;置页MOV LCD_Y,#00H ;置列LCALL SETYMOV HHPD,#00HDH2:MOV R0,#40H ;写上64个Y列 DH3:MOV A,#00HMOVC A,@A+DPTRLCALL LCDWRDATAINC DPTRDJNZ R0,DH3JB XCS,DH4SETB XCSLCALL SETPAGEMOV LCD_Y,#00HLCALL SETYLJMP DH2DH4:CLR XCS ;写完一行后从CS2返回到CS1中 INC LCD_PAGELCALL SETPAGE ;下一行开始MOV LCD_Y,#00HLCALL SETYINC HHPDMOV A,HHPDCJNE A,#08H,DH2INC XWPD ;换第二幅画面MOV A,XWPDCJNE A,#02H,DH1LJMP$LCDWRINST:NOPJB XCS,INS0CLR LCD_CS1SETB LCD_CS2LJMP INS1INS0:SETB LCD_CS1CLR LCD_CS2INS1:SETB LCD_ECLR LCD_DICLR LCD_RWMOV P1,ALCALL DLY10CLR LCD_ELCALL DLY10RETLCDWRDATA:NOPJB XCS,DA T0CLR LCD_CS1SETB LCD_CS2LJMP DA T1DA T0:SETB LCD_CS1CLR LCD_CS2DA T1:SETB LCD_ESETB LCD_DICLR LCD_RWMOV P1,ALCALL DLY10CLR LCD_ELCALL DLY10NOPRETLCDOPEN:MOV A,LCD_OPEN ;开显示器 ANL A,#3FHORL A,#3EHLCALL LCDWRINSTNOPRETSETLINE:MOV A,LCD_LINEORL A,#0C0H ;设置起始行LCALL LCDWRINSTRETSETPAGE:MOV A,LCD_PAGEANL A,#0BFHORL A,#0B8H ;设置页地址 LCALL LCDWRINSTNOPRETSETY:MOV A,LCD_YANL A,#7FHORL A,#40HNOP ;设置列地址LCALL LCDWRINSTNOPRETDL Y10:NOPMOV R5,#01HDL1:MOV R4,#01HDL2:MOV R6,#0FHDL3:DJNZ R6,DL3DJNZ R4,DL2DJNZ R5,DL1NOPRETHZDOT:;新 CD0C2DB 000H,044H,04CH,07CH,0D7H,0E6H,07CH,05CH DB 000H,022H,01AH,04EH,0FFH,07FH,00EH,09AH DB 044H,0FEH,0FCH,046H,0C2H,0C3H,062H,040H DB 060H,03FH,01FH,000H,0FFH,0FFH,000H,000H;年 CC4EADB 000H,020H,010H,018H,0ECH,0CFH,04AH,048H DB 000H,004H,004H,004H,007H,007H,004H,004H DB 0F8H,0F8H,048H,048H,068H,04CH,008H,000H DB 0FFH,0FFH,004H,004H,004H,004H,006H,004H;快 CBFECDB 000H,0C0H,060H,0FFH,0FEH,030H,060H,008H DB 000H,000H,000H,0FFH,07FH,080H,041H,071H DB 008H,0FFH,0FEH,008H,0F8H,0FCH,008H,000H DB 03DH,00FH,007H,00DH,039H,071H,0E1H,041H;乐 CC0D6DB 000H,000H,080H,080H,0FEH,0FCH,084H,084H DB 000H,040H,020H,030H,01CH,00EH,024H,040H DB 0FEH,0F6H,082H,083H,0C2H,080H,000H,000H DB 0FFH,07FH,000H,002H,00CH,018H,070H,020H;欢 CBBB6DB 000H,034H,0C4H,004H,0C4H,0FCH,03EH,024H DB 000H,040H,038H,00FH,007H,03CH,098H,060H DB 018H,00EH,0EFH,0CAH,048H,038H,01CH,008H DB 030H,01CH,00FH,007H,01CH,070H,0E0H,040H;迎 CD3ADDB 000H,040H,046H,0DCH,0E8H,040H,0FEH,0FCH DB 000H,040H,0E0H,03FH,01FH,032H,067H,0C3H DB 006H,003H,0FDH,0FCH,004H,0FCH,0FEH,004H DB 0C2H,0C1H,0FFH,0DFH,0C2H,0C7H,0C3H,040H;使 CCAB9DB 000H,080H,060H,0F8H,0EFH,006H,008H,0F8H DB 000H,000H,000H,0FFH,07FH,080H,080H,043H DB 0E8H,028H,0FFH,0FEH,028H,0E8H,0FCH,028H DB 065H,039H,01FH,037H,061H,063H,0C1H,040H;用 CD3C3DB 000H,000H,000H,0FFH,0FEH,022H,022H,022H DB 000H,080H,070H,03FH,00FH,002H,002H,002H DB 0FEH,0FEH,022H,022H,022H,0FEH,0FFH,002H DB 07FH,03FH,002H,042H,042H,0FFH,07FH,000H;杭 CBABCDB 000H,010H,0D0H,0FFH,0FEH,090H,010H,008H DB 000H,006H,001H,0FFH,07FH,001H,083H,040H DB 0E8H,0C9H,04FH,04EH,0C8H,0E8H,04CH,008H DB 07FH,03FH,000H,000H,07FH,0FFH,0C0H,070H;州 CD6DDDB 000H,010H,0E0H,0C0H,0FFH,0FEH,010H,0E0H DB 000H,080H,041H,070H,03FH,00FH,000H,001H DB 0C0H,0FEH,0FCH,030H,0E0H,0C0H,0FFH,0FEH DB 000H,03FH,01FH,000H,001H,000H,0FFH,07FH;求 CC7F3DB 000H,000H,008H,068H,0C8H,088H,008H,0FFH DB 000H,010H,070H,038H,00DH,026H,041H,0FFH DB 0FEH,088H,0CBH,07EH,02CH,008H,000H,000H DB 07FH,003H,006H,01CH,038H,070H,020H,000H;是 CCAC7DB 000H,080H,080H,080H,0FFH,0BEH,0AAH,0AAH DB 000H,080H,060H,038H,00FH,01AH,030H,020H DB 0AAH,0AAH,0AAH,0FEH,0BFH,082H,0C0H,080H DB 07FH,07FH,044H,0C4H,0C6H,0C4H,0C0H,040H;医 CD2BDDB 000H,000H,0FFH,0FEH,042H,0A2H,0BAH,09EH DB 000H,040H,0FFH,07FH,060H,050H,058H,04CH DB 096H,0F2H,0F2H,092H,09AH,0D3H,082H,000H DB 046H,043H,041H,046H,04CH,058H,068H,040H;学 CD1A7DB 000H,010H,038H,01CH,00BH,04EH,048H,04BH DB 000H,000H,004H,004H,004H,004H,044H,044HDB 04EH,0C8H,0ECH,04FH,00AH,038H,01CH,008H DB 0FFH,07FH,004H,004H,004H,006H,004H,000H;科 CBFC6DB 000H,024H,0A4H,0FEH,0FEH,0A3H,022H,0C0H DB 000H,00CH,003H,0FFH,07FH,001H,00BH,008H DB 08CH,038H,010H,0FFH,0FEH,000H,000H,000HDB 00BH,005H,004H,0FFH,07FH,002H,003H,002H;技 CBCBCDB 000H,010H,010H,0FFH,0FEH,010H,098H,048H DB 000H,00CH,046H,0FFH,07FH,001H,080H,040H DB 0C8H,048H,07FH,07EH,0C8H,0E8H,04CH,008H DB 061H,037H,01CH,01EH,037H,061H,0E0H,040H;有 CD3D0DB 000H,084H,044H,064H,034H,0FCH,0EFH,026H DB 000H,000H,000H,000H,000H,0FFH,07FH,009H DB 024H,024H,024H,0E4H,0F4H,024H,006H,004H DB 009H,009H,049H,0FFH,07FH,000H,000H,000H;限 CCFDEDB 000H,0FFH,0FEH,042H,0BEH,01FH,002H,0FFH DB 000H,0FFH,0FFH,008H,01FH,00FH,040H,0FFH DB 0FEH,092H,092H,092H,0FEH,0FFH,002H,000H DB 07FH,061H,036H,01CH,039H,06EH,0E4H,040H;公 CB9ABDB 000H,000H,080H,0C0H,070H,03EH,00FH,082H DB 000H,001H,000H,060H,0F0H,078H,06EH,067H DB 0C0H,080H,00FH,03EH,070H,0E0H,0C0H,080H DB 021H,022H,026H,03CH,0F8H,070H,001H,000H;司 CCBBEDB 000H,000H,010H,0D2H,092H,092H,092H,092H DB 000H,000H,000H,01FH,00FH,008H,008H,008HDB 01FH,00FH,000H,040H,040H,0FFH,07FH,000H;地 CB5D8DB 000H,020H,020H,0FEH,0FCH,020H,060H,0F8H DB 000H,010H,030H,01FH,01FH,008H,004H,07FH DB 0F0H,020H,0FFH,0FEH,010H,0F0H,0F8H,010H DB 0FFH,0C0H,0C7H,0C7H,0C2H,0C7H,0F3H,040H;址 CD6B7DB 000H,020H,020H,0FEH,0FCH,020H,020H,0E0H DB 000H,010H,030H,03FH,01FH,058H,048H,07FH DB 0C0H,000H,000H,0FFH,0FEH,040H,060H,040H DB 07FH,040H,040H,07FH,07FH,040H,060H,040H;: CA3BADB 000H,000H,000H,000H,000H,000H,000H,000H DB 000H,000H,036H,036H,000H,000H,000H,000H DB 000H,000H,000H,000H,000H,000H,000H,000H DB 000H,000H,000H,000H,000H,000H,000H,000H;通 CCDA8DB 000H,040H,046H,0DCH,0E8H,040H,000H,0F9H DB 000H,040H,0E0H,03FH,01FH,030H,060H,0FFH DB 0F1H,055H,0FDH,0F9H,057H,0F3H,0F9H,010H DB 0DFH,0C2H,0DFH,0CFH,0D2H,0FFH,0DFH,040H;惠 CBBDDDB 000H,000H,002H,0FEH,0FAH,0AAH,0AAH,0FFHDB 0FFH,0AAH,0AAH,0FAH,0FEH,00AH,000H,000H DB 0FBH,0D2H,0C2H,0F2H,04FH,016H,070H,020H;北 CB1B1DB 000H,020H,020H,020H,020H,0FEH,0FEH,000H DB 000H,020H,060H,020H,010H,0FFH,0FFH,000H DB 000H,0FFH,0FEH,082H,0C0H,060H,038H,010H DB 000H,07FH,0FFH,0C1H,0C0H,0C0H,0F0H,040H;路 CC2B7DB 000H,07FH,03EH,0E2H,0BEH,07FH,002H,010H DB 000H,07CH,060H,03FH,03FH,012H,00BH,001H DB 08CH,0DFH,066H,074H,0DCH,08EH,004H,000H DB 0FFH,07EH,042H,042H,0FEH,07FH,003H,001H;2 CHAR_32DB 008H,00CH,084H,0C4H,064H,03CH,018H,000H DB 00EH,00FH,009H,008H,008H,00CH,00CH,000H;8 CHAR_38DB 0B8H,0FCH,044H,044H,044H,0FCH,0B8H,000H DB 007H,00FH,008H,008H,008H,00FH,007H,000H;号 CBAC5DB 000H,080H,080H,080H,0BFH,09EH,092H,092H DB 000H,000H,000H,000H,004H,00EH,007H,005H DB 092H,092H,092H,0BEH,09FH,082H,0C0H,080H DB 024H,044H,0E4H,07CH,01EH,004H,000H,000H;电 CB5E7DB 000H,000H,0F8H,0F0H,090H,090H,090H,0FFH DB 000H,000H,00FH,007H,004H,004H,004H,07FH DB 0FEH,090H,090H,090H,0F0H,0F8H,010H,000H DB 0FFH,0C4H,0C4H,0C4H,0CFH,0C7H,0F0H,040H;话 CBBB0DB 000H,040H,046H,0DCH,0E8H,040H,020H,024H DB 000H,000H,020H,07FH,03FH,010H,008H,0FFH DB 024H,024H,0FEH,0FEH,026H,023H,032H,020H DB 07EH,042H,043H,043H,042H,0FEH,07FH,002H;: CA3BADB 000H,000H,000H,000H,000H,000H,000H,000H DB 000H,000H,036H,036H,000H,000H,000H,000H DB 000H,000H,000H,000H,000H,000H,000H,000H DB 000H,000H,000H,000H,000H,000H,000H,000H;0 CHAR_30DB 0F8H,0FCH,004H,0C4H,024H,0FCH,0F8H,000H DB 007H,00FH,009H,008H,008H,00FH,007H,000H;5 CHAR_35DB 07CH,07CH,044H,044H,0C4H,0C4H,084H,000H DB 004H,00CH,008H,008H,008H,00FH,007H,000H;7 CHAR_37DB 00CH,00CH,004H,084H,0C4H,07CH,03CH,000HDB 000H,000H,00FH,00FH,000H,000H,000H,000H;1 CHAR_31DB 000H,010H,018H,0FCH,0FCH,000H,000H,000H DB 000H,008H,008H,00FH,00FH,008H,008H,000H;- CHAR_2DDB 080H,080H,080H,080H,080H,080H,080H,000H DB 000H,000H,000H,000H,000H,000H,000H,000H;8 CHAR_38DB 0B8H,0FCH,044H,044H,044H,0FCH,0B8H,000H DB 007H,00FH,008H,008H,008H,00FH,007H,000H;2 CHAR_32DB 008H,00CH,084H,0C4H,064H,03CH,018H,000H DB 00EH,00FH,009H,008H,008H,00CH,00CH,000H;6 CHAR_36DB 0F0H,0F8H,04CH,044H,044H,0C0H,080H,000H DB 007H,00FH,008H,008H,008H,00FH,007H,000H;0 CHAR_30DB 0F8H,0FCH,004H,0C4H,024H,0FCH,0F8H,000H DB 007H,00FH,009H,008H,008H,00FH,007H,000H;4 CHAR_34DB 0C0H,0E0H,0B0H,098H,0FCH,0FCH,080H,000H DB 000H,000H,000H,008H,00FH,00FH,008H,000H;7 CHAR_37DB 00CH,00CH,004H,084H,0C4H,07CH,03CH,000HDB 000H,000H,00FH,00FH,000H,000H,000H,000H;1 CHAR_31DB 000H,010H,018H,0FCH,0FCH,000H,000H,000HDB 000H,008H,008H,00FH,00FH,008H,008H,000H;5 CHAR_35DB 07CH,07CH,044H,044H,0C4H,0C4H,084H,000HDB 004H,00CH,008H,008H,008H,00FH,007H,000HDHDOT:;-------------------------------------------------------------------------------DB000H,000H,000H,000H,000H,000H,000H,000H,007H,0E7H,0E3H,0E1H,0E1H,0E1H,0E1H,0C1H, DB0C1H,081H,081H,081H,083H,083H,083H,083H,087H,087H,08FH,08FH,09FH,0BFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0F3H,0F3H,0F1H,0E1H,061H,061H,020H, DB030H,030H,0B0H,0B0H,0B0H,0B8H,0B8H,0BCH,0BCH,03EH,03EH,03FH,03FH,07FH,07FH,07FH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FEH,0FEH,0FCH,0FCH,0FCH,0FEH,0FFH, DB0F7H,0E3H,0E7H,0EFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,000H,000H,000H, DB000H,000H,000H,000H,000H,000H,000H,000H,000H,001H,07FH,0FFH,0F3H,083H,083H,081H,DB001H,001H,000H,080H,080H,000H,002H,002H,002H,006H,004H,0A5H,0EDH,0EDH,0EBH,0DBH, DB0F7H,0BFH,07FH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0F7H,089H,080H,082H,0C0H,080H, DB000H,000H,000H,000H,000H,088H,0C0H,0F8H,0F8H,0F8H,0F0H,0F0H,0E0H,0C0H,0C0H,0F0H, DB0F8H,0F8H,0FCH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,00FH,000H,000H,000H, DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,07FH,0FFH,0FFH,0FFH,0FFH,DB0FFH,0FEH,0FFH,0FFH,0FFH,0FFH,0FEH,0FEH,0FEH,0FEH,0FEH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH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H,00FH,007H,007H,001H,000H,000H,000H,000H,000H,000H,000H,000H,000H, DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,003H,03FH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,01FH,000H,000H,07CH,0FFH,0FFH,078H, DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,003H,0FFH,DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0E3H,0E3H,0C3H,087H,08FH,01FH,01FH,0BFH,0BFH,0FFH,0FFH, DB0FFH,0F7H,0F3H,0F3H,0FBH,0FBH,0FBH,0FBH,0FBH,0FBH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,07FH,07FH,07FH,07FH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,00FH,000H,000H,000H,000H,000H,000H,000H, DB000H,000H,000H,000H,000H,000H,0E0H,0F8H,0FCH,0FEH,0FEH,0FEH,0FEH,0FEH,0FCH,0FCH, DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,0F8H,0FFH,DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,DB0FFH,0FDH,0F9H,0F3H,0E7H,0C7H,087H,007H,007H,0C7H,087H,087H,08FH,08FH,08FH,0CFH, DB0CFH,0DFH,0FFH,09FH,0DFH,0DFH,0FFH,0CFH,0EFH,0EFH,0FFH,0FFH,0CFH,0CFH,0E7H,0E7H, DB0E3H,0E3H,0E3H,0F1H,0F9H,0F9H,0F8H,0FCH,0FCH,0FEH,0FEH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,03FH,00FH,007H,000H,000H,000H,000H,000H,000H,000H,000H,000H,DB000H,000H,000H,000H,000H,000H,000H,007H,027H,07FH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,0E0H,0FCH,0FFH,0FFH,DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0F8H,0F1H,0F3H,0E7H,0CFH,0CFH,0DFH,0DFH, DB09FH,09FH,0BFH,0BFH,0BFH,09FH,0DFH,0DFH,0DFH,0CFH,0EFH,0FFH,0FFH,0FFH,0FBH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH, DB0FFH,0F7H,0FDH,0FCH,0FCH,0FEH,0FFH,0FCH,0C0H,000H,000H,000H,000H,000H,000H,000H, DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,001H,0F1H,0FFH,0FFH,。
13.3.2 LCD编程C语言程序例
LcdCtrl_D|=(1<<LcdRS);
LcdCtrl_D|=(1<<LcdRW);
LcdCtrl|=(1<<LcdE); //E=1
LcdCtrl&=~(1<<LcdRS); //RS、R/W=00,写指令
LcdCtrl&=~(1<<LcdRW);
*参数:str:待显示数组*
*返回:无*
*------------------以上为子程序说明-------------------*/
void lcdshow(unsigned char str[])
{
unsigned char i;
LcdInit(); //调用Lcd初始化子程序
//显示第1行16个字符
//内部调用子程序
void Lcd_Command(unsigned char cmd); //命令执行子程序
void LcdInit(void); //Lcd初始化子程序
/*LcdShow:在HD44780显示屏上显示数据--------------------*
*功能描述:在HD44780显示屏上显示str中的32个数据*
LcdData=cmd;//把指令码送到Lcd数据传送口
LcdCtrl|=(1<<LcdE); //Lcd开始接收数据
asm("NOP");
asm("NOP");
asm("NOP");
LcdCtrl&=~(1<<LcdE); //Lcd结束接收数据
LCD1602汇编显示程序
RSBIT P 2.0;定义RS为P2.0RWBIT P2.1;定义RW为P2.1EBIT P2.2;定义E为P2.2ORG 00HSJMP STARTORG0030HSTART:LCALL LCDINITMAIN:MOV A,#80H;显示开及光标设置LCALL BUSYLCALL WRTCMOVR2,#04HMOVDPTR,#TAB1LCALL DELAYMOV A,#0C0H;显示开及光标设置LCALL BUSYLCALL WRTCMOVR2,#04HMOVDPTR,#TAB2LCALL DELAYLCALL WRTDLCALL DELAY1LCALL DELAY1MOV A,#01H;清屏LCALL BUSYLCALL WRTCMOV A,#80H;显示开及光标设置LCALL BUSYLCALL WRTCMOVR2,#0FHMOVDPTR,#TAB4LCALL DELAYLCALL WRTDLCALL DELAY1MOV A,#01H;清屏LCALL BUSYLCALL WRTCLJMP MAIN;***************初始化***************** LCDINIT:LCALLDELAY;xx15msLCALLDELAYLCALLDELAYMOVA,#38H;显示模式设置(8位数据线,16*2 5*7点阵) LCALL WRTCLCALL DELAY;xx5msMOVA,#38HLCALL WRTCLCALL DELAY;xx5msMOVA,#38HLCALL WRTCLCALL DELAY;xx5msMOVA,#38HLCALL BUSYMOVA,#08HLCALL BUSYLCALL WRTCMOV A,#01H;清屏LCALL BUSYLCALL WRTCMOVA,#06H;显示光标移动设置LCALL BUSYLCALL WRTCMOV A,#0CH;示开关控制,显示开,无光标,不闪烁。
液晶(LCD)显示程序
************************************************************* 功能:液晶(LCD)显示程序;LCD: TRULY M19264-5A1 192*64点阵驱动器: S6B0108/S6B0107或HD61202及相兼容驱动器MPU: AT89S51开发环境: KEIL C51作者:纪长城日期: 2005年10月************************************************************/ #include <AT89X51.H>#include <ZKDot.h>#define DISP_OFF 0X3E //关闭显示#define DISP_ON 0X3F //打开显示#define START_ROW 0xC0 //设置起始行#define FIRST_PAGE 0xB8 //设置页#define START_YADD 0x40 //设置列/*----------------------------------------MPU端口定义----------------------------------------*/#define LCD_PORT P0#define LCD_RESET P2_2#define LCD_CSA P2_3#define LCD_CSB P2_4#define LCD_RS P2_5#define LCD_RW P2_6#define LCD_E P2_7/*------------------------------------------LCD的区选择程序:F为要选通的区,取值为0,1,2,对应选中三个区,取其它值选中第三个区--------------------------------------------*/void LCD_CSAB_SET(unsigned char block){if(0==block) //0 选择第一区{LCD_CSA=0;LCD_CSB=0;}else if(1==block) //1 选择第二区{LCD_CSA=0;LCD_CSB=1;}else //2 选择第三区{LCD_CSA=1;LCD_CSB=0;}}/*---------------------------------------//延时子程序----------------------------------------*/void Delay_xMs(unsigned int xMs){unsigned int i,j;for(i=0;i<xMs;i++)for(j=0;j<500;j++);}/*---------------------------------------向LCD中写入指令或指令,F=0 是指令,F=1是数据,bkock是选择写入哪个区 ---------------------------------------*/void LCD_Write( unsigned char Com,bit F){LCD_PORT = Com; //把数据输出LCD_RS = F; //确定是数据还是指令LCD_RW = 0;LCD_E = 1;LCD_E = 0; //电平下降沿数据写入控制器}/*----------------------------------------------坐标定位程序参数XPage 定位页取值0--7 共8页Y 横向定位取值0-191 共192列-----------------------------------------------*/ void LCD_XY_SET(unsigned char X,unsigned char YPage) {if(X<64) //在第一个区中{LCD_CSAB_SET(0);LCD_Write(FIRST_PAGE|YPage,0);LCD_Write(START_YADD|X,0);}else if(X<128) //在第二个区中{LCD_CSAB_SET(1);LCD_Write(FIRST_PAGE|YPage,0);LCD_Write(START_YADD|X-64,0);}else if(X<192) //在第三个区中{LCD_CSAB_SET(2);LCD_Write(FIRST_PAGE|YPage,0);LCD_Write(START_YADD|X-128,0);}}/*--------------------------------------------清除一行的子程序 H是要清的页,取值0-3--------------------------------------------*/void LCD_Clear_H(unsigned char H){unsigned char i,j,k;for (k=0;k<2;k++)for (i=0;i<3;i++){LCD_XY_SET(i*64,H*2+k);for(j=0;j<64;j++) LCD_Write(0x00,1);}}/*----------------------------------------LCD初始化程序----------------------------------------*/void LCD_Init(void){unsigned char i;LCD_E = 0;LCD_RW = 1;LCD_RS = 0;LCD_RESET= 0; //液晶模块复位Delay_xMs(10); //等待10mSLCD_RESET= 1; //液晶结束复位电平LCD_CSAB_SET(0);LCD_Write(DISP_ON,0); //模块1显示开LCD_CSAB_SET(1);LCD_Write(DISP_ON,0); //模块2显示开LCD_CSAB_SET(2);LCD_Write(DISP_ON,0); //模块3显示开for (i=0;i<4;i++) LCD_Clear_H(i); //清屏}/*----------------------------------------读display RAM---------------------------------------*/unsigned char LCD_READ_RAM(unsigned char x,unsigned char y) {unsigned char temp;LCD_XY_SET(x,y);LCD_RW = 1; //设置为读数据LCD_RS = 1;LCD_PORT =0XFF; //设置总线为高电平(空)LCD_E = 0;LCD_E = 1;temp =LCD_PORT;LCD_E =0;return temp;}/*------------------------------------------设制起始行,参数line为要起始的行,取值范围0--63,block 为要设置的块-----------------------------------------*/void LCD_LINE_SET(unsigned char line){unsigned char i;for (i=0;i<3;i++){LCD_CSAB_SET(i);LCD_Write(START_ROW|line,0);}}/*----------------------------------------------显示一个16*8的ASCII的程序 ,参数是ascii码值,x取值0-191,y取值0-3 只能显示四行------------------------------------------------*/bit LCD_PRINT_ASCII_1608(unsigned char ascii,unsigned char x,unsigned char y) {unsigned char i,j;if((x+8)>191)return 1;for(j=0;j<2;j++)for(i=j;i<16;i+=2){LCD_XY_SET(x+(i>>1),y*2+j);LCD_Write(AsciiDotBig[(ascii-0x20)*16+i],1);}return 0;}/*-------------------------------------------------查找汉字程序参数是内码的高8位与低8位---------------------------------------------------*/unsigned char LCD_SEARCH_HZ16(unsigned char h,unsigned char l){unsigned char i;for(i=0;i<17;i++)if(HZ[i].Index[0]==h&&HZ[i].Index[1]==l) return i;}/*----------------------------------------------------16点阵的汉字显示程序----------------------------------------------------*/bit LCD_PRINT_HZ16(unsigned char wz,unsigned char x,unsigned char y) {unsigned char i,j;if((x+16)>192) return 1;for(j=0;j<2;j++)for(i=0;i<16;i++){LCD_XY_SET(x+i,y*2+j);LCD_Write(HZ[wz].Msk[i+(16*j)],1);}return 0;}/*--------------------------------------------点操作函数,参数,X/Y,取值为192/64 F 0-1,0是画点,1是取消点---------------------------------------*/void LCD_POINT(unsigned char X,unsigned char Y,bit F){unsigned char i,j,k;i=Y&&0xF8;//i是X/8的余数Y>>=3; //x是X/8的商j=LCD_READ_RAM(X,Y);//空读操作j=LCD_READ_RAM(X,Y);//读出8位数据LCD_XY_SET(X,Y);k=1<<i;if(F){k=~k;LCD_Write(j&k,1);}elseLCD_Write(j|k,1);}/*----------------------------------------------- 显示图像的一个例子---------------------------------------------*/ void LCD_TU(void){unsigned char i,j;for(i=0;i<6;i++)for(j=0;j<100;j++){LCD_XY_SET(j,i);LCD_Write(TP[i*100+j],1);}}/*---------------------------------------------测试主函数-------------------------------------------------*/ main(){unsigned char i,j,k,m;unsigned char code c[]="我老婆最可爱最漂亮的";LCD_Init();LCD_TU();for(i=0;i<18;i+=2){m=LCD_SEARCH_HZ16(c[i],c[i+1]); LCD_PRINT_HZ16(m,i*8,3);}while(1){for(i=0;i<64;i++){LCD_LINE_SET(i);if(i==0)Delay_xMs(500); //等待elseDelay_xMs(20); //等待}}}。
LCD12864显示程序(汇编语言)
;实验目的:熟悉12864LCD的使用;12864LCD带中文字库;编程让12864LCD显示公司名称“深圳乾龙盛电子”,公司电话“5”,公司传真“6”;硬件设置:;关断所有拨码开关。
#include<p16f877a.inc>;__CONFIG_DEBUG_OFF&_CP_ALL&_WRT_HALF&_CPD_ON&_LVP_OFF&_BODEN_OFF&_PWRTE_ON&_WDT_OFF&_H S_OSC;芯片配置字,看门狗关,上电延时开,掉电检测关,低压编程关,加密,4M晶体HS振荡 #define RS PORTA,5 ;命令/数据选择#DEFINE RW PORTA,4 ;读/写选择#DEFINE E PORTA,3 ;使能信号#DEFINE PSB PORTA,2 ;并口/串口选择(H/L)#DEFINE RST PORTA,0 ;复位信号;-----------------------------------------------LCD_X EQU 30H ;页地址LCD_Y EQU 31H ;Y地址COUNT EQU 32H ;循环计数用COUNT1 EQU 33H ;循环计数用COUNT2 EQU 34H ;循环计数用POINT EQU 35H ;查表偏移地址POINT1 EQU 36H ;查表偏移地址POINT2 EQU 37H ;查表偏移地址TEMP EQU 38H ;临时寄存器TEMP1 EQU 39H ;临时寄存器;-----------------------------------------------ORG 0000H ;复位地址NOP ;ICD需要的空指令GOTO MAIN ;跳转到主程序;**********************主程序************************MAINBANKSEL TRISACLRF TRISA ;A口输出CLRF TRISD ;D口输出BANKSEL ADCON1MOVLW 06HMOVWF ADCON1 ;A口全为数字口CLRF STATUSBCF RST ;复位LCDCALL DELAY ;延时一段时间BSF RST ;清除复位信号NOPBSF PSB ;并口通讯;**************************初始化**********************MOVLW 30H ;基本指令操作CALL SEND_IMOVLW 01H ;清除显示CALL SEND_IMOVLW 06H ;指定在写入或读取时,光标的移动方向 CALL SEND_IMOVLW 0CH ;开显示,关光标,不闪烁CALL SEND_I;***********************显示汉字************************HAN_WR2CALL CLEAR_P ;清屏HAN_WR2A ;“深圳乾龙盛电子”MOVLW LOW(TAB1A)MOVWF POINTMOVLW HIGH(TAB1A)MOVWF POINT1 ;获取表格的首地址MOVLW 0eH ;数数据字节个数(7个汉字共14字节) MOVWF COUNTMOVLW 81H ;页地址CALL SEND_ICALL QUSHUHAN_WR2B ;“。
(整理)LCD1602汇编程序.
(整理)LCD1602汇编程序.LCD1602汇编程序;* 描述: LCD1602 滚动显示*;* 显示方式:*;* 1、从左到右逐字显示,闪动二次,清屏。
*;* 2、再从右到左逐字显示,闪动二次,清屏。
*;* 3、周期性地重复上述显示方式。
*;************************************************************** ***** LCD_RS EQU P2.0LCD_RW EQU P2.1LCD_EN EQU P2.2;************************************************************** ***** ORG 0000HAJMP MAINORG 0030H;************************************************************** ***** MAIN:MOV SP,#60HMOV R4,#02H ;设置闪烁次数ACALL LCD_INITMAIN1:ACALL LCDSET1MOV DPTR,#CHAR1ACALL WRITE1 ;MOV A,#0C0H ;显示第二行左边第一位位置ACALL LCD_CMDMOV DPTR,#CHAR2 ;显示ACALL WRITE1ACALL DELAY4 ;延时ACALL DELAY4ACALL SHAN ;闪烁两次ACALL LCDSET2MOV DPTR,#CHAR3 ;ACALL WRITE1MOV A,#0C0H ;显示第二行右边第一位位置ACALL LCD_CMDMOV DPTR,#CHAR4 ;显示ACALL WRITE1ACALL DELAY4 ;延时ACALL DELAY4ACALL SHAN ;闪烁两次ACALL MAIN1;************************************************************** *;LCD初始化设定子程序;************************************************************** * LCD_INIT:ACALL DELAY5MS ;延时15MSACALL DELAY5MS ;等待LCD 电源稳定ACALL DELAY5MSMOV A,#38H ;16*2 显示,5*7 点阵,8 位数据ACALL LCD_CMD_NC ;不进行LCD 忙检测ACALL DELAY5MSMOV A,#38H ;16*2 显示,5*7 点阵,8 位数据ACALL LCD_CMD_NC ;不进行LCD 忙检测ACALL DELAY5MSMOV A,#38H ;16*2 显示,5*7 点阵,8 位数据ACALL LCD_CMD_NC ;不进行LCD 忙检测ACALL DELAY5MSMOV A,#08H ;显示关ACALL LCD_CMD ;进行LCD 忙检测MOV A,#01H ;清除屏幕ACALL LCD_CMD ;进行LCD忙检测MOV A,#06H ;移动光标ACALL LCD_CMD ;进行LCD 忙检测MOV A,#0CH ;显示开,关光标ACALL LCD_CMD ;进行LCD 忙检测RET;************************************************************** * ;显示位置与移动光标设定;************************************************************** * LCDSET1:MOV A,#01H ;清除屏幕ACALL LCD_CMDACALL DELAY5MSMOV A,#06H ;移动光标(光标加1)ACALL LCD_CMDACALL DELAY5MSMOV A,#80H ;显示第一行左边第一位位置ACALL LCD_CMDACALL DELAY5MSRETLCDSET2:MOV A,#01H ;清除屏幕ACALL LCD_CMDACALL DELAY5MSMOV A,#06H ;移动光标(光标减1)ACALL LCD_CMDACALL DELAY5MSMOV A,#80H ;显示第一行右边第一位位置ACALL LCD_CMDACALL DELAY5MSRET;************************************************************** * ;写指令数据到LCD;RS=L,RW=L,D0-D7=指令码,E=高脉冲;************************************************************** * LCD_CMD:ACALL CHECKBUSYLCD_CMD_NC:CLR LCD_RSCLR LCD_RWMOV P0,ASETB LCD_ENNOPNOPNOPNOPCLR LCD_ENRET;************************************************************** * ; 发送字符串子程序;************************************************************** * WRITE1:MOV R0,#16WRITE0:CLR AMOVC A,@A+DPTRINC DPTRACALL LCD_WDATACALL DELAY ;加延时形成滚动效果DJNZ R0,WRITE0RET;************************************************************** * ;写显示数据到LCD;RS=H,RW=L,D0-D7=数据,E=高脉冲;************************************************************** * LCD_WDATA:ACALL CHECKBUSYSETB LCD_RSCLR LCD_RWMOV P0,ASETB LCD_ENNOPNOPNOPNOPCLR LCD_ENRET;************************************************************** * ;检测LCD 控制器忙状态;读数据;RS=L,RW=H,E=H,输出:D0-D7=数据;************************************************************** * CHECKBUSY:PUSH ACCMOV P0,#0FFHCLR LCD_RSSETB LCD_RWSETB LCD_ENBUSYLOOP:NOPJB P0.7,BUSYLOOPCLR LCD_ENPOP ACCRET;************************************************************** * ;闪烁子程序;************************************************************** * SHAN:MOV A,#08H ;关闭显示ACALL LCD_CMDACALL DELAY4MOV A,#0CH ;开显示,关闭光标ACALL LCD_CMDACALL DELAY4DJNZ R4,SHANMOV R4,#02H ;设置闪烁次数RET;************************************************************** * ;延时120MS 子程序;发送字符串时使用;************************************************************** * DELAY:MOV R7,#240DL1: MOV R6,#250DL2: DJNZ R6,DL2DJNZ R7,DL1RET;************************************************************** * ;延时800MS 子程序;闪烁时使用;************************************************************** * DELAY4:MOV R0,#40DL3: MOV R1,#100DL4: MOV R2,#100DL5: DJNZ R2,DL5DJNZ R1,DL4DJNZ R0,DL3RET;************************************************************** * ;延时5MS子程序;LCD初始化使用;************************************************************** * DELAY5MS:MOV R1,#10DL6: MOV R2,#249DL7: DJNZ R2,DL7DJNZ R1,DL6RET;************************************************************** * ;延时1MS子程序;************************************************************** * DELAY1MS:MOV R6,#14H ;20DL8: MOV R7,#19H ;25DL9: DJNZ R7,DL9DJNZ R6,DL8RET;************************************************************** * CHAR1:DB "Welcome to Cras-"CHAR2:DB " yBoye WorkGroup"CHAR3:DB " QQ: 15910380 "CHAR4:DB "TEL: 139********";************************************************************** *END12864汇编程序X EQU 26H ;LCD 地址变量RS EQU P2.0RW EQU P2.1EN EQU P2.2PSB EQU P2.3RST EQU P2.5ORG 0000HJMP MAINORG 0003H ;外部中断INT0入口地址MAIN:MOV SP,#40HMOV A,#00HMOV R0,#20HLOOP0: MOV @R0,A ;20H-26H清零INC R0CJNE R0,#27H,LOOP0MOV IE,#81H ;允许总中断中断,使能INT0 外部中断MOV TCON,#01H ;触发方式为脉冲负边沿触发SETB RSTNOPSETB PSB ;8位数据,并口CALL SET_LCD ;初始化TS12864mCALL MENU1CALL MENU2CALL MENU3CALL MENU4LOOP1:MOV A,22HCJNE A,#40H,LOOP2LOOP2: CJNE A,#04H,LOOP3LOOP3: JMP LOOP1;====================================== =======; LCD 初始化设置;====================================== =======-SET_LCD:CLR ENMOV A,#34H ;34H--扩充指令操作CALL WCOMMOV A,#30H ;30H--基本指令操作CALL WCOMMOV A,#0CH ;开显示,关光标,CALL WCOMMOV A,#01H ;清除LCM 显示屏CALL WCOMRET;====================================== ============= ;在LCM 各行显示信息字符;====================================== ============= LCD_SHOW:CJNE A,#1,LINE2 ;判断是否为第一行LINE1: MOV A,#80H ;设置LCD 的第一行地址CALL WCOM ;写入命令CALL CLR_LINE ;清除该行字符数据MOV A,#80H ;设置LCD 的第一行地址CALL WCOM ;写入命令JMP FILLLINE2: CJNE A,#2,LINE3 ;判断是否为第三行MOV A,#090H ;设置LCD 的第三行地址CALL WCOM ;写入命令CALL CLR_LINE ;清除该行字符数据MOV A,#090H ;设置LCD 的第三行地址CALL WCOMJMP FILLLINE3: CJNE A,#3,LINE4 ;判断是否为第三行MOV A,#088H ;设置LCD 的第三行地址CALL WCOM ;写入命令CALL CLR_LINE ;清除该行字符数据MOV A,#088H ;设置LCD 的第三行地址CALL WCOMJMP FILLLINE4: CJNE A,#4,LINE5 ;判断是否为第三行MOV A,#098H ;设置LCD 的第三行地址CALL WCOM ;写入命令CALL CLR_LINE ;清除该行字符数据MOV A,#098H ;设置LCD 的第三行地址CALL WCOMFILL: CLR A ;填入字符MOVC A,@A+DPTR ;由消息区取出字符CJNE A,#0,LC1 ;判断是否为结束码LINE5: RETLC1: CALL WDA TA ;写入数据INC DPTR ;指针加1JMP FILL ;继续填入字符RET;====================================== =========== ;清除该行LCM 的字符;====================================== =========== CLR_LINE:MOV R0,#16CL1: MOV A,#' 'CALL WDATADJNZ R0,CL1RET;====================================== ============ ;LCM 显示工作菜单信息;====================================== ============ MENU1:MOV DPTR,#MENU1AMOV A,#1 ;在第一行显示信息CALL LCD_SHOWRETMENU1A: DB "MUC 控制GPRS模块",0MENU2:MOV DPTR,#MENU2AMOV A,#2 ;在第二行显示信息CALL LCD_SHOWRETMENU2A: DB "TEL:139********",0MENU3:MOV DPTR,#MENU3AMOV A,#3 ;在第三行显示信息CALL LCD_SHOWRETMENU3A: DB "方案设计: 龚伟",0MENU4:MOV DPTR,#MENU4AMOV A,#4 ;在第四行显示信息CALL LCD_SHOWRETMENU4A: DB "程序编写: 靳鹏",0;====================================== ======== ; 写指令使能子程序;RS=L,RW=L,D0-D7=指令码,E=高脉冲;====================================== ======== WCOM:MOV P0,ACLR RSCLR RWSETB ENCALL DELAY0CLR ENRET;====================================== ======= ;写数据使能子程序;RS=H,RW=L,D0-D7=数据,E=高脉冲;=============================================WDATA:MOV P0,ASETB RSCLR RWSETB ENCALL DELAY0CLR ENRETDELAY0: MOV R7,#250 ;延时500微秒DJNZ R7,$RET END。
LCD汇编程序示例(lm016l)
;----------逐字依次输入方式-----------COM EQU 20H ; 指令寄存器DAT EQU 21H ; 数据寄存器CW_Add EQU 8000H ; 指令口写地址CR_Add EQU 8200H ; 指令口读地址DW_Add EQU 8100H ; 数据口写地址DR_Add EQU 8300H ; 数据口读地址ORG 0000HMAIN:MOV SP,#60HMOV A,#30H ;功能指令设置MOV DPTR,#CW_AddMOV R2,#03HL1:MOVX @DPTR,ALCALL DELAYDJNZ R2,L1MOV COM,#38H ;设置工作方式LCALL PR1MOV COM,#01H ;清屏LCALL PR1MOV COM,#06H ;设置输入方式LCALL PR1MOV COM,#0FH ;设置显示方式LCALL PR1MOV COM,#80H ;设置DDRAM地址00HLCALL PR1MOV DPTR,#TABMOV R2,#12 ;显示前8位MOV R3,#00WRIN: MOV A,R3MOVC A,@A+DPTRMOV DAT,ALCALL PR2LCALL DELAYINC R3DJNZ R2,WRINSJMP $;-------写指令代码子程序---------PR1: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR11: MOVX A,@DPTRJB ACC.7,PR11MOV A,COMMOV DPTR,#CW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRET;--------写显示数据子程序----------PR2: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR21:MOVX A,@DPTRJB ACC.7,PR21MOV A,DATMOV DPTR,#DW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRETDELAY:MOV R6,#00HMOV R7,#00HDELAY1:NOPDJNZ R7,DELAY1DJNZ R6,DELAY1RETTAB: DB 43H,75H,72H,73H,6FH,72H,20H ;Cursor DB 57H,72H,69H,74H,65H ;writeEND;----------逐字依次输入,两行显示方式-----------COM EQU 20H ; 指令寄存器DAT EQU 21H ; 数据寄存器CW_Add EQU 8000H ; 指令口写地址CR_Add EQU 8200H ; 指令口读地址DW_Add EQU 8100H ; 数据口写地址DR_Add EQU 8300H ; 数据口读地址ORG 0000HMAIN:MOV SP,#60HMOV A,#30H ;功能指令设置MOV DPTR,#CW_ADDMOV R2,#03HL1:MOVX @DPTR,ALCALL DELAYDJNZ R2,L1MOV COM,#38H ;设置工作方式LCALL PR1MOV COM,#06H ;设置显示方式LCALL PR1MOV COM,#0fH ;清屏LCALL PR1MOV COM,#01H ;设置输入方式LCALL PR1MOV COM,#80H ;设置DDRAM地址00HLCALL PR1MOV DPTR,#TABMOV R2,#07 ;显示前8位MOV R3,#00HWRIN: MOV A,R3MOVC A,@A+DPTRMOV DA T,ALCALL PR2LCALL DELAYINC R3DJNZ R2,WRINMOV COM,#0C0H ;设置DDRAM地址40HLCALL PR1MOV R2,#05H ;显示后4位WRIN1: MOV A,R3MOVC A,@A+DPTRMOV DAT,ALCALL PR2LCALL DELAYINC R3DJNZ R2,WRIN1SJMP MAIN;-------写指令代码子程序---------PR1: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR11: MOVX A,@DPTRJB ACC.7,PR11MOV A,COMMOV DPTR,#CW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRET;--------写显示数据子程序----------PR2: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR21:MOVX A,@DPTRJB ACC.7,PR21MOV A,DATMOV DPTR,#DW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRETDELAY:MOV R6,#00HMOV R7,#00HDELAY1:NOPDJNZ R7,DELAY1DJNZ R6,DELAY1RETTAB: DB 43H,75H,72H,73H,6FH,72H,20H ;Cursor DB 57H,72H,69H,74H,65H ;writeEND;----------光标左移输入,两行显示方式-----------COM EQU 20HDAT EQU 21HCW_ADD EQU 8000HCR_ADD EQU 8200HDW_ADD EQU 8100HDR_ADD EQU 8300HORG 0000HMAIN:MOV SP,#60HMOV A,#30H ;功能指令设置MOV DPTR,#CW_ADDMOV R2,#03HL1:MOVX @DPTR,ALCALL DELAYDJNZ R2,L1MOV COM,#38H ;设置工作方式LCALL PR1MOV COM,#01H ;清屏LCALL PR1MOV COM,#06H ;设置输入方式LCALL PR1MOV COM,#0FH ;设置显示方式LCALL PR1MOV COM,#04H ;设置输入方式,减方式LCALL PR1MOV COM,#0C5H ;设置DDRAM地址44HLCALL PR1MOV DPTR,#TABMOV R2,#05 ;显示后5位MOV R3,#11 ;从第12位开始显示WRIN: MOV A,R3MOVC A,@A+DPTRMOV DAT,ALCALL PR2LCALL DELAYDEC R3DJNZ R2,WRINMOV COM,#87H ;设置DDRAM地址07HLCALL PR1MOV R2,#08H ;显示前8位WRIN1: MOV A,R3MOVC A,@A+DPTRMOV DAT,ALCALL PR2LCALL DELAYDEC R3DJNZ R2,WRIN1SJMP $;-------写指令代码子程序---------PR1: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR11: MOVX A,@DPTRJB ACC.7,PR11MOV A,COMMOV DPTR,#CW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRET;--------写显示数据子程序----------PR2: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR21:MOVX A,@DPTRJB ACC.7,PR21MOV A,DATMOV DPTR,#DW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRETDELAY:MOV R6,#00HMOV R7,#00HDELAY1:NOPDJNZ R7,DELAY1DJNZ R6,DELAY1RETTAB: DB 43H,75H,72H,73H,6FH,72H,20H ;Cursor DB 57H,72H,69H,74H,65H ;writeEND;----------左滚动输入方式-----------COM EQU 20H ; 指令寄存器DAT EQU 21H ; 数据寄存器CW_Add EQU 8000H ; 指令口写地址CR_Add EQU 8200H ; 指令口读地址DW_Add EQU 8100H ; 数据口写地址DR_Add EQU 8300H ; 数据口读地址ORG 0000HMAIN:MOV SP,#60HMOV A,#30H ;功能指令设置MOV DPTR,#CW_ADDMOV R2,#03HL1:MOVX @DPTR,ALCALL DELAYDJNZ R2,L1MOV COM,#38H ;设置工作方式LCALL PR1MOV COM,#01H ;清屏LCALL PR1MOV COM,#06H ;设置输入方式LCALL PR1MOV COM,#0EH ;设置显示方式LCALL PR1MOV COM,#07H ;设置输入方式,画面滚动LCALL PR1MOV COM,#8cH ;设置DDRAM地址07HLCALL PR1MOV DPTR,#TABMOV R2,#012 ;显示前7位MOV R3,#00WRIN: MOV A,R3MOVC A,@A+DPTRMOV DAT,ALCALL PR2LCALL DELAYINC R3DJNZ R2,WRINSJMP $;-------写指令代码子程序---------PR1: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR11: MOVX A,@DPTRJB ACC.7,PR11MOV A,COMMOV DPTR,#CW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRET;--------写显示数据子程序----------PR2: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR21:MOVX A,@DPTRJB ACC.7,PR21MOV A,DATMOV DPTR,#DW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRETDELAY:MOV R6,#00HMOV R7,#00HDELAY1:NOPDJNZ R7,DELAY1DJNZ R6,DELAY1RETTAB: DB 43H,75H,72H,73H,6FH,72H,20H ;CursorDB 57H,72H,69H,74H,65H ;writeEND;----------自定义字符库方式-----------COM EQU 20HDAT EQU 21HCW_ADD EQU 8000HCR_ADD EQU 8200HDW_ADD EQU 8100HDR_ADD EQU 8300HORG 0000HMAIN:MOV SP,#60HMOV A,#30H ;功能指令设置MOV DPTR,#CW_ADDMOV R2,#03HL1:MOVX @DPTR,ALCALL DELAYDJNZ R2,L1MOV COM,#38H ;设置工作方式LCALL PR1MOV COM,#01H ;清屏LCALL PR1MOV COM,#06H ;设置输入方式LCALL PR1MOV COM,#0FH ;设置显示方式LCALL PR1LCALL CG_WRITE ;调用自定义的字库子程序MOV COM,#80H ;设置DDRAM地址LCALL PR1MOV DPTR ,#TABDY ;设置字表首地址MOV R2,#08MOV R3,#00HLOOP1:MOV A,R3MOVC A,@A+DPTRMOV DA T,ALCALL PR2INC R3DJNZ R2,LOOP1MOV COM,#0C0H ;设置DDRAM地址LCALL PR1MOV R2,#08HLOOP2:MOV A,R3MOVC A,@A+DPTRMOV DA T,ALCALL PR2INC R3DJNZ R2,LOOP2SJMP $CG_WRITE:MOV COM,#40H ;编字库LCALL PR1MOV R2,#64MOV R3,#00HMOV DPTR,#CGTAB ;设置字模数据的首地址CG1:MOV A,R3MOVC A,@A+DPTRMOV DAT,ALCALL PR2INC R3DJNZ R2,CG1RET;-------写指令代码子程序---------PR1: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR11: MOVX A,@DPTRJB ACC.7,PR11MOV A,COMMOV DPTR,#CW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRET;--------写显示数据子程序----------PR2: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR21:MOVX A,@DPTRJB ACC.7,PR21MOV A,DATMOV DPTR,#DW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRETDELAY:MOV R6,#00HMOV R7,#00HDELAY1:NOPDJNZ R7,DELAY1DJNZ R6,DELAY1RETCGTAB:DB 08H,0FH,12H,0FH,0AH,1FH,02H,02H ;"年"代码=00H DB 0FH,09H,0FH,09H,0FH,09H,11H,00H ;"月"代码=01H DB 1FH,11H,11H,1FH,11H,11H,1FH,00H ;"日"代码=02HDB 11H,0AH,04H,1FH,04H,1FH,04H,00H ;"$"代码=03HDB 0EH,00H,1FH,0AH,0AH,0AH,13H,00H ;"元"代码=04H DB 18H,18H,07H,08H,08H,08H,07H,00H ;"摄氏度"代码=05H DB 04H,0AH,15H,04H,04H,04H,04H,00H ;"↑"代码=06HDB 17H,15H,15H,15H,15H,15H,17H,00H ;"10"代码=07H TABDY:DB 57H,46H,48H,30H,36H,00H,34H,01H ;WFH06年4月DB 33H,02H,54H,3DH,32H,33H,05H,06H ;3日T=23摄氏度↑END。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
;----------逐字依次输入方式-----------COM EQU 20H ; 指令寄存器DAT EQU 21H ; 数据寄存器CW_Add EQU 8000H ; 指令口写地址CR_Add EQU 8200H ; 指令口读地址DW_Add EQU 8100H ; 数据口写地址DR_Add EQU 8300H ; 数据口读地址 ORG 0000HMAIN:MOV SP,#60HMOV A,#30H ;功能指令设置 MOV DPTR,#CW_AddMOV R2,#03HL1:MOVX @DPTR,ALCALL DELAYDJNZ R2,L1MOV COM,#38H ;设置工作方式LCALL PR1MOV COM,#01H ;清屏LCALL PR1MOV COM,#06H ;设置输入方式LCALL PR1MOV COM,#0FH ;设置显示方式LCALL PR1MOV COM,#80H ;设置DDRAM地址00H LCALL PR1MOV DPTR,#TABMOV R2,#12 ;显示前8位MOV R3,#00WRIN: MOV A,R3MOVC A,@A+DPTRMOV DAT,ALCALL PR2LCALL DELAYINC R3DJNZ R2,WRINSJMP $;-------写指令代码子程序---------PR1: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR11: MOVX A,@DPTRJB ,PR11MOV A,COMMOV DPTR,#CW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRET;--------写显示数据子程序----------PR2: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR21:MOVX A,@DPTRJB ,PR21MOV A,DATMOV DPTR,#DW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRETDELAY:MOV R6,#00HMOV R7,#00HDELAY1:NOPDJNZ R7,DELAY1DJNZ R6,DELAY1RETTAB: DB 43H,75H,72H,73H,6FH,72H,20H ;Cursor DB 57H,72H,69H,74H,65H ;writeEND;----------逐字依次输入,两行显示方式----------- COM EQU 20H ; 指令寄存器DAT EQU 21H ; 数据寄存器CW_Add EQU 8000H ; 指令口写地址CR_Add EQU 8200H ; 指令口读地址DW_Add EQU 8100H ; 数据口写地址DR_Add EQU 8300H ; 数据口读地址ORG 0000HMAIN:MOV SP,#60HMOV A,#30H ;功能指令设置MOV DPTR,#CW_ADDMOV R2,#03HL1:MOVX @DPTR,ALCALL DELAYDJNZ R2,L1MOV COM,#38H ;设置工作方式LCALL PR1MOV COM,#06H ;设置显示方式LCALL PR1MOV COM,#0fH ;清屏LCALL PR1MOV COM,#01H ;设置输入方式LCALL PR1MOV COM,#80H ;设置DDRAM地址00H LCALL PR1MOV DPTR,#TABMOV R2,#07 ;显示前8位MOV R3,#00HWRIN: MOV A,R3MOVC A,@A+DPTRMOV DAT,ALCALL PR2LCALL DELAYINC R3DJNZ R2,WRINMOV COM,#0C0H ;设置DDRAM地址40H LCALL PR1MOV R2,#05H ;显示后4位WRIN1: MOV A,R3MOVC A,@A+DPTRMOV DAT,ALCALL PR2LCALL DELAYINC R3DJNZ R2,WRIN1SJMP MAIN;-------写指令代码子程序---------PR1: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR11: MOVX A,@DPTRJB ,PR11MOV A,COMMOV DPTR,#CW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRET;--------写显示数据子程序----------PR2: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR21:MOVX A,@DPTRJB ,PR21MOV A,DATMOV DPTR,#DW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRETDELAY:MOV R6,#00HMOV R7,#00HDELAY1:NOPDJNZ R7,DELAY1DJNZ R6,DELAY1RETTAB: DB 43H,75H,72H,73H,6FH,72H,20H ;Cursor DB 57H,72H,69H,74H,65H ;writeEND;----------光标左移输入,两行显示方式----------- COM EQU 20HDAT EQU 21HCW_ADD EQU 8000HCR_ADD EQU 8200HDW_ADD EQU 8100HDR_ADD EQU 8300HORG 0000HMAIN:MOV SP,#60HMOV A,#30H ;功能指令设置MOV DPTR,#CW_ADDMOV R2,#03HL1:MOVX @DPTR,ALCALL DELAYDJNZ R2,L1MOV COM,#38H ;设置工作方式LCALL PR1MOV COM,#01H ;清屏LCALL PR1MOV COM,#06H ;设置输入方式LCALL PR1MOV COM,#0FH ;设置显示方式LCALL PR1MOV COM,#04H ;设置输入方式,减方式 LCALL PR1MOV COM,#0C5H ;设置DDRAM地址44HLCALL PR1MOV DPTR,#TABMOV R2,#05 ;显示后5位MOV R3,#11 ;从第12位开始显示WRIN: MOV A,R3MOVC A,@A+DPTRMOV DAT,ALCALL PR2LCALL DELAYDEC R3DJNZ R2,WRINMOV COM,#87H ;设置DDRAM地址07H LCALL PR1MOV R2,#08H ;显示前8位WRIN1: MOV A,R3MOVC A,@A+DPTRMOV DAT,ALCALL PR2LCALL DELAYDEC R3DJNZ R2,WRIN1SJMP $;-------写指令代码子程序---------PR1: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR11: MOVX A,@DPTRJB ,PR11MOV A,COMMOV DPTR,#CW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRET;--------写显示数据子程序----------PR2: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR21:MOVX A,@DPTRJB ,PR21MOV A,DATMOV DPTR,#DW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRETDELAY:MOV R6,#00HMOV R7,#00HDELAY1:NOPDJNZ R7,DELAY1DJNZ R6,DELAY1RETTAB: DB 43H,75H,72H,73H,6FH,72H,20H ;Cursor DB 57H,72H,69H,74H,65H ;write END;----------左滚动输入方式-----------COM EQU 20H ; 指令寄存器DAT EQU 21H ; 数据寄存器CW_Add EQU 8000H ; 指令口写地址CR_Add EQU 8200H ; 指令口读地址DW_Add EQU 8100H ; 数据口写地址DR_Add EQU 8300H ; 数据口读地址 ORG 0000HMAIN:MOV SP,#60HMOV A,#30H ;功能指令设置MOV DPTR,#CW_ADDMOV R2,#03HL1:MOVX @DPTR,ALCALL DELAYDJNZ R2,L1MOV COM,#38H ;设置工作方式LCALL PR1MOV COM,#01H ;清屏LCALL PR1MOV COM,#06H ;设置输入方式LCALL PR1MOV COM,#0EH ;设置显示方式LCALL PR1MOV COM,#07H ;设置输入方式,画面滚动 LCALL PR1MOV COM,#8cH ;设置DDRAM地址07HLCALL PR1MOV DPTR,#TABMOV R2,#012 ;显示前7位MOV R3,#00WRIN: MOV A,R3MOVC A,@A+DPTRMOV DAT,ALCALL PR2LCALL DELAYINC R3DJNZ R2,WRINSJMP $;-------写指令代码子程序---------PR1: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR11: MOVX A,@DPTRJB ,PR11MOV A,COMMOV DPTR,#CW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRET;--------写显示数据子程序----------PR2: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR21:MOVX A,@DPTRJB ,PR21MOV A,DATMOV DPTR,#DW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRETDELAY:MOV R6,#00HMOV R7,#00HDELAY1:NOPDJNZ R7,DELAY1DJNZ R6,DELAY1RETTAB: DB 43H,75H,72H,73H,6FH,72H,20H ;CursorDB 57H,72H,69H,74H,65H ;writeEND;----------自定义字符库方式-----------COM EQU 20HDAT EQU 21HCW_ADD EQU 8000HCR_ADD EQU 8200HDW_ADD EQU 8100HDR_ADD EQU 8300HORG 0000HMAIN:MOV SP,#60HMOV A,#30H ;功能指令设置MOV DPTR,#CW_ADDMOV R2,#03HL1:MOVX @DPTR,ALCALL DELAYDJNZ R2,L1MOV COM,#38H ;设置工作方式LCALL PR1MOV COM,#01H ;清屏LCALL PR1MOV COM,#06H ;设置输入方式LCALL PR1MOV COM,#0FH ;设置显示方式LCALL PR1LCALL CG_WRITE ;调用自定义的字库子程序 MOV COM,#80H ;设置DDRAM地址LCALL PR1MOV DPTR ,#TABDY ;设置字表首地址MOV R2,#08MOV R3,#00HLOOP1:MOV A,R3MOVC A,@A+DPTRMOV DAT,ALCALL PR2INC R3DJNZ R2,LOOP1MOV COM,#0C0H ;设置DDRAM地址LCALL PR1MOV R2,#08HLOOP2:MOV A,R3MOVC A,@A+DPTRMOV DAT,ALCALL PR2INC R3DJNZ R2,LOOP2SJMP $CG_WRITE:MOV COM,#40H ;编字库LCALL PR1MOV R2,#64MOV R3,#00HMOV DPTR,#CGTAB ;设置字模数据的首地址 CG1:MOV A,R3MOVC A,@A+DPTRMOV DAT,ALCALL PR2INC R3DJNZ R2,CG1RET;-------写指令代码子程序---------PR1: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR11: MOVX A,@DPTRJB ,PR11MOV A,COMMOV DPTR,#CW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRET;--------写显示数据子程序----------PR2: PUSH DPHPUSH DPLPUSH ACCMOV DPTR,#CR_ADDPR21:MOVX A,@DPTRJB ,PR21MOV A,DATMOV DPTR,#DW_ADDMOVX @DPTR,APOP ACCPOP DPLPOP DPHRETDELAY:MOV R6,#00HMOV R7,#00HDELAY1:NOPDJNZ R7,DELAY1DJNZ R6,DELAY1RETCGTAB:DB 08H,0FH,12H,0FH,0AH,1FH,02H,02H ;"年"代码=00HDB 0FH,09H,0FH,09H,0FH,09H,11H,00H ;"月"代码=01H DB 1FH,11H,11H,1FH,11H,11H,1FH,00H ;"日"代码=02HDB 11H,0AH,04H,1FH,04H,1FH,04H,00H ;"$"代码=03HDB 0EH,00H,1FH,0AH,0AH,0AH,13H,00H ;"元"代码=04HDB 18H,18H,07H,08H,08H,08H,07H,00H ;"摄氏度"代码=05H DB 04H,0AH,15H,04H,04H,04H,04H,00H ;"↑"代码=06HDB 17H,15H,15H,15H,15H,15H,17H,00H ;"10"代码=07HTABDY:DB 57H,46H,48H,30H,36H,00H,34H,01H ;WFH06年4月DB 33H,02H,54H,3DH,32H,33H,05H,06H ;3日T=23摄氏度↑ END。