start

MIOS LCD Offsets

Some words by TK in response to this question:

The display offsets are handled by MIOS in a way which allows to use the same cursor positions on any kind of LCD. With MIOS_LCD_YAddressSet the LCD specific cursor offsets are mapped to the MIOS specific cursor offsets.

64 characters (0×40) are reserved for each line, up to 4 lines are (natively) supported:
1st line begins at 0×00
2nd line begins at 0×40
3rd line begins at 0×80
4th line begins at 0xc0

And these lines have to be mapped to the real address offsets of your LCD - this can normaly be found in the datasheet, the most common cases are documented in the functional description of MIOS_LCD_YAddressSet: http://www.ucapps.de/mios_fun.html#MIOS_LCD_YAddressSet

For a 2×40 following settings are working:
Y0: 0×00
Y1: 0×40
Y2: doesn’t matter (*)
Y3: doesn’t matter (*)

(*) note: if a value between 0×80...0xff is specified here, it is assumed that the 3rd and 4th line is mapped to a second LCD

Centering the screen just means to add additional offsets to these addresses, e.g. let’s say you’ve a 2×40 display, but only 16 columns are used, this means that you need to add 12 to each offset:
Y0: 0×00 + (40-16)/2
Y1: 0×40 + (40-16)/2
Y2: doesn’t matter (*)
Y3: doesn’t matter (*)

Thats how MIOS supports LCDs.