0% found this document useful (0 votes)
70 views22 pages

Infineon-Component - I2C - LCD - V1.10-Software Module Datasheets-V01 - 02-EN

The document describes an I2C LCD component that allows communication with an LCD display over an I2C bus. The component provides functions to initialize and control the LCD. It supports multiple LCDs on the same I2C bus and can be used with or without an existing I2C master component. The document explains how to configure the component and customize commands for different LCD modules.

Uploaded by

den kabul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views22 pages

Infineon-Component - I2C - LCD - V1.10-Software Module Datasheets-V01 - 02-EN

The document describes an I2C LCD component that allows communication with an LCD display over an I2C bus. The component provides functions to initialize and control the LCD. It supports multiple LCDs on the same I2C bus and can be used with or without an existing I2C master component. The document explains how to configure the component and customize commands for different LCD modules.

Uploaded by

den kabul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

PSoC® Creator™ Component Datasheet

Character LCD with I2C Interface (I2C LCD)


1.10

Features
 Communicate on a 2-wire I2C bus
 The API is compatible with the current character LCD component
 A single component may drive one or more LCDs on the same
I2C bus

 The I2C LCD can coexist on an existing I2C bus if the PSoC is the I2C master

 Support for the NXP PCF2119x command format

General Description
The I2C LCD component drives an I2C interfaced 2 line by 16 character LCD. The I2C LCD
component is a wrapper around an I2C Master component and makes use of an existing I2C
Master component. If a project does not already have an I2C Master component, one is required
in order to operate. When one of the API functions is called, that function calls one or more of the
I2C Master functions in order to communicate with the LCD.

When to Use an I2C LCD


The I2C LCD component is used in applications that require a visual or textual display. This
component is also used where a character display is needed but seven consecutive GPIOs on a
single GPIO port are not possible. In cases where the project already includes an I2C master, no
additional GPIO pins are required.

Input/Output Connections
The component does not have any connection because it is a software component.

Cypress Semiconductor Corporation • 198 Champion Court • San Jose, CA 95134-1709 • 408-943-2600
Document Number: 001-88606 Rev. *B Revised September 6, 2016
Character LCD with I2C Interface (I2C LCD) PSoC® Creator™ Component Datasheet

Component Parameters
Drag an I2C LCD onto your design and double-click it to open the Configure dialog as illustrated
in Error! Reference source not found..

General Tab
The General tab provides options to configure the general settings of the I2C LCD. These
parameters are available.

I2C Master Instance Name


This parameter is set to the instance name of the I2C Master component name. An I2C master
must reside in the schematic for this component to operate. It uses this name to access the I 2C
Master APIs. The LCD must also be connected to the I2C bus controlled by the I2C Master
component. Allowed characters are A-Z, 0-9, _. The instance name cannot start or end with an
underscore.

Default I2C Address


This parameter sets the default address of the I2C LCD. This address is used when connecting
to the I2C Master’s API to properly address the LCD. If multiple LCDs are placed on the bus, the
LCD’s I2C address may change during run time. By default this parameter is set to 0x40.
Note For the NXP LCD module the I2C address should be set to 0x74.

Page 2 of 22 Document Number: 001-88606 Rev. *B


PSoC® Creator™ Component Datasheet Character LCD with I2C Interface (I2C LCD)

LCD Custom Character Set


This parameter enables the selection of these options:

 None (Default) – Do not do anything with custom characters.

 Vertical Bar Graph – Generate custom characters and API to manipulate a vertical bar
graph.

 Horizontal Bar Graph – Generate custom characters and API to manipulate a horizontal
bar graph.

 User Defined –Create custom characters and API to manipulate them.


After the component has loaded in the characters, the I2C_LCD_PutChar() function and the
custom character constants (from the header file) can be used to display them.

Command format
This parameter has two options. If NXP PCF2119x + custom commands is selected this means
that component uses embedded support of NXP PCF2119x command protocol and also it allows
user to enter any extended (custom) commands that NXP compatible LCD module supports. The
custom commands can be entered in the Custom Commands tab. If you plan to use the LCD
with a command set that is different than the NXP PCF2119x select Custom format. In this
case, you enter the required commands in the Custom Commands tab. You can also enter any
other commands supported by the specific LCD module in the Custom commands table.

Document Number: 001-88606 Rev. *B Page 3 of 22


Character LCD with I2C Interface (I2C LCD) PSoC® Creator™ Component Datasheet

Custom Commands Tab


This tab has a set of options that makes it possible to add custom command support to the
component.

Use command pattern for data writing


