Jump to content

Component: LCD I2C (Backpack) (Alphanumeric)

From Flowcode Help
Revision as of 12:20, 3 February 2023 by Wiki bot (talk | contribs)
Author Matrix Ltd
Version 2.2
Category Alphanumeric


LCD I2C (Backpack) component

Standard alphanumeric LCD based on a standard I2C control bus. Usually using either a PIC device or Microchip IO expander IC.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_temp/LCD_I2C.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_temp/LCD_I2C.fcfx

Detailed description

No detailed description exists yet for this component

Examples

A simple example that shows how to use some common functions.

Backpack LCD Example

If the display is not showing the expected characters, the I2c address or contrast could be wrong.

It's best to keep the jumper connected since the backlight is enabled by default.


Using an Arduino Uno the correct I2C address can be determined by using an IC2 Address Sniffer

The I2C address to use is the one within the first set of square brackets.

For example, with my backpack display, the correct address to use is 0x3F [63]:

The other two Addresses i.e. 0x56 [86] and 0x68 [104] is for my 24C32 EEPROM and DS3231 RTC respectively.

Note The I2c addresses scan will repeat every 5seconds.

The sniffer will send data to your PC via UART to USB.

The Arduino range and clones will have it built-in.


More details on I2C can be found here,

Matrix Flowcode Blog: Simplified communications I2C and SPI





Macro reference

BacklightControl

BacklightControl
 
- BYTE State
 
- VOID Return


Clear

Clear
 
- VOID Return


ClearLine

ClearLine
 
- BYTE Line
 
- VOID Return


Command

Command
Use this method/macro to send a specific command to the LCD. Refer to the Matrix Multimedia EB006 datasheet for a list of supported instructions. For Non-Matrix LCD's refer to the manufacturers datasheet. 
- BYTE instruction
 
- VOID Return


Cursor

Cursor
Moves the cursor on the LCD Display 
- BYTE x
 
- BYTE y
 
- VOID Return


PrintAscii

PrintAscii
Takes the ascii value for a character and prints the character 
- BYTE character
 
- VOID Return


PrintFloat

PrintFloat
Print a Float number rounded up to a specified amount of decimal places. 
- FLOAT Number
Enter the number or variable to print to the LCD 
- BYTE DecimalPlaces
Enter how many decimal places to round up to (1 - 6) 
- VOID Return


PrintFormattedNumber

PrintFormattedNumber
Will allow you to print a number up to 32-bits with signed or unsigned formatting. Signed = -2147483648 to 2147483647 Unsigned = 0 to 4294967295 
- ULONG Number
Enter the number or variable to print to the LCD 
- BOOL Format
0=Signed, 1=Unsigned 
- VOID Return


PrintNumber

PrintNumber
Allows you to print a number. This is limited to a signed-INT, -32768 to 32767 
- INT Number
 
- VOID Return


PrintString

PrintString
 
- STRING Text
 
- VOID Return


RAMWrite

RAMWrite
Modifies the internal memory of the LCD to allow for up to 8 customised characters to be created and stored in the device memory 
- BYTE Index
 
- BYTE d0
 
- BYTE d1
 
- BYTE d2
 
- BYTE d3
 
- BYTE d4
 
- BYTE d5
 
- BYTE d6
 
- BYTE d7
 
- VOID Return


ScrollDisplay

ScrollDisplay
Scrolls the display left or right by a number of given positions. 
- BYTE position
 
- BYTE direction
 
- VOID Return


SetI2CAddress

SetI2CAddress
Allows the I2C device address to be dynamically changed in software without having to re-compile. Can be called before the first Start macro or at any point after. 
- BYTE Address
New I2C Device Address excluding R/W bit - Range 0 - 127 
- VOID Return


Start

Start
Startup routine required by the hardware device. 
- VOID Return


Property reference

Properties
I2C Config
LCD Address
 
Channel
Channel selection 
Baud Select
Baud rate option selector 
Baud Rate
Baud rate to be used 
Stop Delay
On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not a 10ms delay between an I2C stop event and the next I2C start event. Most modern microcontrollers will not have a problem so this property can be disabled to speed up the I2C communications.  
Connections
SDA
Pin used for SDA (data signal) 
SCL
Pin used for SCL (clock signal) 
LCD Configuration
Rows
 
Columns
 
Use Backlight
Controls if the backlight is controlled as part of the main data routine or if it is handled separately. 
Simulation
Component Label
 
Component Label Scale
The label scale can be change if the amout of text is too wide for the display  
Text Colour
Specifies the initial foreground color. 
Text Background
Colour surrounding the font characters drawn on the display 
Display Background
Colour of the background of the display 
Simulate Comms
Allows the communications to be simulated via an injector component.