Code Monkey home page Code Monkey logo

lcddriver's Introduction

LCD 16x2 and 16x4 Driver

Copyright (C) 2013 RS Tecnologia.

The Project

This project aims to create a driver for communication and manipulation of a 16x2 and 16x4 lcd display via I2C protocol. Using a PCF8574 IO expander (IC)..


  1. Use - This driver creates a file structure to facilitate its use as described below:
    1. line1
      1. /sys/class/display/lcdxy/device/line1 - Write only.
      2. Writing a text on line 1 of the display. Command: echo "Text" > /sys/class/display/lcdxy/device/line1.
    2. line2
      1. /sys/class/display/lcdxy/device/line2 - Write only.
      2. Writing a text on line 2 of the display. Command: echo "Text" > /sys/class/display/lcdxy/device/line2.
    3. line3 - Only LCD16x4
      1. /sys/class/display/lcdxy/device/line3 - Write only.
      2. Writing a text on line 2 of the display. Command: echo "Text" > /sys/class/display/lcdxy/device/line3.
    4. line4 - Only LCD16x4
      1. /sys/class/display/lcdxy/device/line4 - Write only.
      2. Writing a text on line 2 of the display. Command: echo "Text" > /sys/class/display/lcdxy/device/line4.
    5. clear
      1. /sys/class/display/lcdxy/device/clear - Write only.
      2. Clears all text display. Command: echo 0 > /sys/class/display/lcdxy/device/clear.
    6. backlight
      1. /sys/class/display/lcdxy/device/backlightr - Write only.
      2. Turns off the Backlight. Command: echo 0 > /sys/class/display/lcdxy/device/backlight.
      3. Turns on the Backlight. Command: echo 1 > /sys/class/display/lcdxy/device/backlight.
    7. command
      1. /sys/class/display/lcdxy/device/command - Write only.
      2. Sends a byte of command to the display. Command: echo 192 > /sys/class/display/lcdxy/device/command.
    8. data
      1. /sys/class/display/lcdxy/device/data - Write only.
      2. Sends a byte of data to the display. Command: echo 192 > /sys/class/display/lcdxy/device/data.
    9. new_caracter
      1. /sys/class/display/lcdxy/device/new_caracter - Write only.
      2. Sends a new character into CGRAM of the display. Command: echo char_file.chr > /sys/class/display/lcdxy/device/new_caracter.
      3. The file should contain 9 bytes. The first is the character position in the CGRAM and the next eight bytes form the character.
      4. To print the character set, the cursor must be positioned using COMMAND file and then sent to the CGRAM position to be printed on the display using the DATA file.

**Install the Module in Beaglebone Black or Raspberry Pi**

  1. Download the lcd folder and copy the path to the kernel source code BEAGLEBONE or Raspberry Pi: /usr/src/beagle-3.8/KERNEL/drivers/misc/
  2. Change the Makefile that is on the way: /usr/src/beagle-3.8/KERNEL/drivers/misc/Makefile
    1. Add: "obj-y + = lcd/"
  3. Change the Makefile that is on the way: /usr/src/beagle-3.8/KERNEL/drivers/misc/Kconfig
    1. Add: source "drivers/misc/lcd/Kconfig"
  4. Compile the kernel, generating modules lcd16x2.ko and lcd16x4.ko

**Instantiating the device in user space**

To instantiate the device lcd16x2 or lcd16x4, just run the following command respecting the device address, coforme below:

LCD 16x2 - address 0x27:

  echo lcd16x2 0x27 > /sys/bus/i2c/devices/i2c-1/new_device

LCD 16x4 - address 0x27:

  echo lcd16x4 0x27 > /sys/bus/i2c/devices/i2c-1/new_device

**Instantiating the device in kernel space on Beaglebone Black with Device Tree**

Edit the file: /usr/src/beagle-3.8/KERNEL/arch/arm/boot/dts/am335x-bone-common.dtsi and add the following code before the SLOT@3:

slot@4 {
lcd16x2 = <&cape_lcd16x2_1>; 
};

Edit the file: /usr/src/beagle-3.8/KERNEL/arch/arm/boot/dts/am335x-bone-common.dtsi and add the following code before the CAPE_EEPROM3:

cape_lcd16x2_1: cape_lcd16x2_1@27 {
compatible = "at,lcd16x2";
reg = <0x27>; 
};

Compile the kernel


Support

Developer: Tiago Sousa Rocha - [email protected] - +558396541382 and +558381115793

lcddriver's People

Contributors

tsrrocha avatar

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.