This option controls whether a command pattern is sent with the data to display text on the LCD
using functions such as I2C_LCD_PrintString(). When the box is not checked, the data to be
displayed is sent directly. When the box is checked, a command pattern is sent along with the
text. The NXP PCF2119x compatible modules require a command pattern, so this option is
always checked for that mode of operation. For custom LCD module support, review the
datasheet for the module to determine the correct setting for this option.

Page 4 of 22 Document Number: 001-88606 Rev. *B


PSoC® Creator™ Component Datasheet Character LCD with I2C Interface (I2C LCD)

Required commands
This group box contains a list of mandatory commands that you must define for component
operation. This table has a command set that is mandatory for NXP PCF2119x compatible LCD
Modules.
# Command Description
1 Write a byte or multiple bytes of data
2 Display on, cursor off
3 Display and cursor off
4 Set cursor position
5 Cursor home
6 Reset cursor position
7 Move cursor left one place
8 Move cursor right one place
9 Underline cursor on
10 Display - on, cursor - off, set cursor wink
11 Display - on, cursor - off, set cursor blink
12 Clear screen
13 Load custom character
14 Set display for 2 lines and 16 characters
15 Move cursor/shift display right (cursor position auto increment)
16 Move cursor/shift display right (cursor position auto decrement)

When NXP PCF2119x + custom commands option is selected, the Required commands
table is grayed out as patterns of required commands are already embedded into the
component. In the case of a Custom format you need to enter proper command patterns for
each required command. If some of commands are not supported by the specific LCD module
you must enter a dummy command pattern.
Set cursor position
For the NXP PCF2119x compatible LCD modules the command codes from 0x80 and above are
used for setting the address of Display Data RAM (DDRAM).For example, the address of 0x80
maps to row 0 and column 0 of the LCD module and the address 0x83 maps to row 0 and
column 3. For detailed information on mapping of DDRAM to LCD location please see the LCD
module datasheet.

Document Number: 001-88606 Rev. *B Page 5 of 22


Character LCD with I2C Interface (I2C LCD) PSoC® Creator™ Component Datasheet

Command Size
This parameter specifies the size (in bytes) of command sequence without parameters or actual
data.

Data size
This parameter defines the size of data that is sent after the command sequence for the
specified command.

CMD byte 1 – CMD byte 4


This parameter specifies the values of bytes #1 - #4 of command sequence. IF “Command Size”
is less than four (the maximum size) the unused bytes are grayed out in the customizer.CMD
byte 2 defines the unique command code for the command sequence. This command code can
be used as a parameter for I2C_LCD_WriteControl() or I2C_LCD_HandleCustom() functions.

Command description
This is short descriptions of what the command does. It helps to match command patterns from
the customizer with commands from the LCD Module’s datasheet.
By default, when the Custom commands parameter is selected, the required commands are
filled with command patterns for the NXP PCF2119x command format.

Custom commands
In this section you define custom command handlers for specific commands. You also have a
mechanism to add new commands. The column definitions in this group box are the same as for
Required Commands but there are two additional columns.

Enable
This option, when checked, enables the use of the respective command pattern in the design. It
means that the API function is provided for the command pattern.

API name
This parameter specifies the name of API function that is generated (if enabled) for the
command pattern. The API name specified in this column is appended with a component
instance name at the beginning of the name. Also depending on the data size the API function
will or will not have a parameter. For example, for the API name “Func1” with component
instance name “I2C_LCD” and Data size equal to zero the API function has this prototype:
void I2C_LCD_Func1(void);

If Data size is 1, the prototype is:


void I2C_LCD_Func1(uint8 cmdByte);

Page 6 of 22 Document Number: 001-88606 Rev. *B


PSoC® Creator™ Component Datasheet Character LCD with I2C Interface (I2C LCD)

If Data size is greater than 1, the prototype is:


void I2C_LCD_Func1(uint8 cmdData[]);

The size of cmdData[] is specified by Data size.


Note that the API name you type cannot be all capital letters. If they are, the component displays
a warning about redefining the macro. This is because, for each custom command, the
component generates the #define constant for a command code that has the same name as one
specified in API name that has all capital letters.

Application Programming Interface


Application Programming Interface (API) routines allow you to configure the component using
software. This table lists and describes the interface to each function. The following sections
cover each function in more detail.
By default, PSoC Creator assigns the instance name I2C_LCD_1 to the first instance of a
component in a given design. You can rename it to any unique value that follows the syntactic
rules for identifiers. The instance name becomes the prefix of every global function name,
variable, and constant symbol. For readability, the instance name used in the following table is
I2C_LCD.

