Author | Andre Miller Copyright © 2008..2021, all rights reserved. |
Adapted-by | Richard Zengerink, Sebastien Lelong, Paul D'haene, Rob Jansen |
Compiler | 2.5r5 |
library for Nokia 3310/5510 display with pcd8544 controller.
Data sheet PCD8544.
const byte GLCD_X_PIXELS = 84
const GLCD_WHITE = 0xFF
const byte GLCD_COLOR_BITS = 1
var byte glcd_background_color = GLCD_WHITE
var word glcd_lo_watermark = CACHE_SIZE - 1
const byte GLCD_Y_PIXELS = 48
var byte glcd_pen_color = GLCD_BLACK
var word glcd_hi_watermark = 0
const word CACHE_SIZE = word(GLCD_X_PIXELS) * word(GLCD_Y_PIXELS/8)
var bit glcd_cache_changed = TRUE
const GLCD_XOR = 0x01
const GLCD_BLACK = 0x00
nokia_contrast(byte in contrast)
nokia_goto(byte in x, byte in y)
nokia_clear_screen()
glcd_write_pixel(byte in x, byte in y)
graphic_to_nokia(byte in graph[])
nokia_init()
glcd_cache_update()
glcd_clear_cache()
glcd_write_char(byte in x, byte in y, byte in char)
_nokia_glcd_write(byte in value)
_nokia_glcd_write_command(byte in value)
_nokia_glcd_write_data(byte in value)
const byte GLCD_X_PIXELS = 84
GLCD specifications
const GLCD_WHITE = 0xFF
No documentation found
const byte GLCD_COLOR_BITS = 1
monochrome display
var byte glcd_background_color = GLCD_WHITE
Default background color
var word glcd_lo_watermark = CACHE_SIZE - 1
track current changed (dirty) area
const byte GLCD_Y_PIXELS = 48
No documentation found
var byte glcd_pen_color = GLCD_BLACK
Default pen color
var word glcd_hi_watermark = 0
No documentation found
const word CACHE_SIZE = word(GLCD_X_PIXELS) * word(GLCD_Y_PIXELS/8)
Cache definition
var bit glcd_cache_changed = TRUE
No documentation found
const GLCD_XOR = 0x01
this color is a special, internal to this library (not part of controller specs). When using this color, what's black becomes white (off), what's white becomes black (on)
const GLCD_BLACK = 0x00
colors constants black & white are official value for display controller
nokia_contrast(byte in contrast)
Set display contrast contrast -> value from 0x00 to 0x7F
nokia_goto(byte in x, byte in y)
Set the current position for data (x = 0->83, y = 0->5)
nokia_clear_screen()
Clear the LCD data memory
glcd_write_pixel(byte in x, byte in y)
Plot a pixel at given absolute (x, y) location. x, y -> Absolute pixel coordinates glcd_pen_color should be set before calling, to plot appropriate pixel colors.
graphic_to_nokia(byte in graph[])
prints any bitmap graphics (for instance created with fastLCD http://www.amontec.com/lcd_nokia_3310.shtml) to lcd just create: const byte graphic[] = { graphic max 504 bytes} and call graphic_to_nokia( graphic)
nokia_init()
Send LCD initialization commands
glcd_cache_update()
Copy the changed area of the cache to the lcd. Call this procedure after writing to cache. When the glcd_cache_changed flag has not been set, lcd_cache_update simply returns. Only the cache between the low & high watermark pointers is updated
glcd_clear_cache()
Clear the cache; glcd_cache_update must be called next.
glcd_write_char(byte in x, byte in y, byte in char)
write a char at position (x,y), using font previously selected with glcd_font_use(FONT_ID). Honor glcd_background_color variable, and indirectly glcd_pen_color, such as: * glcd_background_color can be GLCD_BLACK. If so, pen color will be white (inverted) * if glcd_background_color isn't GLCD_BLACK, then background color will be white, and pen color will be white ("normal"). when using glcd_common library, a glcd'put pseudo-variable will be defined, and be called as an output device (eg. glcd = "x")
_nokia_glcd_write(byte in value)
No documentation found
_nokia_glcd_write_command(byte in value)
Write a command byte to the LCD
_nokia_glcd_write_data(byte in value)
Write a data byte to the LCD