Reply to topic  [ 1 post ] 
HC5110 Arduino library for the Nokia 5110 Graphic LCD Module 
Author Message
Site Admin

Joined: Sun Aug 05, 2012 4:02 pm
Posts: 669
Post HC5110 Arduino library for the Nokia 5110 Graphic LCD Module
[IMAGE TBA]

Description:

this library has been written to allow easy use of the Nokia 5110 graphic LCD module (HCMODU0037) using an Arduino development board such as an Uno/Nano/ Mega etc. To use this library you will require 5 DIO pins.

You will need to download (please log in to download the library) and unzip this library to the Arduino development environments library area

On Windows:
My Documents\Arduino\libraries\
My Documents\Arduino\libraries\
My Documents\Arduino\libraries\

On Mac:
Documents/Arduino/libraries/
Documents/Arduino/libraries/
Documents/Arduino/libraries/
or similarly for Linux.

To use the library just include the HC5110.h header file and create an instance of the HC5110 library. E.g:

Quote:
HC5110 HC5110(RST,CE,DC,DIN,CLK);


Where RST,CE,DC,DIN, and CLK are the DIO pins you wish to use on you Arduino.

The following functions are available with this library:

Quote:
HC5110.Clear();


Clears the screen.

Quote:
HC5110.Home();


Moves the cursor to the top left hand corner of the screen.

Quote:
HC5110.Cursor(XPos, YPos);


Places the cursor at the specified coordinates. Where Xpos in the x position in pixels and Ypos is the Y position in 8 pixel lines. Xpos and Y pos are of type Byte.

Quote:
HC5110.Contrast(Level);


Sets the screens contrast where level is the contrast level. Valid values are between 0x00 and 0x7F. Level is of type byte.

Quote:
HC5110.WriteData(Data);


Writes a 1 pixel wide 8 bit column to the screen. Data is of type Byte.

Quote:
HC5110.Bitmap(Cols, ByteRows, BitmapData[]);


Writes a block of graphic data stored in a Byte array to the screen. Cols is the number pixels wide. ByteRows is the number of 8 pixel high rows the graphic will require. BitmapData is a byte array holding the graphic data. Cols and ByteRows of of type Byte. BitmapData[] is of type Const Byte.

Quote:
HC5110.Print(TextString[]);

Outputs a string of text to the LCD. Text string is a character array which holds the text string. TextString[] is of type Char.

Quote:
HC5110.Print(Value);

Outputs a signed integer number to the LCD. Value is of type Int Long.

Quote:
HC5110.Print(int long Value, byte DecimalPlaces);


Outputs a signed integer to the screen with a decimal place where Value is the number to display and DecimalPlaces is the position of the decimal point. Value is of type Int Long and DecimalPlaces is of type Byte.


Quote:
Example Sketch:

Code:
/* FILE:    HC5110_Example
   DATE:    07/09/13
   VERSION: 0.1
   AUTHOR:  Andrew Davies

This is an example of how to use the functions within the HC5110 library written
for the Nokia 5110 LCD module (HCMODU0037). This example will display example
text, a graphic, and formatted decimal number.

You can specify which DIO pins on your Arduino connect to the module but if left
unchanged you will need to make the following connections:

MODULE   UNO
RST      D3
CE       D4
DC       D5
DIN      D6
CLK      D7
VCC      3.3V
BL       3.3V
GND      GND


WARNING: Do not power the module or its backlight via the Arduino's 5V pin. This
will distroy the module. Although the module is 3.3V only, the digital pins are
5V tollarant, so it is safe to connect them directly to 5V DIO pins


You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used directly for the purpose of selling products that
directly compete with Hobby Components Ltd's own range of products.

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER.
*/

/* Example bitmap */
const byte Tiny_Logo_Resistor [] = {
0x80, 0xC0, 0x60, 0x60, 0xE0, 0xC0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00,
0x00, 0x00, 0x00, 0x00, 0xC0, 0x70, 0x1C, 0x0E, 0x3C, 0xF0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x80, 0xE0, 0x38, 0x0E, 0x1E, 0x78, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x78, 0x1E,
0x0E, 0x38, 0xE0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF0, 0x3C, 0x0E, 0x1C, 0x70, 0xC0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xC0, 0xE0,
0x60, 0x60, 0xC0, 0x80, 0x01, 0x03, 0x06, 0x06, 0x07, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x07, 0x1E, 0x78, 0x70, 0x1C, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0F,
0x3C, 0x70, 0x38, 0x0E, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x1C, 0x70, 0x70, 0x1C,
0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0E, 0x38, 0x70, 0x3C, 0x0F, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x07, 0x1C, 0x70, 0x78, 0x1E, 0x07, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x03, 0x07, 0x06, 0x06, 0x03, 0x01,
};

/* Include the HC5110 library header */
#include <HC5110.h>

/* Create an instance of HC5110 library and define the DIO pins
   used (RST,CD,DC,DIN,CLK) */
HC5110 HC5110(3,4,5,6,7);

/* Set the displays contrast. */
void setup()
{
  HC5110.Contrast(0xB0);
}

/* Main program */
void loop()
{
  /* Display some text */
  HC5110.Clear();
  HC5110.Home();
  HC5110.Cursor(20, 0);
  HC5110.Print("Hobby");
  HC5110.Cursor(0, 1);
  HC5110.Print("Components");
 
  /* Display a graphic */
  HC5110.Cursor(0, 3);
  HC5110.Bitmap(84, 2, Tiny_Logo_Resistor); 
 
  /* Wait a little then clear the screen */
  delay(2000);
  HC5110.Clear();
 
  /* Display some example numbers */
  HC5110.Print(12345678);
  HC5110.Cursor(0, 1);
  HC5110.Print(-12345678);
  HC5110.Cursor(0, 2);
  HC5110.Print(12345678,2);
  delay(2000);
}



Library:

Attachment:
HC5110.zip


You do not have the required permissions to view the files attached to this post.


Sat Sep 07, 2013 4:51 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Thank you to phpBB.com & phpBB.ro.
Design created by Florea Cosmin Ionut.
© 2011 All contents of this site are © Hobby Components LTD