电路设计,软件开发,专业项目团队承接电子产品开发!


ISPRO下载型编程器
火爆销售中

RS232/TTL转换器
全IC串口窃电

RS232/TTL转换线
全IC串口窃电

ByteBlasterMV Cable
CPLD/FPGA并口下载线

ByteBlaster II Cable ISPRO下载型编程器
支持S51/AVR/PIC
超级51开发板套件
前卫实用超值

PC/MCU/CPLD
三合一学习套件

全新万年历方案
AVR单片机开发板
 

Min51单片机仿真机
迷你型

ARM7开发板
仅售260元!
 

RS-232/RS-485双向接口电平转换器  

51单片机升级STM32
火爆销售中
MPLAB-ICD2
火爆销售中
LED51开发板
玩具又名图文显示棒

面板模块/开发板
经济危机明智决择

       

GSM MODEM GSM猫

SMS短信模块 工业级/全自动
火爆销售中

大功率数传电台

高速数传电台

您当前位置:电子技术资料 -> 外围驱动 -> LCD液晶显示 ->

祝您阅读愉快!

ISPRO下载型编程器

RS232 TO TTL转换器
↑↑本文相关产品介绍↑↑

KS0108_12864LCD-F149 msp430x14x汇编代码


类别:技术文章
来源:未知
作者:未知
关键字:KS0108
加入日期:2010-8-4

KS0108_12864LCD-F149 msp430x14x汇编代码
;中国电子网www.EC66.com
#include <msp430x14x.h>;
#include <msp430ftext.h>;
;--------------------------------------
;FU WEI P4.2
;CS2 EQU P4.3
;CS1 EQU P4.4
;E EQU P4.5
;R/W EQU P4.6
;RS EQU P4.7
;DAT EQU 0210H
;COM EQU 0212H
;COLUM EQU 0214H
;PAG EQU 0216H
;COD EQU 0218H
;COUNT EQU 021AH

;------------------------------------------------------------------------------
main ORG 1600h ; Program Start
;------------------------------------------------------------------------------
RESET mov.W #0900h,SP; ;Initialize stackpointer
StopWDT mov.W #WDTPW+WDTHOLD,&WDTCTL; ;Stop watchdog
call #init_xt2; ;初始化xt2,XT2=mclk=smclk
nop
MOV.B #0H,DAT;
MOV.B #0H,COM;
MOV.B #0H,COLUM;
MOV.B #0H,PAG;
MOV.B #0H,COD;
MOV.B #0H,COUNT;
MOV.B #0FFH,&P5OUT;
MOV.B #0FFH,&P5DIR; ;MOV P5,#0FFH
NOP
NOP
BIC.B #04H,&P4OUT;
MOV.B #04H,&P4DIR;
CALL #DELAY;
NOP
BIS.B #04H,&P4OUT;
CALL #YANS;
NOP
NOP
MOV.B #0C0H,COM; ;0C0H设置显示起始行
CALL #INT;
NOP
NOP
MOV.B #00H,DAT;
CALL #XIANF;
NOP
HXIAN NOP
CALL #HANZIX;
;CALL #ZIFUXIE
NOP
NOP
NOP
JMP HXIAN;
NOP
NOP
;--------------------------------------------
;ZI FU XIE
;--------------------------------------------
ZIFUXIE NOP
PUSH R4;
PUSH R5;
PUSH R6;
PUSH R7;
NOP
MOV.B #02H,PAG;
MOV.B #28H,COLUM;
MOV.B #00H,COD;
MOV.B #00H,R7;
MOV #00H,R4; ;字符个数 R4
ZLOOP MOV.B #02H,PAG;
MOV.B TAB1(R4),COD;
INC.B R4;
;MOV.B R5,COD;
CALL #CW_PR;
INC.B R7; ;字符个数 R7同R4
ADD.B #08H,COLUM;
CMP #04H,R7; ;11H 字符个数
JNE ZLOOP;
NOP
POP R7;
POP R6;

POP R5;
POP R4;
NOP
RET
;--------------------------------------------------------------------------------
HANZIX ;汉字显示
;--------------------------------------------------------------------------------