Functions
Functions Description
I2C_LCD_Start() Starts the module and loads custom character set to LCD if it was
defined.
I2C_LCD_Stop() Turns off the LCD
I2C_LCD_DisplayOn() Turns on the LCD module’s display
I2C_LCD_DisplayOff() Turns off the LCD module’s display
I2C_LCD_PrintString() Prints a null-terminated string to the screen, character by character
I2C_LCD_PutChar() Sends a single character to the LCD module data register at the current
position.
I2C_LCD_Position() Sets the cursor’s position to match the row and column supplied
I2C_LCD_WriteData() Writes a single byte of data to the LCD module data register
I2C_LCD_WriteControl() Writes a single-byte instruction to the LCD module control register
I2C_LCD_ClearDisplay() Clears the data from the LCD module’s screen
I2C_LCD_Init() Performs initialization required for component’s normal work
I2C_LCD_Enable() Turns on the display

Document Number: 001-88606 Rev. *B Page 7 of 22


Character LCD with I2C Interface (I2C LCD) PSoC® Creator™ Component Datasheet

Functions Description
I2C_LCD_SetAddr() This function allows the user to change the default I2C address of the
LCD.
I2C_LCD_PrintInt8() Prints a two-ASCII-character hex representation of the 8-bit value to the
Character LCD module.
I2C_LCD_PrintInt16() Prints a four-ASCII-character hex representation of the 16-bit value to
the Character LCD module.
I2C_LCD_PrintNumber() Prints the decimal value of a 16-bit value as left-justified ASCII
characters
I2C_LCD_HandleOneByteCommand() This command adds a support of sending custom commands with 1
byte parameter
I2C_LCD_HandleCustomCommand() Performs sending of the command that has variable parameters.

These optional functions are included, when needed, if you-select a custom font. The
I2C_LCD_LoadCustomFonts() function comes with every custom font set, whether it is user-
defined or PSoC Creator generated. The I2C_LCD_LoadCustomFonts() function can be used to
load the user-defined or the bar graph characters into the LCD hardware. If you load custom
fonts created by the tool, you need to import a pointer to the custom font to your project before
using this function (see the description of the I2C_LCD_LoadCustomFonts()). By default, the
I2C_LCD_Init() routine loads the user-selected custom font. The draw bar graph commands are
generated when a bar graph is selected and enable the easy, dynamic adjustment of bar graphs.
Optional Custom Font Functions Description

I2C_LCD_LoadCustomFonts() Loads custom characters into the LCD module


I2C_LCD_DrawHorizontalBG() Draws a horizontal bar graph. Only available when a bar graph character set
has been selected.
I2C_LCD_DrawVerticalBG() Draws a vertical bar graph. Only available when a bar graph character set
has been selected.

Global Variables
Function Description
I2C_LCD_initVar The I2C_LCD_initVar variable is used to indicate initial configuration of this
component. This variable is prepended with the component name. The variable
is initialized to zero and set to 1 the first time I2C_LCD_Start() is called. This
allows for component initialization without reinitialization in all subsequent calls
to the I2C_LCD_Start() routine.
It is necessary to reinitialize the component when the device is going through
sleep cycles. Therefore, the variable is set to zero when going into sleep
I2C_LCD_Sleep() and set during the reinitialization done in I2C_LCD_Wakeup().
I2C_LCD_customFonts[] Stores custom character set that was defined in the customizer's GUI.

Page 8 of 22 Document Number: 001-88606 Rev. *B


PSoC® Creator™ Component Datasheet Character LCD with I2C Interface (I2C LCD)

void I2C_LCD_Start(void)
Description: When this function called first time it initializes the LCD hardware module as follows:

 Turns on the display;

 Enables auto cursor increment;

 Resets the cursor to start position;

 Clears the display;

 It also loads a custom character set to LCD if it was defined in the customizer's GUI.
Resets the cursor to start position.
All of the following call to this function will just turn on the LCD module.
Note This function sends commands to the display using the I2C Master. The I2C Master
must be initialized and global interrupts must be enabled before calling this function.
Also if you are using the NXP-compatible LCD modulenote that it requires a 1 ms reset pulse
prior to calling I2C_LCD_Start(). Refer to the I2C LCD example project to see the proper way
of resetting the LCD module.
Parameters: None
Return Value: None
Side Effects: None

void I2C_LCD_Stop(void)
Description: Turns off the display of the LCD screen but does not stop the I2C Master component.
Parameters: None
Return Value: None
Side Effects: None

