搜索
bottom↓
回复: 7

[OurDev开源充电器]1602 LCD驱动程序

[复制链接]

出0入4汤圆

发表于 2007-11-28 19:55:04 | 显示全部楼层 |阅读模式
在 ouravr 上有很多 HD44780 的驱动程序,我再上传一份,不知可否用到?
这个程序是网上的开源程序,我在电路上做了实验,可以良好运行,在 BSD/Windows 里都可以正常编译。

这个驱动库大概有这些函数:
/**
*  @name Functions
*/


/**
@brief    Initialize display and select type of cursor
@param    dispAttr \b LCD_DISP_OFF display off\n
                    \b LCD_DISP_ON display on, cursor off\n
                    \b LCD_DISP_ON_CURSOR display on, cursor on\n
                    \b LCD_DISP_ON_CURSOR_BLINK display on, cursor on flashing            
@return  none
*/
extern void lcd_init(uint8_t dispAttr);


/**
@brief    Clear display and set cursor to home position
@param    void                                       
@return   none
*/
extern void lcd_clrscr(void);


/**
@brief    Set cursor to home position
@param    void                                       
@return   none
*/
extern void lcd_home(void);


/**
@brief    Set cursor to specified position

@param    x horizontal position\n (0: left most position)
@param    y vertical position\n   (0: first line)
@return   none
*/
extern void lcd_gotoxy(uint8_t x, uint8_t y);


/**
@brief    Display character at current cursor position
@param    c character to be displayed                                       
@return   none
*/
extern void lcd_putc(char c);


/**
@brief    Display string without auto linefeed
@param    s string to be displayed                                       
@return   none
*/
extern void lcd_puts(const char *s);


/**
@brief    Display string from program memory without auto linefeed
@param    s string from program memory be be displayed                                       
@return   none
@see      lcd_puts_P
*/
extern void lcd_puts_p(const char *progmem_s);


/**
@brief    Send LCD controller instruction command
@param    cmd instruction to send to LCD controller, see HD44780 data sheet
@return   none
*/
extern void lcd_command(uint8_t cmd);

// mtmt new function:
#ifdef LCD_SCROLL_FUNCTION
/**
@brief    Scroll LCD up
@param    none
@return   none
*/
extern void lcd_scrollup(void);
#endif

// mtmt exported for debugging
extern uint8_t lcd_waitbusy(void);

点击此处下载ourdev_183454.rar(文件大小:9K)
压缩包内是 connect.txt, lcd.h 和 lcd.c
压缩包里支持的 LCD 是4x20,如果要让它支持16x2,需要对 lcd.h 进行设置,文件中有详细说明。

阿莫论坛20周年了!感谢大家的支持与爱护!!

一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。

出0入0汤圆

发表于 2007-11-28 20:34:46 | 显示全部楼层
看上去很不错,值得借鉴

出0入0汤圆

发表于 2007-11-29 08:26:49 | 显示全部楼层
已阅!谢谢
头像被屏蔽

出0入0汤圆

发表于 2007-11-30 07:34:07 | 显示全部楼层
能将电路图也上传上来吗? 谢谢。先置COOL。 (COOL需要有电路图)

出0入4汤圆

 楼主| 发表于 2007-11-30 10:21:33 | 显示全部楼层
程序不是我写的,阿莫不能乱加酷,要保证质量啊。

电路图在这里已经定义了:
#define LCD_PORT         PORTB        /**< port for the LCD lines   */
#define LCD_DATA0_PORT   LCD_PORT     /**< port for 4bit data bit 0 */
#define LCD_DATA1_PORT   LCD_PORT     /**< port for 4bit data bit 1 */
#define LCD_DATA2_PORT   LCD_PORT     /**< port for 4bit data bit 2 */
#define LCD_DATA3_PORT   LCD_PORT     /**< port for 4bit data bit 3 */
#define LCD_DATA0_PIN    4            /**< pin for 4bit data bit 0  */
#define LCD_DATA1_PIN    5            /**< pin for 4bit data bit 1  */
#define LCD_DATA2_PIN    6            /**< pin for 4bit data bit 2  */
#define LCD_DATA3_PIN    7            /**< pin for 4bit data bit 3  */
#define LCD_RS_PORT      LCD_PORT     /**< port for RS line         */
#define LCD_RS_PIN       0            /**< pin  for RS line         */
#define LCD_RW_PORT      LCD_PORT     /**< port for RW line         */
#define LCD_RW_PIN       1            /**< pin  for RW line         */
#define LCD_E_PORT       LCD_PORT     /**< port for Enable line     */
#define LCD_E_PIN        2            /**< pin  for Enable line     */

我本来是学机械的,喜欢看图:)

出0入0汤圆

发表于 2007-11-30 20:48:56 | 显示全部楼层
不错

出0入0汤圆

发表于 2010-2-9 15:54:29 | 显示全部楼层
谢谢、

出0入0汤圆

发表于 2010-12-11 16:13:21 | 显示全部楼层
回复【楼主位】atommann
-----------------------------------------------------------------------

标记
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-3-29 07:51

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表