NOP
PUSH R4;
PUSH R7;
;MOV.B #00H,PAG;
MOV.B #16H,COLUM;
MOV.B #00H,COD;
MOV.B #00H,R7
MOV #00H,R4; ;字符个数 R4
ZLOOH MOV.B #02H,PAG;
;MOV.B #18H,COLUM;
MOV.B TABH(R4),COD
INC.B R4
CALL #CCW_PR;
INC.B R7; ;字符个数 R7同R4
ADD.B #08H,COLUM;
CMP #04H,R7; ;11H 字符个数
JNE ZLOOH;
NOP
POP R7;
POP R4;
MOV.B #0C1H,R11
LLO MOV.B R11,COM; ;0C0H设置显示起始行
CALL #INT;
NOP
NOP
NOP
NOP
CALL #DELAYY
NOP
NOP
CALL #DELAYY
NOP
NOP
CALL #DELAYY
NOP
NOP
NOP
CALL #DELAYY
NOP
NOP
CALL #DELAYY
NOP
NOP
CALL #DELAYY
INC.B R11
JMP LLO
NOP
NOP
RET
NOP

;-----------------------------------
;主程序 中文字符显示
;*-----------------------------------

CCW_PR PUSH R4;
PUSH R5;
PUSH R6;
PUSH R7;
MOV.B COD,R5; ;
MOV R5,&MPY; ;MOV COD,&MPY
MOV #20H,&OP2;
NOP
NOP
NOP
MOV &RESLO,TEMP1;
MOV.B #00H,R7;
ADD TEMP1,R7
CCW_1 MOV.B #10H,COUNT; XUN HUAN CI SHU
MOV.B PAG,TEMP2;
BIC.B #0F8H,PAG; ;
BIS.B #0B8H,PAG; ;ANL PAG
MOV.B PAG,COM;
CALL #PRM0;
NOP
CALL #PRR0;
NOP
;CLRC
MOV.B COLUM,R6; ;判断区域
SUB.B #40H,R6; ;
JL CCW_21; ;XIAO YU SHI TIAO ZHUAN
BIS.B #20H,PAG; ;设置区域
BIC.B #10H,PAG;
JMP CCW_3; ;YOU
NOP
CCW_21 BIS.B #10H,PAG; ;设置区域标志
CCW_3 MOV.B COLUM,COM; ;10h zhong
BIS.B #40H,COM; ;列地址设置
BIC.B #0EFH,PAG; ;ANL A,#30H
CMP.B #10H,PAG; ;判断区域标志
JNE CCW_31;
CALL #PRM0;
NOP
;MOV.B #00H,R7;
;ADD TEMP1,R7;
JMP CCW_4;
NOP ;
CCW_31 CALL #PRR0; ;WRITE ADDRESS
NOP
CCW_4 NOP
CCW_42 MOV.B CCTAB(R7),DAT;
INC.B R7;
BIC.B #0EFH,PAG;
CMP.B #10H,PAG;
JNE CCW_41;
CALL #PRM1;
NOP

JMP CCW_5;
NOP
CCW_41 CALL #PRR1;
NOP
CCW_5 INC.B COLUM; ;
CMP.B #40H,COLUM; ;
JL CCW_9; ;
;MOV.B #40H,COLUM; ;MIDDLE ZE ZHUAN YOU ;
;RLC.B PAG ;
;RLC.B PAG ;
;RLC.B PAG ;
;JC CCW_9 ;
BIS.B #20H,PAG; ;
BIC.B #10H,PAG; ;ADD 1 CHU LI
MOV.B COLUM,COM; ;10h zhong
BIS.B #40H,COM; ;
;MOV.B #40H,COM
CALL #PRR0;
NOP
CCW_9 DEC.B COUNT; ;当页循环
CMP.B #00H,COUNT;
JNE CCW_42;
NOP
;MOV.B #00H,R7
MOV.B TEMP2,PAG;
RLC.B PAG;
JC CCW_99;
MOV.B TEMP2,PAG;
INC.B PAG;
BIS.B #80H,PAG;
BIC.B #30H,PAG;
SUB.B #10H,COLUM;

JMP CCW_1;
NOP
NOP
CCW_99 NOP
POP R7;
POP R6;
POP R5;
POP R4;
NOP
RET
NOP

