⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 实验12_lcd_点阵.s43

📁 MSP-TEST44X 学习板光盘资料及实验说明 本学习板是按照教育大纲
💻 S43
字号:
#include  "msp430x44x.h " 
;*********************************************************************
;MSP-Test44x Demo    LCD DISPLAY 
;
;                  MSP430F449
;             -----------------
;         /|\|              XIN|-  
;          | |                 |
;          --|RST          XOUT|-   ________
;            |                 |   |        |
;            |             P2.0|-->|   l    |
;            |               . | . |        |
;            |             P2.3| . |   C    |
;            |             P2.6| . |        |
;            |             P2.7| . |   D    |
;            |             P3.0| . |        |
;            |               . | . |        |
;            |             P3.8|-->|________|        
;            |                 |
;    
;  Yang Rui
;  Lierda, Inc
;  NOVEMBER 2003
;  Built with IAR Embedded Workbench Version: 1.26B 
;----------------------------------------------------------------------
;--------------------RAM定义-------------------------------------------
;----------------------------------------------------------------------
command                 equ             202h        ;命令缓冲
write_buff              equ             203h        ;写指令缓冲
x_count1                equ             204h        ;行计数器1
x_count                 equ             205h        ;行计数器2
y_count                 equ             206h        ;列计数器
disp_col                equ             207h        ;显示计数
flag                    equ             208h        ; CS1,CS2选择标志
write_count             equ             209h        ;写计数器
data_count              equ             20ah        ;显示计数

second                  equ             210h        ;秒计数器
min                     equ             211h        ;分计数器
hour                    equ             212h        ;小时计数器
 
cs1                     equ         01h             ;前64列选择
cs2                     equ         02h             ;后64列选择

;-----------------------------------------------------------------------
;---------------端口定义-------------------------------------------------
;-----------------------------------------------------------------------
#define		P2_0_RS			0x01        // RS PIN
#define		P2_1_RW			0x02        // R/W PIN
#define		P2_2_EN			0x04        // EN PIN
#define		P2_3_CS1		0x08        // CS1 PIN
#define		P2_3_CS2		0x40        // CS2 PIN
#define		P2_3_RST		0x80        // RST PIN

#define		P3_0_DB0		0x01        // DB0 PIN
#define		P3_1_DB1		0x02        // DB1 PIN
#define		P3_2_DB2		0x04        // DB2 PIN
#define		P3_3_DB3		0x08        // DB3 PIN
#define		P3_4_DB4		0x10        // DB4 PIN
#define		P3_5_DB5		0x20        // DB5 PIN
#define		P3_6_DB6		0x40        // DB6 PIN
#define		P3_7_DB7		0x80        // DB7 PIN

;-----------------------------------------------------------------------

            ORG     01100h                                   ;程序开始处
;-----------------------------------------------------------------------
Reset          
              	mov.w   #0a00h,SP                            ; 系统堆栈指针
StopWDT       	mov.w   #WDTPW+WDTHOLD,&WDTCTL               ; 禁止看门狗
;-----------------------------------------------------------------------
;-----------------初始化 ,包括端口,ram------------------------------
;-----------------------------------------------------------------------

              	call     #port_ini                           ;端口初始化
                nop
                nop
                clr.b    &second                             ;RAM初始化
                clr.b    &min
                clr.b    &hour 
                clr.b    &flag             
                mov.b    #0c0h,&command
                call     #write_command
                mov.b    #3fh,&command
                call     #write_command
                call     #clear_lcd
                
                mov.b    #40h,&command
                call     #write_command
                mov.b    #0b8h,&command
                call     #write_command
                
                mov.b   #0a6h,&BTCTL                         ;BT初始化并产生秒中断
              	bis.b   #BTIE,&IE2                           ;             
              	eint               	                                
;-------------------------------------------------------------------------
;----------------主程序 显示WELCOME LIERDA 电话号码 实时时钟--------
;-------------------------------------------------------------------------
mainloop       
                call     #welcome                            ;显示WELCOME  LIERDA !
                call     #tel
                call     #dis_second
                jmp      mainloop
                ret
;-------------------------------------------------------------------------
;----------------显示WELCOME  LIERDA !------------------------------------                
;-------------------------------------------------------------------------
welcome         mov.b    #00h,R6
                mov.b    #5,R7                               
loop_w        
                mov.b     show(R6),R13
                cmp.b     #0ffh,R13                          ; 判断有无显示完
                jz        tel
                rra       R13
                mov.b     table_count(R13),R10   	           	                 		        		                              	       
                call      #display_init              
                mov.b     #05h,&data_count                               
                mov.b     #1,&x_count
                mov.b     R7,&y_count                
                call      #display_char
                inc.b     R6
                add.b     #7,R7
                jmp       loop_w
                ret
;--------------------------------------------------------------------------
;----------------显示TEL:0571-88259199-----------------------------------
;--------------------------------------------------------------------------
tel                                          
                mov.b    #00h,R6
                mov.b    #5,R7 
loop            mov.b     show_1(R6),R13
                cmp.b     #0ffh,R13                           ; 判断有无显示完
                jz        dis_second
                rra       R13
                mov.b     table_count(R13),R10               	                 		        		                              	       
                call      #display_init              
                mov.b     #05h,&data_count                               
                mov.b     #4,&x_count
                mov.b     R7,&y_count                
                call      #display_char
                inc.b     R6
                add.b     #7,R7
                jmp       loop
                ret 

;-------------------------------------------------------------------------
;---------------显示时钟-------------------------------------------------                                                                                              
;-------------------------------------------------------------------------
dis_second      mov.b     &second,R13                         ;显示秒
	        rra.b  	  R13
            	rra.b     R13
	        rra.b     R13
	        rra.b     R13
	        and.b     #0fh,R13
	        mov.b     table_count(R13),R10                ;字符索

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -