Giter VIP home page Giter VIP logo

regalis-lcd-driver's Introduction

Driver for alphanumeric LCD modules

An open-source, easy to use library for controlling LCD modules based on HD44780(U). Only 4-bits interface is supported.

This library works with all Atmel AVR microcontrollers.

Examples

Before displaying the text on the LCD, you should review the configuration file (regalis_lcd_config.h).

I. Hello world

Before any read/write operations you ought to init LCD module by running regalis_lcd_init() function. This will perform module initialization by executing instructions (set interface mode to 4-bits, set cursor behaviour etc.). After this operations cursor will be placed at (0, 0) position - first character, first line.

(...)
#include "regalis_lcd.h"

int main() {
	regalis_lcd_init();
	/** Now you can read/write data from/to LCD */
}

To display character on your LCD, just use regalis_lcd_putc(char) function. If you want to display C string (const char *), use regalis_lcd_puts(const char *). NOTE, this functions ignores new line characters (\n).

To display "Hello world" message, just type:

(...)
#include "regalis_lcd.h"

int main() {
	regalis_lcd_init();
	regalis_lcd_puts("Hello world!");
}

II. Cursor positioning

There are two different functions for manipulating cursor position:

  • regalis_lcd_goto(X, Y); (first character, first line means X = 0 and Y = 0)
  • regalis_lcd_goto_addr(DDRAM_ADDR);

If you want to display "Hello world" in first line and "regalis_lcd" in second line, you should use this functions:

(...)
#include "regalis_lcd.h"

int main() {
	regalis_lcd_init();
	regalis_lcd_puts("Hello world");
	regalis_lcd_goto(0, 1);
	regalis_lcd_puts("regalis_lcd");
}

Clearing display

To clear whole display and set cursor position in (0, 0) use regalis_lcd_clear() function.

Extras

regalis_lcd library also provides some simple functions that can be used to animate text:

  • regalis_soft_puts(const char *) - print text with nice-looking smooth transition (from left to right)
  • regalis_soft_clear(uint8_t length) - print text with nice-looking smooth transition (from left to right)
  • regalis_soft_move(uint8_t scr_addr, uint8_t dst_addr, uint8_t length) - move length characters from scr_addr to dst_addr with smooth transition
  • regalis_shift_r(uint8_t amount) - shift (left) display, wait and return to previous position

See extras/regalis_lcd_extras.h for full list of extras functions with documentation.

Credits

Developed with VIM on Arch GNU/Linux, tested with:

  • WC1602A0 (16x2)
  • TC1602A-19T(R) (16x2)
  • YM2004A (20x4)

Feel free to report bugs and suggestions.

License

Copyright (C) 2012 Patryk Jaworski <[email protected]>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses.

regalis-lcd-driver's People

Contributors

regalis avatar

Stargazers

Rutvij Pritesh Shah avatar  avatar Tarmo avatar Ariana Las avatar Konrad Talik avatar

Watchers

 avatar James Cloos avatar

Forkers

libesz

regalis-lcd-driver's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.