匿名
未登录
登录
丢石头百科
搜索
查看“AVR LCD1602 程序”的源代码
来自丢石头百科
名字空间
页面
讨论
更多
更多
页面选项
查看
查看源代码
历史
←
AVR LCD1602 程序
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
<source lang="c"> /********************************************************************* 微 雪 电 子 WaveShare 目 的: 建立LCD1602操作库 目标系统: 基于AVR单片机 应用软件: ICCAVR 版 本: Version 1.0 圆版时间: 2005-06-25 开发人员: SEE 说 明: 若用于商业用途,请保留此段文字或注明代码来源 深 圳 市 微 雪 电 子 有 限 公 司 保 留 所 有 的 版 权 *********************************************************************/ /*01010101010101010101010101010101010101010101010101010101010101010101 ---------------------------------------------------------------------- 版本更新记录: ---------------------------------------------------------------------- 实验内容: 初始化、读写Lcd1602。 ---------------------------------------------------------------------- 硬件连接: 将Lcd1602插入主板的Lcd1602插槽, 使用连接线将LCD1602的引针接口连接到MCU: //LCD1602,4位接口,即使用D4-D7数据口,D0-D3不接入MCU //PIN1 --- GND //PIN2 --- VCC //PIN3 --- V0 //PIN4 --- RS --- PB5 //PIN5 --- R/W --- PB6 //PIN6 --- E --- PB7 //PIN7 --- D0 //PIN8 --- D1 //PIN9 --- D2 //PIN10 --- D3 //PIN11 --- D4 --- PD4 //PIN12 --- D5 --- PD5 //PIN13 --- D6 --- PD6 //PIN14 --- D7 --- PD7 //PIN15 --- VCC //PIN16 --- GND ---------------------------------------------------------------------- 注意事项: (1)若有加载库函数,请将光盘根目录下的“库函数”下的“ICC_H”文件夹拷到D盘 (2)请详细阅读“使用必读”及相关资料。 ---------------------------------------------------------------------- 10101010101010101010101010101010101010101010101010101010101010101010*/ #include <iom16v.h> #include "D:\ICC_H\CmmICC.H"</iom16v.h> /* control port */ #define SET_RS sbi(PORTB,5) #define CLR_RS cbi(PORTB,5) #define OUT_RS sbi(DDRB,5) #define SET_RW sbi(PORTB,6) #define CLR_RW cbi(PORTB,6) #define OUT_RW sbi(DDRB,6) #define SET_E sbi(PORTB,7) #define CLR_E cbi(PORTB,7) #define OUT_E sbi(DDRB,7) /* data port */ #define SET_D4 sbi(PORTD,4) #define CLR_D4 cbi(PORTD,4) #define OUT_D4 sbi(DDRD,4) #define SET_D5 sbi(PORTD,5) #define CLR_D5 cbi(PORTD,5) #define OUT_D5 sbi(DDRD,5) #define SET_D6 sbi(PORTD,6) #define CLR_D6 cbi(PORTD,6) #define OUT_D6 sbi(DDRD,6) #define SET_D7 sbi(PORTD,7) #define CLR_D7 cbi(PORTD,7) #define OUT_D7 sbi(DDRD,7) /* busy port */ #define GET_BF gbi(PIND,7) #define OUT_BF sbi(DDRD,7) #define IN_BF cbi(DDRD,7) #include "D:\ICC_H\LCD1602_.H" const uint8 userCh0[8]={0x10,0x1f,0x01,0x02,0x04,0x08,0x10,0x1f}; const uint8 userCh1[8]={0x00,0x08,0x0f,0x01,0x02,0x04,0x08,0x0f}; const uint8 userCh2[8]={0x00,0x00,0x04,0x07,0x01,0x02,0x04,0x07}; /*-------------------------------------------------------------------- 函数全称:LCD1602 函数功能: 注意事项: 提示说明: 输 入: 返 回: --------------------------------------------------------------------*/ void main() { LCD1602_init(); while(1) { LCD1602_puts(0xC6,"Sleeping"); delay50ms(5); LCD1602_setCmd("CLR_SCR"); delay50ms(5); LCD1602_puts(0xC6,"Sleeping"); delay50ms(5); LCD1602_setCmd("CLR_SCR"); delay50ms(5); LCD1602_puts(0xC6,"Sleeping"); delay50ms(5); LCD1602_setCGRAM(CGRAM0,userCh0); //Set CGRAM0' data LCD1602_setCGRAM(CGRAM1,userCh1); //Set CGRAM1' data LCD1602_setCGRAM(CGRAM2,userCh2); //Set CGRAM2' data LCD1602_putc(0x84,CGRAM2); //putc to 0x84 by CGRAM2' data delay50ms(10); LCD1602_putc(0x83,CGRAM1); //putc to 0x83 by CGRAM1' data delay50ms(12); LCD1602_putc(0x82,CGRAM0); //putc to 0x84 by CGRAM0' data delay50ms(14); LCD1602_setCmd("CLR_SCR"); } } </source>
返回至
AVR LCD1602 程序
。
导航
导航
首页
最近更改
随机页面
MediaWiki帮助
首页
首页
树莓派
主机
配件包
外壳
键鼠
电源
扩展板
显示屏
墨水屏
摄像模块
通信模块
继电器
电机驱动板
游戏机
产品分类
树莓派
Arduino
micro:bit
STM32
Espressif
WiFi模块
蓝牙模块
无线模块
LoRa模块
4G模块
GSM
GPRS
以太网
导航模块
北斗卫星
GPS
LCD
墨水屏
OLED
摄像头
USB模块
串口模块
RS232
RS485
CAN
传感器
温度模块
湿度模块
气压模块
继电器
电机模块
指纹模块
电平转换
音频模块
编程器
Wiki工具
Wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志