Hd44780.CreateCustomCharacter Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
CreateCustomCharacter(Int32, ReadOnlySpan<Byte>) |
Fill one of the 8 CGRAM locations (character codes 0 - 7) with custom characters. |
CreateCustomCharacter(Int32, Byte[]) |
Fill one of the 8 CGRAM locations (character codes 0 - 7) with custom characters. See CreateCustomCharacter(Int32, ReadOnlySpan<Byte>) for details. |
CreateCustomCharacter(Byte, Byte[]) | |
CreateCustomCharacter(Byte, ReadOnlySpan<Byte>) |
Fill one of the 8 CGRAM locations (character codes 0 - 7) with custom characters. |
CreateCustomCharacter(Int32, ReadOnlySpan<Byte>)
Fill one of the 8 CGRAM locations (character codes 0 - 7) with custom characters.
public void CreateCustomCharacter (int location, ReadOnlySpan<byte> characterMap);
abstract member CreateCustomCharacter : int * ReadOnlySpan<byte> -> unit
override this.CreateCustomCharacter : int * ReadOnlySpan<byte> -> unit
Public Sub CreateCustomCharacter (location As Integer, characterMap As ReadOnlySpan(Of Byte))
Parameters
- location
- Int32
Should be between 0 and 7
- characterMap
- ReadOnlySpan<Byte>
Provide an array of 8 bytes containing the pattern
Implements
Remarks
The custom characters also occupy character codes 8 - 15.
You can find help designing characters at https://www.quinapalus.com/hd44780udg.html.
The datasheet description for custom characters is very difficult to follow. Here is a rehash of the technical details that is hopefully easier:
Only 6 bits of addresses are available for character ram. That makes for 64 bytes of available character data. 8 bytes of data are used for each character, which is where the 8 total custom characters comes from (64/8).
Each byte corresponds to a character line. Characters are only 5 bits wide so only bits 0-4 are used for display. Whatever is in bits 5-7 is just ignored. Store bits there if it makes you happy, but it won't impact the display. '1' is on, '0' is off.
In the built-in characters the 8th byte is usually empty as this is where the underline cursor will be if enabled. You can put data there if you like, which gives you the full 5x8 character. The underline cursor just turns on the entire bottom row.
5x10 mode is effectively useless as displays aren't available that utilize it. In 5x10 mode *16* bytes of data are used for each character. That leaves room for only *4* custom characters. The first character is addressable from code 0, 1, 8, and 9. The second is 2, 3, 10, 11 and so on...
In this mode *11* bytes of data are actually used for the character data, which effectively gives you a 5x11 character, although typically the last line is blank to leave room for the underline cursor. Why the modes are referred to as 5x8 and 5x10 as opposed to 5x7 and 5x10 or 5x8 and 5x11 is a mystery. In an early pre-release data book 5x7 and 5x10 is used (Advance Copy #AP4 from July 1985). Perhaps it was a marketing change?
As only 11 bytes are used in 5x10 mode, but 16 bytes are reserved, the last 5 bytes are useless. The datasheet helpfully suggests that you can store your own data there. The same would be true for bits 5-7 of lines that matter for both 5x8 and 5x10.
Applies to
CreateCustomCharacter(Int32, Byte[])
Fill one of the 8 CGRAM locations (character codes 0 - 7) with custom characters. See CreateCustomCharacter(Int32, ReadOnlySpan<Byte>) for details.
public void CreateCustomCharacter (int location, byte[] characterMap);
abstract member CreateCustomCharacter : int * byte[] -> unit
override this.CreateCustomCharacter : int * byte[] -> unit
Public Sub CreateCustomCharacter (location As Integer, characterMap As Byte())
Parameters
- location
- Int32
Should be between 0 and 7
- characterMap
- Byte[]
Provide an array of 8 bytes containing the pattern
Implements
Applies to
CreateCustomCharacter(Byte, Byte[])
CreateCustomCharacter(Byte, ReadOnlySpan<Byte>)
Fill one of the 8 CGRAM locations (character codes 0 - 7) with custom characters.
public void CreateCustomCharacter (byte location, ReadOnlySpan<byte> characterMap);
member this.CreateCustomCharacter : byte * ReadOnlySpan<byte> -> unit
abstract member CreateCustomCharacter : byte * ReadOnlySpan<byte> -> unit
override this.CreateCustomCharacter : byte * ReadOnlySpan<byte> -> unit
Public Sub CreateCustomCharacter (location As Byte, characterMap As ReadOnlySpan(Of Byte))
Parameters
- location
- Byte
Should be between 0 and 7
- characterMap
- ReadOnlySpan<Byte>
Provide an array of 8 bytes containing the pattern
Implements
Remarks
The custom characters also occupy character codes 8 - 15.
You can find help designing characters at https://www.quinapalus.com/hd44780udg.html.
The datasheet description for custom characters is very difficult to follow. Here is a rehash of the technical details that is hopefully easier:
Only 6 bits of addresses are available for character ram. That makes for 64 bytes of available character data. 8 bytes of data are used for each character, which is where the 8 total custom characters comes from (64/8).
Each byte corresponds to a character line. Characters are only 5 bits wide so only bits 0-4 are used for display. Whatever is in bits 5-7 is just ignored. Store bits there if it makes you happy, but it won't impact the display. '1' is on, '0' is off.
In the built-in characters the 8th byte is usually empty as this is where the underline cursor will be if enabled. You can put data there if you like, which gives you the full 5x8 character. The underline cursor just turns on the entire bottom row.
5x10 mode is effectively useless as displays aren't available that utilize it. In 5x10 mode *16* bytes of data are used for each character. That leaves room for only *4* custom characters. The first character is addressable from code 0, 1, 8, and 9. The second is 2, 3, 10, 11 and so on...
In this mode *11* bytes of data are actually used for the character data, which effectively gives you a 5x11 character, although typically the last line is blank to leave room for the underline cursor. Why the modes are referred to as 5x8 and 5x10 as opposed to 5x7 and 5x10 or 5x8 and 5x11 is a mystery. In an early pre-release data book 5x7 and 5x10 is used (Advance Copy #AP4 from July 1985). Perhaps it was a marketing change?
As only 11 bytes are used in 5x10 mode, but 16 bytes are reserved, the last 5 bytes are useless. The datasheet helpfully suggests that you can store your own data there. The same would be true for bits 5-7 of lines that matter for both 5x8 and 5x10.