;******------------------------------
;主程序 西文字符显示
;*-----------------------------------
CW_PR PUSH R4
PUSH R5
PUSH R6
PUSH R7
PUSH R8
PUSH R9
PUSH R10
MOV.B COD,R6
MOV R6,&MPY
MOV #8,&OP2
NOP
NOP
MOV &RESLO,R5
MOV R5,TEMP3
MOV.B #08H,COUNT
MOV.B #00H,COD
BIC.B #0F8H,PAG
BIS.B #0B8H,PAG
MOV.B PAG,COM
CALL #PRM0
NOP
CALL #PRR0
NOP
;CLRC
MOV.B COLUM,R8 ;
SUB.B #40H,R8 ;
JL CW_21 ;
BIS.B #20H,PAG ;
JMP CW_3 ;设标志
NOP
CW_21 BIS.B #10H,PAG
CW_3 MOV.B COLUM,COM
BIS.B #40H,COM
BIC.B #0EFH,PAG
CMP.B #10H,PAG
JNE CW_31
NOP
CALL #PRM0 ;
NOP ;
JMP CW_4 ;
NOP ;
CW_31 CALL #PRR0 ;XIE LIE ADDRESS
NOP
CW_4 MOV TEMP3,R9
CW_42 MOV.B CTAB(R9),DAT
INC.B R9
BIC.B #0EFH,PAG
CMP.B #10H,PAG
JNE CW_41
CALL #PRM1
NOP
JMP CW_5
NOP
CW_41 CALL #PRR1
NOP
CW_5 INC.B COLUM
CMP.B #40H,COLUM
JL CW_9
;MOV.B #40H,COLUM
;RLC PAG
;RLC PAG
;RLC PAG
;JC CW_9
BIS.B #20H,PAG
BIC.B #10H,PAG
MOV.B COLUM,COM
BIS.B #40H,COM
CALL #PRR0
CW_9 DEC.B COUNT
CMP.B #00H,COUNT
JNE CW_42
POP R10
POP R9
POP R8
POP R7

POP R6

POP R5
POP R4
RET
NOP

;-----------------------------------
DELAY
push r5 ;3/4
mov.B #02h,r5 ;2
yans1 dec.B r5 ;2
jnz yans1 ;2
pop r5 ;3/4
ret ;5
NOP

;-----------------------------------
YANS
nop
nop
nop
ret ;5
NOP
;-----------------------------------
DELAYY push r5 ;3/4
mov #0FFFFh,r5 ;2
yans2 dec r5 ;2
jnz yans2 ;2
pop r5 ;3/4
ret ;5
NOP
;------------------------------------------------------------------------------
init_xt2; 初始化XT2
;------------------------------------------------------------------------------
bic.b #XT2OFF,&BCSCTL1 ; 启动XT2
SetupOsc2 bic.b #OFIFG,&IFG1 ; Clear OSC fault flag
mov.B #0FFh,R15 ; R15 = Delay
SetupOsc3 dec.B R15 ; Additional delay to ensure start
jnz SetupOsc3
bit.b #OFIFG,&IFG1 ; OSC fault flag set?
jnz SetupOsc2 ; OSC Fault, clear flag again
bis.b #SELM1+SELS,&BCSCTL2 ; 确认XT2启动完毕后,MCLK=SMCLK=XT2
ret
nop
;*--------------------------------
;初始化子程序
;*--------------------------------
INT BIC.B #20H,&P4OUT;
NOP;
NOP;
;MOV.B #0C0H,COM; ;0C0H设置显示起始行
NOP
CALL #PRM0;
NOP;
NOP;
CALL #PRR0;
MOV.B #03FH,COM; ;开显示设置
nop;
CALL #PRM0;
NOP;
NOP;
CALL #PRR0;
nop
nop
RET
NOP
NOP
;*-----------------------------------
;清屏子程序(清显示RAM)
;*-----------------------------------
XIANF PUSH R4;
PUSH R6;
PUSH R7;
MOV.B #00H,R4;
MOV.B #00H,R6;
nop
XIANF11 MOV.B R6,R4;
BIS.B #0B8H,R4;
MOV.B R4,COM;
NOP ;
NOP ;
CALL #PRM0;
NOP ;
NOP ;
CALL #PRR0;
MOV.B #40H,COM;
NOP ;
NOP ;
CALL #PRM0;
NOP ;
NOP ;
CALL #PRR0 ;
MOV.B #40H,R7;
XIANF12 ;MOV.B #0AAH,DAT;
CALL #PRM1 ;
NOP ;
NOP ;
CALL #PRR1 ;
DEC.B R7 ;
CMP.B #00H,R7 ;
JNE XIANF12 ;
INC.B R6 ;
NOP ;
CMP #08H,R6;
JNE XIANF11;
NOP
NOP
BIS.B #08H,&P1OUT;
MOV.B #0FFH,&P1DIR;
POP R7;
POP R6;
POP R4;
RET;
NOP