void I2C_LCD_PrintString(char8 const string[])


Description: Writes a null-terminated string of characters to the screen beginning at the current cursor
location.

Parameters: char8 const string[]: Null-terminated array of ASCII characters to be displayed on the LCD
module’s screen.
Return Value: None
Side Effects: None

Note Because of the character set that is hardcoded to NXP PCF2119x LCD module, which is
used in the PSoC4 processor module, some of characters can’t be displayed. Refer to
Functional Description section for details.

Document Number: 001-88606 Rev. *B Page 9 of 22


Character LCD with I2C Interface (I2C LCD) PSoC® Creator™ Component Datasheet

void I2C_LCD_PutChar(char8 character)


Description: Writes an individual character to the screen at the current cursor location. Used to display
custom characters through their named values. (I2C_LCD_CUSTOM_0 through
I2C_LCD_CUSTOM_7).
Parameters: char8 character: ASCII character to be displayed on the LCD module’s screen.
Return Value: None
Side Effects: None

Note Because of the character set that is hardcoded to NXP PCF2119x LCD module, which is
used in the PSoC4 processor module, some of characters can’t be displayed. Refer to
Functional Description section for details.

void I2C_LCD_Position(uint8 row, uint8 column)


Description: Moves the cursor to the location specified by arguments row and column.
Parameters: uint8 row: The row number at which to position the cursor. Minimum value is zero.
uint8 column: The column number at which to position the cursor. Minimum value is zero.
Return Value: None
Side Effects: None

void I2C_LCD_WriteData(uint8 dByte)


Description: Writes data to the LCD RAM in the current position. Upon write completion, the position is
incremented or decremented depending on the entry mode specified.
Parameters: dByte: A byte value to be written to the LCD module.
Return Value: None
Side Effects: None

Page 10 of 22 Document Number: 001-88606 Rev. *B


PSoC® Creator™ Component Datasheet Character LCD with I2C Interface (I2C LCD)

void I2C_LCD_WriteControl(uint8 cByte)


Description: Writes a command byte to the LCD module. Different LCD models can have their own
commands. Review the specific LCD datasheet for commands valid for that model.
Parameters: cByte: 8-bit value representing the command to be loaded into the command register of the
LCD module. Valid command parameters are specified in the table below:
Value Description
I2C_LCD_CLEAR_DISPLAY Clear display
I2C_LCD_RESET_CURSOR_POSITION Return cursor and LCD to home position
I2C_LCD_CURSOR_HOME
I2C_LCD_CURSOR_LEFT Set left cursor move direction
I2C_LCD_CURSOR_RIGHT Set right cursor move direction
I2C_LCD_DISPLAY_CURSOR_ON Enable display and cursor
I2C_LCD_DISPLAY_ON_CURSOR_OFF Enable display, cursor off
I2C_LCD_CURSOR_WINK Enable display, cursor off, set cursor wink
I2C_LCD_CURSOR_BLINK Enable display and cursor, set cursor
blink
I2C_LCD_CURSOR_SH_LEFT Move cursor/Shift display left
I2C_LCD_CURSOR_SH_RIGHT Move cursor/shift display right
I2C_LCD_DISPLAY_2_LINES_5x10 Set display to be 2 lines 10 characters
I2C_LCD_CURSOR_RIGHT Move cursor/shift display right (cursor
I2C_LCD_CURSOR_AUTO_INCR_ON position auto increment)

I2C_LCD_CURSOR_LEFT Move cursor/shift display right (cursor


position auto decrement)
Return Value: None
Side Effects: None

void I2C_LCD_ClearDisplay(void)
Description: Clears the contents of the screen and resets the cursor location to be row and column zero.
It calls I2C_LCD_WriteControl() with the appropriate argument to activate the display.
Parameters: None
Return Value: None
Side Effects: Cursor position reset to row – 0, column - 0.

Document Number: 001-88606 Rev. *B Page 11 of 22


Character LCD with I2C Interface (I2C LCD) PSoC® Creator™ Component Datasheet

void I2C_LCD_DisplayOff(void)
Description: Turns the display off, but does not reset the LCD module in any way. It calls function
I2C_LCD_WriteControl() with the appropriate argument to deactivate the display.
Parameters: None
Return Value: None
Side Effects: None

void I2C_LCD_DisplayOn(void)
Description: Turns the display on, without initializing it. It calls function I2C_LCD_WriteControl() with the
appropriate argument to activate the display.
Parameters: None
Return Value: None
Side Effects: Disables underlining of the cursor if it was previously enabled.

