资源描述:
《单片机lcd1602显示字符和数字的汇编程序》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、单片机LCD1602显示字符和数字的汇编程序(无聊原创)1,单片机和LCD1602的连线,和程序结果显示如下图:2,LCD第一行显示字符XIAORENGUANG第二行显示RAM中40H到46H中的数字。程序如下:ORG0000HAJMPMAINRSEQUP2.4RWEQUP2.5EEQUP2.6MAIN:MOVSP,#60HMOV40H,#01HMOV41H,#02HMOV42H,#03HMOV43H,#04HMOV44H,#05HMOV45H,#06HMOV46H,#07HACALLDD1;DD1是LCD初始化MOVDPTR,#TA
2、BLE1ACALLDD2;DD2是LCD第一行显示TABLE1ACALLPPP;PPP是LCD第二行显示RAM中40H到46H中的数据SJMP$DD1:MOVp0,#01H;清屏CALLENABLEMOVp0,#38H;显示功能CALLENABLEMOVp0,#0FH;显示开关控制CALLENABLEMOVp0,#06H;+1CALLENABLERETDD2:MOVp0,#80H;第一行的开始位置cALLENABLECALLWRITE1;到TABLE1取码?RETDD3:MOVp0,#0C0H;第二行的位置CALLENABLECALL
3、WRITE1;到TABLE2取码RETENABLE:CLRRS;送命令CLRRWCLRECALLDELAYSETBERETWRITE1:MOVR1,#00H;显示table中的值A1:MOVA,R1;到table取码MOVCA,@A+DPTRcallwRITE2;显示到lcdINCR1CJNEA,#00H,A1;是否到00hRETWRITE2:MOVp0,A;显示SETBRSCLRRWCLRECALLDELAYSETBERETDELAY:PUSHACCMOVA,R4MOVR4,#05D1:MOVR5,#0FFHDJNZR5,$DJNZ
4、R4,D1MOVR4,APOPACCRETPPP:MOVp0,#0C0H;第二行的位置CALLENABLEMOVDPTR,#TAB;显示CALLWRITE3;到TABLE2取码RETWRITE3:MOVR1,#40H;显示table中的值MOVR7,#07HA2:MOVA,@R1;到table取码MOVCA,@A+DPTRcallwRITE2;显示到lcdINCR1DJNZR7,A2;是否到00hRETtable1:db"XIAORENGUANG",00HTAB:DB30H,31H,32H,33HDB34H,35H,36H,37HDB
5、38H,39HEND