;-------------------------------------------------------
;中屏 写指令代码子程序
;-------------------------------------------------------
PRM0 PUSH R5
BIS.B #0F8H,&P4DIR;
BIC.B #08H,&P4OUT; ;CS2
BIS.B #10H,&P4OUT; ;CS1
BIC.B #80H,&P4OUT; ;CLR RS
BIS.B #40H,&P4OUT;; ;SETB R/W
PRM01 NOP
NOP
MOV.B #00H,&P5DIR;
BIS.B #20H,&P4OUT; ;SETB E
NOP
NOP
MOV.B &P5IN,R5;
NOP
NOP
BIC.B #20H,&P4OUT; ;CLR E
BIT.B #80H,R5; ;JB
NOP
NOP
NOP
NOP
JNZ PRM01;
BIC.B #40H,&P4OUT; ;CLR R/W XIE
MOV.B COM,&P5OUT; ;
BIS.B #0FFH,&P5DIR;
NOP;
NOP
BIS.B #20H,&P4OUT;
NOP
NOP
BIC.B #20H,&P4OUT; ;
POP R5
RET
NOP
;---------------------------------------------------------
;写中屏显示数据子程序
;---------------------------------------------------------
PRM1 PUSH R5
BIS.B #0F8H,&P4DIR;
BIC.B #08H,&P4OUT; ;CS2
BIS.B #10H,&P4OUT;
BIC.B #80H,&P4OUT;
BIS.B #40H,&P4OUT; ;R/W
PRM11 NOP
NOP
MOV.B #00H,&P5DIR;
BIS.B #20H,&P4OUT;
NOP
NOP
MOV.B &P5IN,R5;
NOP
NOP
BIC.B #20H,&P4OUT;
BIT.B #80H,R5; ;JB
JNZ PRM11;
NOP
NOP
NOP
NOP
BIS.B #80H,&P4OUT; ;SETB RS
BIC.B #40H,&P4OUT; ;CLR R/W XIE
MOV.B DAT,&P5OUT; ;
BIS.B #0FFH,&P5DIR;
NOP
NOP
BIS.B #20H,&P4OUT;
NOP
NOP
BIC.B #20H,&P4OUT;
POP R5;
RET
NOP
;---------------------------------------------------------
;写右屏指令代码子程序
;---------------------------------------------------------
PRR0 PUSH R5
BIS.B #0F8H,&P4DIR;
BIS.B #08H,&P4OUT; ;CS2
BIC.B #10H,&P4OUT; ;CS1
BIC.B #80H,&P4OUT; ;R/S
BIS.B #40H,&P4OUT; ;R/W
PRR01 NOP
NOP
MOV.B #00H,&P5DIR;
BIS.B #20H,&P4OUT;
NOP
NOP
MOV.B &P5IN,R5;
NOP
NOP
BIC.B #20H,&P4OUT;
BIT.B #80H,R5;
JNZ PRM11;
NOP
NOP
NOP
NOP
BIC.B #40H,&P4OUT; ;CLR R/W XIE
BIS.B #20H,&P4OUT; ;SETB E
MOV.B COM,&P5OUT; ;
BIS.B #0FFH,&P5DIR; ;ADD
NOP
NOP
BIC.B #20H,&P4OUT;
POP R5;
RET
NOP
;---------------------------------------------------------
;写 右屏显示数据子程序
;---------------------------------------------------------
PRR1 PUSH R5
BIS.B #0F8H,&P4DIR;
BIS.B #08H,&P4OUT; ;CS2
BIC.B #10H,&P4OUT;
BIC.B #80H,&P4OUT;
BIS.B #40H,&P4OUT; ;R/W
PRR11 NOP
NOP
MOV.B #00H,&P5DIR;
BIS.B #20H,&P4OUT;
NOP
NOP
MOV.B &P5IN,R5;
NOP
NOP
BIC.B #20H,&P4OUT;
BIT.B #80H,R5;
JNZ PRR11;
NOP
NOP
NOP
NOP
BIS.B #80H,&P4OUT; ;SETB RS
BIC.B #40H,&P4OUT; ;CLR R/W XIE
MOV.B DAT,&P5OUT; ;
BIS.B #0FFH,&P5DIR;
NOP
NOP
BIS.B #20H,&P4OUT;
NOP
NOP
BIC.B #20H,&P4OUT;
POP R5;
RET
NOP
TAB1 DB 00H,01H,02H,03H

CTAB DB 000H,038H,07CH,044H,044H,044H,07CH,038H
;0 CHAR_30
DB 000H,038H,044H,044H,044H,044H,038H,000H

;1 CHAR_31
DB 000H,008H,008H,07CH,000H,000H,000H,000H

;2 CHAR_32
DB 000H,048H,064H,064H,064H,054H,048H,000H

;3 CHAR_33
DB 000H,028H,044H,044H,054H,054H,028H,000H

;4 CHAR_34
DB 000H,020H,030H,028H,028H,024H,07CH,020H

;5 CHAR_35
DB 000H,05CH,054H,054H,054H,054H,024H,000H