void I2C_LCD_Init(void)
Description: Performs initialization of the LCD module as following:

 Turns on the display;

 Enables auto cursor increment;

 Resets the cursor to start position;

 Clears the display;

 It also loads a custom character set to LCD if it was defined in the customizer's GUI.
Resets the cursor to start position

Parameters: None
Return Value: None
Side Effects: None

void I2C_LCD_Enable(void)
Description: Turns on the display.
Parameters: None
Return Value: None
Side Effects: None

Page 12 of 22 Document Number: 001-88606 Rev. *B


PSoC® Creator™ Component Datasheet Character LCD with I2C Interface (I2C LCD)

void I2C_LCD_SetAddr (uint8 address)


Description: This function allows you to change the default I2C address of the LCD. This function is
not used for designs with a single LCD. Systems that have two or more LCDs on a
single I2C bus use this function to select the appropriate LCD.
Parameters: uint8 address: I2C address of a LCD device.
Return Value: None
Side Effects: None

void I2C_LCD_PrintInt8(uint8 value)


Description: Prints a two ASCII character representation of the 8-bit value to the character I2C LCD
module.
Parameters: uint8 value: The 8-bit value to be printed in hexadecimal ASCII characters.
Return Value: None
Side Effects: None

void I2C_LCD_PrintInt16(uint16 value)


Description: Prints a four ASCII character representation of the 16-bit value to the Character I2С LCD
module.
Parameters: uint16 value: The 16-bit value to be printed in hexadecimal ASCII characters.
Return Value: None
Side Effects: None

void I2C_LCD_PrintNumber(uint16 value)


Description: Prints the decimal value of a 16-bit value as left-justified ASCII characters.
Parameters: uint16 value: The 16-bit value to be printed in ASCII characters as a decimal number.
Return Value: None
Side Effects: None

Document Number: 001-88606 Rev. *B Page 13 of 22


Character LCD with I2C Interface (I2C LCD) PSoC® Creator™ Component Datasheet

void I2C_LCD_HandleOneByteCommand(uint8 cmdId, uint8 cmdByte)


Description: This command adds a support of sending custom commands with 1 byte parameter.
Parameters: uint8 cmdId: Command code.
uint8 cmdByte: one byte of data to be send to I2C LCD.
Return Value: None
Side Effects: None

void I2C_LCD_HandleCustomCommand(uint8 cmdId, uint8 dataLength, uint8


const cmdData[])
Description: Performs sending of the command that has variable parameters.
Parameters: uint8 cmdId: Command code.
uint8 dataLength: length of data to be sent for this command.
uint8 const cmdData[]: the data to be send to I2C LCD.
Return Value: None
Side Effects: None

void I2C_LCD_LoadCustomFonts(uint8 const customData[])


Description: Loads eight custom characters (bar graph or user-defined fonts) into the LCD module to use
the custom fonts during runtime. Only available if a custom character set was selected in the
customizer.
Parameters: uint8 const customData[]: Pointer to the head of an array of bytes. Array should be 64 bytes
long as 5x8 characters require 8 bytes per character.
Return Value: None
Side Effects: Overwrites any previous custom characters that may have been stored in the LCD module.

Page 14 of 22 Document Number: 001-88606 Rev. *B


PSoC® Creator™ Component Datasheet Character LCD with I2C Interface (I2C LCD)

void I2C_LCD_DrawHorizontalBG(uint8 row, uint8 column, uint8


maxCharacters, uint8 value)
Description: Draws a horizontal bar graph. Only available if a horizontal or vertical bar graph was
selected.
Parameters: uint8 row: The row of the first character in the bar graph.
uint8 column: The column of the first character in the bar graph.
uint8 maxCharacters: Number of whole characters the bar graph consumes. Represents
height or width depending upon the bar graph selection. Each character is 5 pixels wide and
8 pixels high.
uint8 value: Number of shaded pixels to draw. May not exceed total pixel length (height) of
the bar graph.
Return Value: None
Side Effects: None

void I2C_LCD_DrawVerticalBG(uint8 row, uint8 column, uint8


maxCharacters, uint8 value)
Description: Draws a vertical bar graph. Only available if a horizontal or vertical bar graph was selected.
Parameters: uint8 row: The row of the first character in the bar graph.
uint8 column: The column of the first character in the bar graph.
uint8 maxCharacters: Number of whole characters the bar graph consumes. Represents
height or width depending upon the bar graph selection. Each character is 5 pixels wide and
8 pixels high.
uint8 value: Number of shaded pixels to draw. May not exceed total pixel length (height) of
the bar graph.
Return Value: None
Side Effects: None

