|
MSP430F149液晶LCD12864并行口显示源程序
[复制链接]
单片机源程序如下:
#include "Config.h"
#include "LCD12864.C"
unsigned char sec = 0,min = 0,hour = 0;
unsigned char Time_Data[] = "00:00:00";
/****************************************函数声明********************/
void Port_init();
/****************************************主函数**********************/
int main( void )
{
WDT_Init(); //看门狗初始化
Clock_Init(); //时钟初始化
Port_init(); //端口初始化
LCD12864_init(); //LCD12864初始化
TimerA_Init(); //定时器A初始化
while(1)
{
LCD12864_Write_Array(LINE1 + 0 ,"Time:");
LCD12864_Write_Array(LINE1 + 3 ,Time_Data);
LCD12864_Write_Array(LINE2 + 0 ,"Hello World!");
LCD12864_Write_Array(LINE3 + 1 ,"Hello World!");
LCD12864_Write_Array(LINE4 + 2 ,"Hello World!");
Time_Data[0] = hour / 10 + '0';
Time_Data[1] = hour % 10 + '0';
Time_Data[3] = min / 10 + '0';
Time_Data[4] = min % 10 + '0';
Time_Data[6] = sec / 10 + '0';
Time_Data[7] = sec % 10 + '0';
if(sec >= 59){sec = 0;min++;}
if(min >= 59){min = 0;hour++;}
if(hour >= 23){hour = 0;}
}
}
/****************************************端口初始化******************/
void Port_init()
{
P4SEL = 0X00; //设置P4口为普通I/O模式
P4DIR = 0XFF; //设置P4口方向为输出
P5SEL = 0X00; //设置P5口为普通I/O模式
……………………
|
|