资源简介
LCD1602程序 for MSP430F449,本人编写的详细源代码,供学习和工作参考使用。值得下载和收藏。
代码片段和文件信息
/*******************************************************************************
* 描述: *
* 1602字符型LCD显示演示程序 *
* 在第一行显示 welcome *
* 在第二行显示 www.ycit.cn *
* *
********************************************************************************/
#ifndef uchar
#define uchar unsigned char
#endif
#ifndef uint
#define uint unsigned int
#endif
#define nop _NOP()
//RS--P5.6 RW--P5.5 E--P5.4
//sbit RS = P2^6; //
//sbit RW = P2^5;
//sbit E = P2^7;
#define RS_1 P5OUT |= BIT6
#define RS_0 P5OUT &= ~BIT6
#define RW_1 P5OUT |= BIT5
#define RW_0 P5OUT &= ~BIT5 ////
#define E_1 P5OUT |= BIT4
#define E_0 P5OUT &= ~BIT4
uchar dis1[] = {“welcome!“};
uchar dis2[] = {“www.ycit.cn“};
/*
void RS(char s)
{
if(s==1) P5OUT |= BIT6;
else P5OUT &= ~BIT6;
}
void RW(char s)
{
if(s==1) P5OUT |= BIT5;
else P5OUT &= ~BIT5;
}
void E(char s)
{
if(s==1) P5OUT |= BIT4;
else P5OUT &= ~BIT4;
} */
/**********LCD1602.c 函数声明***************/
void delay(uchar ms); //延时3*ms毫秒
uchar lcd_bz(); //测试LCD忙碌状态
void write_cmd1(uchar cmd1); //写入指令数据到LCD
void write_cmd(uchar cmd); //写入指令数据到LCD
void lcd_pos(uchar pos); //设定显示位置
void write_data(uchar dat); //写入字符显示数据到LCD
void LCD_Init(); //LCD初始化设定
void delay(uchar ms)
{ // 延时子程序
uchar i;
while(ms--)
{
for(i = 0; i< 250; i++)
{
nop;
nop;
nop;
nop;
}
}
}
void delay_ms(int ms)
{ // 延时子程序
uchar i;
while(ms-- >0)
{
for(i = 0; i< 250; i++)
{
nop;
nop;
nop;
nop;
}
}
}
/*
uchar lcd_bz()
{ // 测试LCD忙碌状态bit7
uchar result=0x80;
P3DIR =0x00;///
RS_0;
RW_1;
E_1;
//nop;
//nop;
//nop;
nop;
result = (uchar)(P3IN & 0x80);
if(result == 0)
nop;
E_0;
return (result);
}
void write_cmd(uchar cmd)
{ // 写入指令数据到LCD
//while(lcd_bz() & 0x80);
E_0;
P3DIR = 0xff; ///
RS_0;
RW_0;
//nop;
//nop;
P3OUT = cmd;
//nop;
//nop;
//nop;
//nop;
E_1;
nop;
//nop;
//nop;
//nop;
E_0;
}
void lcd_pos(uchar pos)
{ //设定显示位置
//while(lcd_bz() & 0x80);
writecmd(pos | 0x80);
}
void write_data(uchar dat)
{ //写入字符显示数据到LCD
//while(lcd_bz() & 0x80);
P3DIR = 0x00; // 置位输入模式
RW_1;
RS_0;
E_1;
//while((P3IN & 0x80)==0x80);//检测LCD是否忙
E_0;
P3DIR = 0xff; ///
RS_0;
RW_0;
RS_1; //
//E_0;
P3OUT = dat;
//nop;
//nop;
//nop;
//nop;
E_1;
//nop;
//nop;
//nop;
nop;
E_0;
}
*/
void delay_us(uchar de)
{ while(de-- >0)
nop;
}
//((((((((((((((((((((((((((((((
void busy_check()
{
P3DIR = 0;
E_0; //
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 19242 2011-03-04 16:09 LCD1602\Debug\Exe\LCD1602.d43
文件 133 2011-03-04 16:09 LCD1602\Debug\Obj\LCD1602.pbd
文件 21482 2011-03-04 16:09 LCD1602\Debug\Obj\main.r43
文件 5208 2011-03-04 16:03 LCD1602\LCD1602.c
文件 2121 2011-03-04 16:23 LCD1602\LCD1602.dep
文件 17879 2011-03-03 21:50 LCD1602\LCD1602.ewd
文件 47478 2011-03-03 21:50 LCD1602\LCD1602.ewp
文件 161 2011-03-03 21:50 LCD1602\LCD1602.eww
文件 901 2011-03-04 16:09 LCD1602\main.c
文件 2729 2011-03-04 16:10 LCD1602\settings\LCD1602.cspy.bat
文件 5545 2011-03-04 16:23 LCD1602\settings\LCD1602.dbgdt
文件 1188 2011-03-04 16:23 LCD1602\settings\LCD1602.dni
文件 3404 2011-03-04 16:23 LCD1602\settings\LCD1602.wsdt
目录 0 2011-03-04 15:12 LCD1602\Debug\Exe
目录 0 2011-03-03 21:42 LCD1602\Debug\List
目录 0 2011-03-04 16:23 LCD1602\Debug\Obj
目录 0 2011-03-03 21:42 LCD1602\Debug
目录 0 2011-03-03 22:29 LCD1602\settings
目录 0 2011-03-04 16:09 LCD1602
----------- --------- ---------- ----- ----
127471 19
- 上一篇:基于FPGA的舵机控制程序
- 下一篇:基于VTK的人头骨3D图像
相关资源
- lCD1602万年日历温度显示程序仿真.zi
- 基于MSP430F6638的数字钟代码
- DS18B20+lcd1602显示+LED数码管显示
- 2018年TI杯电子设计大赛FDC2214、TPS630
- MSP430F5529LP 串口通信 UART 代码 CCS工程
- 基于51单片机和LCD1602的计算器
- 基于MSP430的UART串口控制机械臂
- fdc2214驱动程序——基于MSP430F5529
- 基于MSP430F149单片机的语音播报模块使
- msp430f5529计算fft程序,可用
- msp430系列库封装
- msp430f5529三种频率PWM定时输出
- MSP430G2553例程代码
- MSP430 INFO_A 操作
- STC89C52+LCD1602+DS1302电子时钟
- VHDL LCD1602显示程序
- 基于STC12C5A60S2的DS18B20温度显示工程
- 基于89C51的等精度频率计LCD1602显示1
- msp430f149 TFT屏 显示 240*320
- 基于msp430的智能宿舍.rar
- msp430G2553调用库
- msp430AD采集电压
- 用DS18B20测量温度并在12864液晶屏上显
- MSP430 USB转串口驱动
- 基于msp430单片机的电子万年历LCD 128
- 基于msp430单片机的红外线遥控解码L
- LCD1602液晶显示的计算器加减乘除
- MSP430G25534个简单的小程序
- 解析GPS数据并用LCD1602显示
- 基于DDS和MSP430的信号发生器设计
评论
共有 条评论