Macros
To simplify the use of a system that uses multiple LCDs on a single bus, a macro for each API is
added that includes the I2C address of the LCD. For example, the address macro for the
command “I2C_LCD_Position(row, col)” is “I2C_LCD_AddrPosition(addr, row, col)”. The
parameter “addr” is the I2C address of the LCD. Calling the macro function is the same as calling
the I2C_LCD_SetAddr() function before calling the native function. For example, calling the
macro function:
I2C_LCD_AddrPosition(addr, row, col);

Document Number: 001-88606 Rev. *B Page 15 of 22


Character LCD with I2C Interface (I2C LCD) PSoC® Creator™ Component Datasheet

This function is exactly like calling these two functions, one after the other:
I2C_LCD_SetAddr(addr);
I2C_LCD_Position(row, col);

As expected, the I2C LCD address remains until another macro is called or the
I2C_LCD_SetAddr() function itself is called. Here is a summary table of the macros that are
supported.

Functions Address Macro

I2C_LCD_Start() I2C_LCD_AddrStart()
I2C_LCD_Stop() I2C_LCD_AddrStop()
I2C_LCD_DisplayOn() I2C_LCD_AddrDisplayOn()
I2C_LCD_DisplayOff() I2C_LCD_AddrDisplayOff()
I2C_LCD_PrintString() I2C_LCD_AddrPrintString()
I2C_LCD_PutChar() I2C_LCD_AddrPutChar()
I2C_LCD_Position() I2C_LCD_AddrPosition()
I2C_LCD_WriteData() I2C_LCD_AddrWriteData()
I2C_LCD_WriteControl() I2C_LCD_AddrWriteControl()
I2C_LCD_ClearDisplay() I2C_LCD_AddrClearDisplay()
I2C_LCD_Init() N/A
I2C_LCD_Enable() I2C_LCD_AddrEnable()
I2C_LCD_LoadCustomFonts() I2C_LCD_AddrLoadCustomFonts()
I2C_LCD_DrawHorizontalBG() I2C_LCD_AddrDrawHorizontalBG()
I2C_LCD_DrawVerticalBG() I2C_LCD_AddrDrawVerticalBG()
I2C_LCD_SetAddr() N/A
I2C_LCD_PrintInt8() I2C_LCD_AddrPrintInt8()

I2C_LCD_PrintInt16() I2C_LCD_AddrPrintInt16()

I2C_LCD_PrintNumber() I2C_LCD_AddrPrintNumber()

I2C_LCD_HandleCustomCommand() I2C_LCD_AddrHandleCustomCommand()

To simplify access to custom commands defined in the component’s GUI, these macros are
generated. The names shown below correspond to “Func1” entered in the API name of Custom
command table.

 I2C_LCD_Func1()–Function-like macro, which is generated for the case when custom a


command has the data size parameter set to zero.

Page 16 of 22 Document Number: 001-88606 Rev. *B


PSoC® Creator™ Component Datasheet Character LCD with I2C Interface (I2C LCD)

 I2C_LCD_Func1(cmdByte) – Function-like macro which is generated for the case when


a custom command has Data size parameter equal to one. cmdByte is a one byte
parameter for the command.

 I2C_LCD_Func1(cmdData) – Function-like macro which is generated for the case when


a custom command has a Data size parameter greater than 1. cmdData is an array with
the size specified by the Data size parameter.

 I2C_LCD_FUNC1 – Defines the command code (the value that is entered in CMD byte 2),
that can be used as a parameter of I2C_LCD_WriteControl(),
I2C_LCD_HandleOneByteCommand() or I2C_LCD_HandleCustomCommand().

MISRA Compliance
This section describes the MISRA-C:2004 compliance and deviations for the component. There
are two types of deviations defined: project deviations – deviations that are applicable for all
PSoC Creator components and specific deviations – deviations that are applicable only for this
component. This section provides information on component specific deviations. The project
deviations are described in the MISRA Compliance section of the System Reference Guide
along with information on the MISRA compliance verification environment.
The I2C LCD component has the following specific deviations:
MISRA- Rule Class
C:2004 (Required/
Rule Advisory) Rule Description Description of Deviation(s)
19.7 R A function shall be used in preference to a A function-like macro is used in the
function-like macro. component to handle differences in the
API function names of the I2C Master
implemented on the UDB and I2C Master
implemented on the SCB.
Also function-like macros are used to
simplify usage of custom commands.

