My Projects

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

arduino:mx300_driver_library [2019/01/25 00:50]
tony
arduino:mx300_driver_library [2023/03/12 22:01] (current)
tony
Line 1: Line 1:
-{{:​pilone.png |Cone icon by Fornax, CC-BY-SA 3.0, wikimedia commons}} ((PAGE UNDER CONSTRUCTION)) 
 <​html><​p style="​text-align:​right;">​Published 15 Jan 2019</​p></​html>​ <​html><​p style="​text-align:​right;">​Published 15 Jan 2019</​p></​html>​
 <​html><​p style="​text-align:​center;"><​b><​font size="​6">​Mx300 Driver Library</​font></​b></​p></​html>​ <​html><​p style="​text-align:​center;"><​b><​font size="​6">​Mx300 Driver Library</​font></​b></​p></​html>​
Line 18: Line 17:
 ===== Overview ===== ===== 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 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. 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.+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 ===== ===== Hardware description =====
  
-{{:​electronic:​lcd:​pc263406a.jpg?​50 |LCD pixel layout}}The 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.+{{:​electronic:​lcd:​pc263406a.jpg?​50 |LCD pixel layout}}The 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.+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.
 \\ \\
 \\ \\
Line 41: Line 40:
 The control and data pins can be any available Arduino pins. The control and data pins can be any available Arduino pins.
  
-===== LCD Library ​=====+===== 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.+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 : There are a number of different implementations here, reflecting different approaches :
-  * A set of double height, single width, digits just using the programmable character set +  * A set of double-height, single-width, digits just using the programmable character set 
-  * A set of double height, single width, digits which are stretched versions of the normal digits, dynamically reprogramming the programmable characters as required. ​ This produces more natural looking digits but limits us to displaying four double height digits at a time (two programmable characters per digit, this may be what the Canon MX300 printers do too).  This could be extended to a full character set, but still limited to four double height characters at a time (you can display the same character repeatedly, but only four unique characters). +  * A set of double-height, single-width, digits which are stretched versions of the normal digits, dynamically reprogramming the programmable characters as required. ​ This produces more natural-looking digits but limits us to displaying four double-height digits at a time (two programmable characters per digit, this may be what the Canon MX300 printers do too).  This could be extended to a full character set, but still limited to four double-height characters at a time (you can display the same character repeatedly, but only four unique characters). 
-  * A complete ASCII character set of double height characters, up to 4 normal character spaces wide.  Created using a fixed set of programmable characters, plus some existing characters, as segments of each double height character.+  * A complete ASCII character set of double-height characters, up to 4 normal character spaces wide.  Created using a fixed set of programmable characters, plus some existing characters, as segments of each double height character.
  
 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 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:
Line 80: Line 79:
     * Set orientation to normal or transform the orientation without changing the contents of the display.     * Set orientation to normal or transform the orientation without changing the contents of the display.
  
-The autoscroll() function doesn'​t use the controller'​s ​autoscroll ​feature, but implements it using leftshift ​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 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 existing functions that are still there, but may have unwanted side effects when used with double-height characters are:
    * blink();    * blink();
    * noBlink();    * noBlink();
Line 100: Line 99:
 The functions appear to be the same as for the HD44780 but have not been extensively tested for compatibility. 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.+As per earlier driversI 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**\\ +**--- 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.+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 an eight arrays of 8 bytes - one byte per row for the 8 row x 5 pixels.+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.+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. Two different sets of segment definitions are used here to demonstrate two different fonts.
Line 160: Line 159:
  
  
-**--- Set of double height, single width, digits which are stretched versions of the normal digits, dynamically reprogramming the programmable characters as required**\\ +**--- 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.+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.+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).+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).
 \\ \\
 <​HTML>​ <​HTML>​
Line 176: Line 175:
 </​HTML>​ </​HTML>​
  
-The full double height {{:​electronic:​lcd:​mx300_dh_digits3.pdf|dynamic custom digit set}}.+The full double-height {{:​electronic:​lcd:​mx300_dh_digits3.pdf|dynamic custom digit set}}.
 \\ \\
 \\  \\ 
Line 187: Line 186:
 **--- Complete ASCII character sets**\\ **--- Complete ASCII character sets**\\
  
-This library version has a character set of 96, double height, 1 to 4 character wide, alpha numeric ​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.+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 from 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 an eight arrays of 8 bytes - one byte per row for the 8 row x 5 pixel segment definitions.+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.+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. Two different sets of segment definitions are used here to demonstrate two different fonts.
Line 248: Line 247:
 ]]. ]].
  
 +     * [[:​arduino:​ks0073 driver library|KS0073 SPI LCD]], LCD display panel Arduino driver
      * [[:​arduino:​metp0000 driver library|METP0000]],​ NEC µPD7225 based LCD display panel Arduino driver      * [[:​arduino:​metp0000 driver library|METP0000]],​ NEC µPD7225 based LCD display panel Arduino driver
      * [[:​arduino:​uPD7228 driver library|NEC µPD7228]] and μPD16434 LCD display panels Arduino driver      * [[:​arduino:​uPD7228 driver library|NEC µPD7228]] and μPD16434 LCD display panels Arduino driver