• 大小: 1.3M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-08-29
  • 语言: 其他
  • 标签: 其他  

资源简介

智能小车成功.zip

资源截图

代码片段和文件信息

#include “lcd.h“

/*******************************************************************************
* 函 数 名         : Lcd1602_Delay1ms
* 函数功能    : 延时函数,延时1ms
* 输    入         : c
* 输    出         : 无
* 说    名         : 该函数是在12MHZ晶振下,12分频单片机的延时。
*******************************************************************************/

void Lcd1602_Delay1ms(uint c)   //误差 0us
{
    uchar ab;
for (; c>0; c--)
{
 for (b=199;b>0;b--)
 {
   for(a=1;a>0;a--);
 }      
}
    
}

/*******************************************************************************
* 函 数 名         : LcdWriteCom
* 函数功能    : 向LCD写入一个字节的命令
* 输    入         : com
* 输    出         : 无
*******************************************************************************/
#ifndef  LCD1602_4PINS  //当没有定义这个LCD1602_4PINS时
void LcdWriteCom(uchar com)   //写入命令
{
LCD1602_E = 0;     //使能
LCD1602_RS = 0;    //选择发送命令
LCD1602_RW = 0;    //选择写入

LCD1602_DATAPINS = com;     //放入命令
Lcd1602_Delay1ms(1); //等待数据稳定

LCD1602_E = 1;           //写入时序
Lcd1602_Delay1ms(5);   //保持时间
LCD1602_E = 0;
}
#else 
void LcdWriteCom(uchar com)   //写入命令
{
LCD1602_E = 0;  //使能清零
LCD1602_RS = 0;  //选择写入命令
LCD1602_RW = 0;  //选择写入

LCD1602_DATAPINS = com; //由于4位的接线是接到P0口的高四位,所以传送高四位不用改
Lcd1602_Delay1ms(1);

LCD1602_E = 1;  //写入时序
Lcd1602_Delay1ms(5);
LCD1602_E = 0;

LCD1602_DATAPINS = com << 4; //发送低四位
Lcd1602_Delay1ms(1);

LCD1602_E = 1;  //写入时序
Lcd1602_Delay1ms(5);
LCD1602_E = 0;
}
#endif
/*******************************************************************************
* 函 数 名         : LcdWriteData
* 函数功能    : 向LCD写入一个字节的数据
* 输    入         : dat
* 输    出         : 无
*******************************************************************************/    
#ifndef  LCD1602_4PINS    
void LcdWriteData(uchar dat) //写入数据
{
LCD1602_E = 0; //使能清零
LCD1602_RS = 1; //选择输入数据
LCD1602_RW = 0; //选择写入

LCD1602_DATAPINS = dat; //写入数据
Lcd1602_Delay1ms(1);

LCD1602_E = 1;   //写入时序
Lcd1602_Delay1ms(5);   //保持时间
LCD1602_E = 0;
}
#else
void LcdWriteData(uchar dat) //写入数据
{
LCD1602_E = 0;   //使能清零
LCD1602_RS = 1;   //选择写入数据
LCD1602_RW = 0;   //选择写入

LCD1602_DATAPINS = dat; //由于4位的接线是接到P0口的高四位,所以传送高四位不用改
Lcd1602_Delay1ms(1);

LCD1602_E = 1;   //写入时序
Lcd1602_Delay1ms(5);
LCD1602_E = 0;

LCD1602_DATAPINS = dat << 4; //写入低四位
Lcd1602_Delay1ms(1);

LCD1602_E = 1;   //写入时序
Lcd1602_Delay1ms(5);
LCD1602_E = 0;
}
#endif
/*******************************************************************************
* 函 数 名       : LcdInit()
* 函数功能  : 初始化LCD屏
* 输    入       : 无
* 输    出       : 无
*******************************************************************************/    
#ifndef LCD1602_4PINS
void LcdInit()   //LCD初始化子程序
{
  LcdWriteCom(0x38);  //开显示
LcdWriteCom(0x0c);  //开显示不显示光标
LcdWriteCom(0x06);  //写一个指针加1
LcdWriteCom(0x01);  //清屏
LcdWriteCom(0x80);  //设置数据指针起点
}
#else
void Lcd

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-07-05 21:13  发送综合\
     目录           0  2017-08-18 19:40  发送综合\stc12 摇杆模块 1602显示 0\
     文件         848  2017-02-27 23:12  发送综合\stc12 摇杆模块 1602显示 0\htc12_ad.h
     文件        3603  2016-09-06 08:44  发送综合\stc12 摇杆模块 1602显示 0\lcd.c
     文件         967  2017-03-20 20:56  发送综合\stc12 摇杆模块 1602显示 0\lcd.h
     文件        6567  2017-03-20 21:28  发送综合\stc12 摇杆模块 1602显示 0\lcd.LST
     文件        3561  2017-03-20 21:28  发送综合\stc12 摇杆模块 1602显示 0\lcd.OBJ
     文件        1376  2017-03-20 21:35  发送综合\stc12 摇杆模块 1602显示 0\main.c
     文件        3428  2017-03-20 21:28  发送综合\stc12 摇杆模块 1602显示 0\main.LST
     文件        7395  2017-03-20 21:28  发送综合\stc12 摇杆模块 1602显示 0\main.OBJ
     文件       17607  2017-02-27 21:08  发送综合\stc12 摇杆模块 1602显示 0\stc12.h
     文件         526  2017-02-27 23:09  发送综合\stc12 摇杆模块 1602显示 0\stc12_ad.c
     文件        1826  2017-03-20 21:28  发送综合\stc12 摇杆模块 1602显示 0\stc12_ad.LST
     文件        4226  2017-03-20 21:28  发送综合\stc12 摇杆模块 1602显示 0\stc12_ad.OBJ
     文件       14183  2017-03-20 21:28  发送综合\stc12 摇杆模块 1602显示 0\template
     文件        1032  2017-03-20 21:28  发送综合\stc12 摇杆模块 1602显示 0\template.build_log.htm
     文件        5751  2017-03-20 21:28  发送综合\stc12 摇杆模块 1602显示 0\template.hex
     文件          73  2017-03-20 21:28  发送综合\stc12 摇杆模块 1602显示 0\template.lnp
     文件       15436  2017-03-20 21:28  发送综合\stc12 摇杆模块 1602显示 0\template.M51
     文件         221  2017-08-18 19:39  发送综合\stc12 摇杆模块 1602显示 0\template.plg
     文件      140367  2017-03-22 17:58  发送综合\stc12 摇杆模块 1602显示 0\template.uvgui.11851
     文件      135099  2016-09-06 08:44  发送综合\stc12 摇杆模块 1602显示 0\template.uvgui.Administrator
     文件      135091  2016-09-06 08:44  发送综合\stc12 摇杆模块 1602显示 0\template.uvgui_Administrator.bak
     文件       56130  2017-08-18 19:40  发送综合\stc12 摇杆模块 1602显示 0\template.uvopt
     文件       13559  2017-08-18 19:40  发送综合\stc12 摇杆模块 1602显示 0\template.uvproj
     文件        5776  2017-02-27 23:29  发送综合\stc12 摇杆模块 1602显示 0\template_uvopt.bak
     文件       14174  2017-02-27 17:01  发送综合\stc12 摇杆模块 1602显示 0\template_uvproj.bak
     文件      642764  2017-02-25 23:15  发送综合\stc12 摇杆模块 1602显示 0\游戏摇杆模块.pdf
     目录           0  2017-08-18 19:40  发送综合\stc12 摇杆模块 1602显示 1\
     文件         848  2017-02-27 23:12  发送综合\stc12 摇杆模块 1602显示 1\htc12_ad.h
     文件        3603  2016-09-06 08:44  发送综合\stc12 摇杆模块 1602显示 1\lcd.c
............此处省略83个文件信息

评论

共有 条评论