Sample Firmware Source Code


PSoC Creator provides numerous example projects that include schematics and example code
in the Find Example Project dialog. For component-specific examples, open the dialog from the
Component Catalog or an instance of the component in a schematic. For general examples,
open the dialog from the Start Page or File menu. As needed, use the Filter Options in the
dialog to narrow the list of projects available to select.
See the "Find Example Project" topic in the PSoC Creator Help for more information.

Document Number: 001-88606 Rev. *B Page 17 of 22


Character LCD with I2C Interface (I2C LCD) PSoC® Creator™ Component Datasheet

Functional Description
Block Diagram and Configuration
The I2C LCD component is a wrapper around an I2C Master component. The component
provides the library for generating transactions defined by the NXP PCF2119x chip. It also has
support for the generation of custom I2C LCD modules, which are similar to the NXP PCF2119x
command format. With the I2C LCD component it is possible to communicate with several LCDs,
of the same type using address macros. Also, you can use several components to add support
for LCDs with different command formats. All of the I2C components can share the same I2C
Master component.

Figure 1. Interaction of I2C LCD and I2C Master Components

I2C Master I2C LCD


Component Component

Customizer Customizer

API API

HW
Implementation
(Verilog or Fixed
Function)

PSoC Device

I2C Bus

I2C LCD I2C LCD I2C I2C


Slave 1
... Slave N Slave 1 ... Slave M

Device 1 Device N Device 1 Device M

I2C LCD and Character LCD


The I2C LCD component was designed to have the same user interface as the existing PSoC
Creator Character LCD component. Although the I2C LCD has the same character set as
Character LCD, there is a difference in output. Because of character set that is hardcoded to
NXP PCF2119x LCD module, which is used in the PSoC4 processor module, some of
characters, for example brackets (‘[’,’]’), cannot be displayed on the LCD. The lists of characters

Page 18 of 22 Document Number: 001-88606 Rev. *B


PSoC® Creator™ Component Datasheet Character LCD with I2C Interface (I2C LCD)

for both LCDs are shown in the following figure, and those characters that differ are marked with
red color.

Figure 2. Character Sets for NXP PCF2119x and Hitachi HD44780 LCD Modules

Resources
The I2C LCD component is a software component and uses no hardware resources.

Document Number: 001-88606 Rev. *B Page 19 of 22


Character LCD with I2C Interface (I2C LCD) PSoC® Creator™ Component Datasheet

API Memory Usage


The component memory usage varies significantly, depending on the compiler, device, number
of APIs used, and component configuration. This table shows the memory use for all APIs
available in the given component configuration.
The measurements were done with an associated compiler configured in release mode with
optimization set for size. For a specific design, the map file generated by the compiler can be
analyzed to determine the memory usage.
PSoC 3 (Keil_PK51) PSoC 4 (GCC) PSoC 5LP (GCC)
Flash SRAM Flash SRAM Flash SRAM
Configuration Bytes Bytes Bytes Bytes Bytes Bytes
None 1059 259 748 268 772 265
Horizontal or Vertical
1654 259 1136 268 1148 265
bargraph
User Defined 1200 259 870 268 894 265

Registers
N/A

DC and AC Electrical Characteristics


The following values indicate expected performance and are based on initial characterization
data.
Parameter Description Conditions Min Typ Max Units
NumLCD Number of LCD Modules on the LCD Determined by the 1 - >10
that can be placed on the I2C Bus capacitance on the I2C bus
and the pull up resistors.
tfnc_ex1
I2C_LCD_Start() Data rate = 100kbps - 14.8 - ms
I2C_LCD_Stop() - 1.94 - ms

I2C_LCD_DisplayOn() - 0.44 - ms

I2C_LCD_DisplayOff() - 1.94 - ms

1The values were received on PSoC3 device with BUS_CLK set to 24 MHz

Page 20 of 22 Document Number: 001-88606 Rev. *B


PSoC® Creator™ Component Datasheet Character LCD with I2C Interface (I2C LCD)

Parameter Description Conditions Min Typ Max Units


I2C_LCD_PrintString() - 1.562 - ms

I2C_LCD_PutChar() - 0.43 - ms

I2C_LCD_Position() - 0.43 - ms

I2C_LCD_WriteData() - 0.43 - ms

I2C_LCD_WriteControl() - 0.49 - ms

I2C_LCD_ClearDisplay() - 1.98 - ms

I2C_LCD_Init() - 14.4 - ms

I2C_LCD_Enable() - 0.44 - ms