;6 CHAR_36
DB 000H,038H,054H,054H,054H,054H,020H,000H

;7 CHAR_37
DB 000H,004H,004H,044H,024H,014H,00CH,000H

;8 CHAR_38
DB 000H,028H,054H,054H,054H,054H,054H,028H

;9 CHAR_39
DB 000H,008H,054H,054H,054H,054H,038H,000H

;A CHAR_41
DB 040H,060H,018H,014H,014H,018H,070H,040H

;B CHAR_42
DB 07CH,054H,054H,054H,054H,054H,028H,000H

;C CHAR_43
DB 038H,044H,044H,044H,044H,044H,028H,000H

;D CHAR_44
DB 07CH,044H,044H,044H,044H,044H,038H,000H

;E CHAR_45
DB 000H,07CH,054H,054H,054H,054H,044H,000H

;F CHAR_46
DB 07CH,014H,014H,014H,014H,014H,004H,000H

;G CHAR_47
DB 038H,044H,044H,044H,054H,054H,078H,000H

;H CHAR_48
DB 000H,07CH,010H,010H,010H,010H,07CH,000H

;I CHAR_49
DB 000H,000H,000H,07CH,000H,000H,000H,000H

;J CHAR_4A
DB 000H,020H,040H,040H,040H,040H,03CH,000H

;K CHAR_4B
DB 000H,07CH,010H,018H,018H,024H,044H,000H

;L CHAR_4C
DB 000H,07CH,040H,040H,040H,040H,040H,000H

;M CHAR_4D
DB 07CH,008H,010H,070H,010H,008H,07CH,000H

;N CHAR_4E
DB 000H,07CH,00CH,018H,030H,060H,07CH,000H

;O CHAR_4F
DB 000H,038H,044H,044H,044H,044H,038H,000H

;P CHAR_50
DB 07CH,014H,014H,014H,014H,014H,008H,000H

;Q CHAR_51
DB 000H,038H,044H,044H,064H,044H,038H,000H

;R CHAR_52
DB 07CH,014H,014H,014H,034H,054H,008H,000H

;S CHAR_53
DB 008H,054H,054H,054H,054H,054H,020H,000H

;T CHAR_54
DB 004H,004H,004H,07CH,004H,004H,004H,000H

;U CHAR_55
DB 03CH,040H,040H,040H,040H,040H,03CH,000H

;V CHAR_56
DB 004H,018H,030H,060H,030H,018H,004H,000H

;W CHAR_57
DB 01CH,060H,018H,00CH,018H,060H,01CH,000H

;X CHAR_58
DB 000H,044H,028H,010H,028H,044H,000H,000H

;Y CHAR_59
DB 000H,004H,008H,070H,008H,004H,000H,000H

;Z CHAR_5A
DB 044H,064H,054H,054H,04CH,044H,044H,000H

TABH DB 00H,01H,02H,03H
CCTAB ;成 CB3C9
DB 000H,000H,0F8H,0F8H,048H,048H,0C8H,0C8H
DB 0FFH,0FFH,009H,00BH,0CAH,0C8H,088H,008H
DB 040H,070H,03FH,00FH,008H,058H,05FH,06FH
DB 030H,01BH,00FH,01EH,033H,061H,0F0H,0F0H

;功 CB9A6
DB 000H,004H,004H,004H,0FCH,0FCH,014H,014H
DB 014H,090H,0FFH,07FH,010H,0F0H,0F0H,000H
DB 004H,00CH,00CH,004H,007H,043H,062H,033H
DB 01DH,02FH,023H,060H,060H,03FH,01FH,000H

;电 CB5E7
DB 000H,000H,0F8H,0F8H,048H,048H,048H,0FFH
DB 0FFH,048H,048H,048H,0F8H,0F8H,000H,000H
DB 000H,000H,00FH,00FH,004H,004H,004H,03FH
DB 07FH,044H,044H,044H,04FH,04FH,070H,070H

;子 CD7D3
DB 000H,000H,002H,002H,002H,002H,002H,0E2H
DB 0F2H,01AH,00EH,006H,002H,080H,080H,000H
DB 001H,001H,001H,001H,001H,041H,0C1H,0FFH
DB 07FH,001H,001H,001H,001H,001H,001H,001H

ORG 0FFFEH;
DW RESET;
END;


您可能还会关注的相关技术资料:

中国电子网
www.EC66.com
QQ:34740080 EMAIL:iloveaoe@163.com
最佳浏览:1024*768
Copyright (C) 2001-2010 EC66.COM All Rights Reserved
Aoe/帝国 制作维护
粤ICP备18061901号