Published 15 Jan 2019

Mx300 Driver Library


I have a few LCD display panels from Canon printers like the MX300 and MX310 that I wish to use in Arduino projects. These are 2 line by 20 character LCD status displays that have no horizontal gap between the two rows of characters. This suggests possibilities of creating double height characters that look natural. Some of the character sets/fonts implemented here could be used on other 2 line LCD displays, and some rely on the existing inbuilt character set. I have not determined which Hitachi HD44780 compatible LCD controller/driver chip that they use.

Canon MX300 LCD


Overview

I looked for an Arduino library that would display double-height characters and found quite a few, I have taken ideas from various fonts/character sets but re-implemented the actual driver code.

I based my library module for this on a standard Arduino library for the Hitachi HD44780 chip, LiquidCrystal.cpp. The programs included here are HelloWorld_mx300.ino, LiquidCrystal_mx300.cpp and LiquidCrystal_mx300.h.

The command set is compatible with the Hitachi HD44780, but I don't know the model of the chip, or even the manufacturer.

Hardware description

LCD pixel layoutThe controller is mounted directly on the LCD glass (CoG), and the LCD module has a 14 pin, 0.04” pitch, PCB flex cable. The displays are two lines of twenty, 5 by 8 pixel, characters with no gap between lines.

I experimented a little, but could not get the modules to display a 5 by 11 character mode. I have no idea whether the modules have inbuilt double-height characters, I have no idea of the controller chip they use. I do note that the Canon MX300 printers display double-height numeric characters mixed with normal characters - I expect they are using the programmable character set to do this.



Arduino to LCD wiring

As used in the Canon MX300 printer these displays use 3.3V for command and data lines and have a separate 5V line for the LCD power. The interface control lines are standard Hitachi HD44780 compatible, with a choice of connecting either 8 or 4 data lines. For testing I used level converters to connect to a standard 5V Arduino, you could of course just use a 3.3V Arduino board.

There is no contrast adjustment on these modules (it may be a command programmable feature).

The control and data pins can be any available Arduino pins.

LCD library

As mentioned earlier the library is based on a standard Arduino HD44780 LCD library. Most hardware commands, including programmable characters, seem to be compatible with the Hitachi HD44780. I did find commands for transforming the orientation of the display, you can reflect it horizontally, vertically or both at once (equivalent to a 180 degree rotation), but I would need to do a lot of experimentation to find all the extended commands.

There are a number of different implementations here, reflecting different approaches :

The drivers still contain the standard Hitachi HD44780 functions, but some are not really applicable to the double height characters. The functions implemented that are specific to these modules and displaying double height characters are:

The autoscroll() function doesn't use the controller's auto-scroll feature, but implements it using left-shift commands and will allow you to continue printing and scrolling a ticker-tape display for as long as you like. Or you can fill the 40 character buffer (about 10 double-height alphanumeric characters) and scroll a banner using scrollDisplayLeft() or scrollDisplayRight() as long as you like.

The existing functions that are still there, but may have unwanted side effects when used with double-height characters are:

The functions appear to be the same as for the HD44780 but have not been extensively tested for compatibility.

As per earlier drivers, I have modified the createChar() routine to switch back to display ram after defining each character to avoid accidentally corrupting the programmable characters (this is a problem from the original LiquidCrystal.h library). In most versions of this driver all programmable characters are in use, so are not available for additional user-defined characters.

— Set of double-height, single-width, digits just using the programmable character set
This library version has a character set of 10 double-height, 1 character wide, numeric digits. To facilitate printing numbers you can also print a space, decimal point, minus sign and colon in double-height mode.

Each half (upper and lower) of each double height character is formed by one custom programmed user-defined LCD character. A second font option also uses a few existing LCD characters from the controller's built-in font, which frees up one of the custom characters for other uses. A custom programmed spreadsheet was used to define and edit the font. Sheet2 of the spreadsheet contains array definitions suitable for copying directly into the Arduino C driver source code. The custom user-defined LCD characters, used as parts of the double-height font, are defined by eight arrays of 8 bytes - one byte per row for the 8 row x 5 pixels.

The double-height font is defined by an array of 2 bytes per digit (upper and lower halves), times 10 digits.

Two different sets of segment definitions are used here to demonstrate two different fonts.

ASCII “user” defined characters for Font1




Canon MX300 LCD
Double height numeric Font1



ASCII “user” defined characters for Font2




Canon MX300 LCD
Double height numeric Font2


Canon MX300 LCD
Double height numeric Font2 alternative using one fewer programmable characters



The programs (v1.01):

— Set of double-height, single-width, digits which are stretched versions of the normal digits, dynamically reprogramming the programmable characters as required
This library version has a character set of 10 double-height, 1 character wide, numeric digits.

Each digit has its own full 5 pixel wide by 16-pixel high definition - ie these fonts are not made up of segments assembled for each character, instead every one of the forty pixels can be used to define each character. So each character is defined by two arrays of eight bytes, one array for the upper half and one for the lower half of each character. These character definitions are dynamically programmed into the character generator each time a digit is printed. The downside is only 4 different double-height characters can be displayed at once, and this code arbitrarily limits them to being 4 consecutive positions on the LCD display.

If you attempt to print a non-digit (eg an alphabetic character) in double-height mode , it will just print it as a single height character on the second line. This program could be expanded into a full alpha/numeric character set, but the character definitions would take up a lot of Arduino RAM (96 times 16 bytes).

Canon MX300 LCD
Double height numeric Font3

The full double-height dynamic custom digit set.

The programs (v1.01):

— Complete ASCII character sets

This library version has a character set of 96, double-height, 1 to 4 character wide, alphanumeric characters. For legibility a space is needed after each double height character, it is added automatically. So double-height characters take up 2 to 5 LCD character spaces, hence as few as 4, but typically 5 or 6, of these characters fit on the display. All the double-height numeric digits are 3 characters wide, so 5 can fit on the display, and timer displays etc are easy to program.

The segments of each double height character are made up of custom programmed user-defined LCD characters and a few existing LCD characters from the controller's built-in font. A custom programmed spreadsheet was used to define and edit the font. Sheet2 of the spreadsheet contains array definitions suitable for copying directly into the Arduino C driver source code. The custom user-defined LCD characters, used as segments for the double-height font, are defined by eight arrays of 8 bytes - one byte per row for the 8-row x 5-pixel segment definitions.

The double-height font is defined by an array of 8 bytes per character (2 rows of 4 segments per character), times 96 characters - a bit wasteful in the context of an Arduino! This could be optimised a lot for a real Arduino application, but would require more complicated coding, and this is really just a proof of concept driver to see how things look.

Two different sets of segment definitions are used here to demonstrate two different fonts.

This font uses rounded segments to draw the characters,
based on a font described by digimike on https://forum.arduino.cc/index.php?topic=8882.0
ASCII “user” defined character segments for Font1.


The complete alpha-numeric Font1.
Spreadsheet used to design the font.

Font1 test
Font1 demonstrated by the HelloWorld_mx300.ino program
(Font has been modified since this was created, see PDF for latest version)



This font has descenders for the lowercase g, j, p, q, and y.

ASCII “user” defined character segments for Font2.


The complete alpha-numeric Font2.
Spreadsheet used to design the font.

Font2 test
Font2 demonstrated by the HelloWorld_mx300.ino program
(Font has been modified since this was created, see PDF for latest version)



The programs (v1.01):

References and Additional Resources

Other Arduino LCD drivers

If any referenced page no longer exists, try looking for its URL on http://archive.org.


 Home Page   About this Site   Copyright Questions   Contact Us