I2C_LCD_SetAddr() - 2 - us

I2C_LCD_HandleCustomCommand() - 0.623 - ms

I2C_LCD_HandleOneByteCommand() - 0.62 - ms

I2C_LCD_LoadCustomFonts() - 9.0 - ms

I2C_LCD_DrawHorizontalBG() - 1.944 - ms

I2C_LCD_DrawVerticalBG() - 3.465 - ms

I2C_LCD_PrintInt8() - 0.55 - ms

I2C_LCD_PrintInt16() - 1.1 - ms

I2C_LCD_PrintNumber() - 1.03 - ms

2The value is for 10-characters string


3The value is for command pattern that consists with 2 bytes and data size = 1 byte
4The value is for printing 10 bars
5The value is for printing 4 bars

Document Number: 001-88606 Rev. *B Page 21 of 22


Character LCD with I2C Interface (I2C LCD) PSoC® Creator™ Component Datasheet

Component Changes
This section lists the major changes in the component from the previous version.
Version Description of Changes Reason for Changes/Impact
1.10.b Minor datasheet edit.
1.10.a Add I2C_LCD_SetAddr () function description The function description was missing.
to Application Programming Interface section.
1.10 Fixed a warning about static function - The warning was appearing when the command format
I2C_LCD_SendCmd(), which was declared option was set to "Custom format".
but not defined, was fixed.
1.0a A note of resetting the NXP-compatible LCD Address an issue with the NXP-compatible LCD
module was added to description of module.
I2C_LCD_Start()
1.0 Version 1.0 is the first release of the I2C LCD
component

© Cypress Semiconductor Corporation, 2013-2016. This document is the property of Cypress Semiconductor Corporation and its subsidiaries, including Spansion LLC (“Cypress”). This
document, including any software or firmware included or referenced in this document (“Software”), is owned by Cypress under the intellectual property laws and treaties of the United States and
other countries worldwide. Cypress reserves all rights under such laws and treaties and does not, except as specifically stated in this paragraph, grant any license under its patents, copyrights,
trademarks, or other intellectual property rights. If the Software is not accompanied by a license agreement and you do not otherwise have a written agreement with Cypress governing the use
of the Software, then Cypress hereby grants you a personal, non-exclusive, nontransferable license (without the right to sublicense) (1) under its copyright rights in the Software (a) for Software
provided in source code form, to modify and reproduce the Software solely for use with Cypress hardware products, only internally within your organization, and (b) to distribute the Software in
binary code form externally to end users (either directly or indirectly through resellers and distributors), solely for use on Cypress hardware product units, and (2) under those claims of Cypress’s
patents that are infringed by the Software (as provided by Cypress, unmodified) to make, use, distribute, and import the Software solely for use with Cypress hardware products. Any other use,
reproduction, modification, translation, or compilation of the Software is prohibited.
TO THE EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS DOCUMENT OR ANY
SOFTWARE OR ACCOMPANYING HARDWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. To the extent permitted by applicable law, Cypress reserves the right to make changes to this document without further notice. Cypress does not assume any liability arising out of
the application or use of any product or circuit described in this document. Any information provided in this document, including any sample design information or programming code, is provided
only for reference purposes. It is the responsibility of the user of this document to properly design, program, and test the functionality and safety of any application made of this information and
any resulting product. Cypress products are not designed, intended, or authorized for use as critical components in systems designed or intended for the operation of weapons, weapons
systems, nuclear installations, life-support devices or systems, other medical devices or systems (including resuscitation equipment and surgical implants), pollution control or hazardous
substances management, or other uses where the failure of the device or system could cause personal injury, death, or property damage (“Unintended Uses”). A critical component is any
component of a device or system whose failure to perform can be reasonably expected to cause the failure of the device or system, or to affect its safety or effectiveness. Cypress is not liable, in
whole or in part, and you shall and hereby do release Cypress from any claim, damage, or other liability arising from or related to all Unintended Uses of Cypress products. You shall indemnify
and hold Cypress harmless from and against all claims, costs, damages, and other liabilities, including claims for personal injury or death, arising from or related to any Unintended Uses of
Cypress products.
Cypress, the Cypress logo, Spansion, the Spansion logo, and combinations thereof, WICED, PSoC, CapSense, EZ-USB, F-RAM, and Traveo are trademarks or registered trademarks of
Cypress in the United States and other countries. For a more complete list of Cypress trademarks, visit cypress.com. Other names and brands may be claimed as property of their respective
owners.

Page 22 of 22 Document Number: 001-88606 Rev. *B

You might also like