Noritake itron - The brighter side of electronics

Noritake itron GU-U100 Code Library

Document Number: E-M-0110-00
Issue Date: 05/18/2012

Noritake Co., Inc.
Electronics Division Headquarter
2635 Clearbrook Drive
Arlington Heights, IL 60005
Toll free: (800) 779 - 5846
Phone: (847) 439 - 9020
support.ele@noritake.com
www.noritake-elec.com
East Coast
New Jersey Branch
15-22 Fair Lawn Ave.
Fair Lawn, NJ 07410
Toll free: (888) 296 - 3423
Phone: (201) 475 - 5200
Fax: (201) 796 - 2269
Midwest, Canada, and Mexico
Chicago Branch
2635 Clearbrook Dr.
Arlington Heights, IL 60005
Toll free: (800) 779 - 5846
Phone: (847) 439 - 9020
Fax: (847) 593 - 2285
West Coast
Los Angeles Branch
21081 S. Western Ave. Ste 180
Torrance, CA 90501
Toll free: (888) 795 - 3423
Phone: (310) 320 - 1700
Fax: (310) 320 - 2900

You must agree this terms and conditions. This software is provided by Noritake Co., Inc "AS IS" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or sort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.

If this document is distributed with software that includes an end user agreement, this document, as well as the software described in it, is furnished under license and may be used or copied only in accordance with the terms of such license. Except as permitted by any such license, no part of this document may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, recording, or otherwise, without the prior written permission of Noritake Co., Inc. Please note that the content in this document is protected under copyright law even if it is not distributed with software that includes an end user license agreement.

The content of this document is furnished for informational use only, is subject to change without notice, and should not be construed as a commitment by Noritake Co., Inc. Noritake Co., Inc. assumes no responsibility or liability for any errors or inaccuracies that may appear in the informational content contained in this document.

Any references to company names in sample codes are for demonstration purposes only and are not intended to refer to any actual organization.

Noritake and Itron are either registered trademarks or trademarks of Noritake Co., Inc. in the United States and/or other countries.

© 2012 Noritake Co., Inc. All rights reserved

Noritake Co., Inc., 2635 Clearbrook Drive, Arlington Heights, IL 60005, USA.

Contents

About

The GU-U100 is a graphic vacuum fluorescent display module meant to replace graphic LCDs based on the KS0108 chipset.

On top of supporting all of the common KS0108 commands, GU-U100 adds the unique features of screen brightness and power save mode.

Replacing LCDs

Code written for KS0108 can be used to control the GU-U100.

Depending on the LCD being replaced, slight modifications may be necessary.

The direction of chip select (CS) or slave select (SS) may be different. The GU-U100's parallel interface chip select is active high, meaning the device accepts commands only when CS is 1. Some LCDs expect chip select to be active low, meaning the device is active only when CS is 0.

The number of display segment driver chips may be different. If the code was written for more chips than is available on the GU-U100, only the left-most or top-most portions of the expected screen image will be visible.

Hardware Operation

Display Segment Driver Chips

The display is divided into 64×64-dot segments arranged horizontally in horizontal mode and vertically in vertical mode. Each of these segments is controlled by a separate chip. GU128x64E-U100 has two chips.

These chips do not communicate information such as the display memory or current x and y position. These must be set specifically for each chip. However, screen brightness and power save mode affect the whole module and are shared.

The first chip controls the left side of the screen in horizontal mode and the top half in vertical mode. The second chip controls the right side in horizontal mode and the bottom half in vertical mode. Both chips cannot be accessed simultaneously.

Memory Layout

Horizontal Mode

Memory layout diagram

The address and bit value are calculated:

page = y/8
bit = 1 << y%8
addr = page*64 + x

Each controller has a 64×64-dot memory buffer representing half of the image on the screen.

  • Each dot is represented by one bit in memory
  • Memory is accessed by bytes (8 bits)
  • The lowest bit represents the top-most dot
  • Each byte represents 8 vertical dots
  • Bytes are laid out horizontally
  • Each page (64 bytes) represents one row: 64×8 dots
  • The next page (starting from byte 64) represents the next vertical 8 dots

Vertical Mode

Memory layout diagram

The address and bit value are calculated:

page = x/8
bit = 1 << x%8
addr = page*64 + y

Each controller has a 64×64-dot memory buffer representing half of the image on the screen.

  • Each dot is represented by one bit in memory
  • Memory is accessed by bytes (8 bits)
  • Each byte represents 8 horizontal dots
  • The lowest bit represents the right-most dot
  • Bytes are laid out vertically
  • Each page (64 bytes) represents one row: 8×64 dots
  • The next page (starting from byte 64) represents the next horizontal 8 dots

Reading and Writing

Each chip keeps track of the current X and Y values (called the cursor).

After every memory read or write is executed, the X counter increments. After X is 63, the counter wraps back around to 0. The Y counter is not changed.

The library increments and wraps the value of Y after wrapping in the X direction.

Library Setup

Installation

This library is written for Atmel AVR microcontrollers.

Demo projects use AVR Studio 4 and Atmel Studio 6.

  1. Download the code library.
  2. Unzip the library file to your work area.
  3. Extract the demo folder into the folder for the GU-U100 code library.
  4. Set the configuration options in config.h included with the code library. See the Configuration section.
  5. Open the Demo.aps project file with AVR Studio 4
    or Demo.atsln in Atmel Studio 6.

Configuration

The library is configured by setting preprocessor values in the config.h file in the src directory of the library.

The library provides support for using the module in either of two modes: horizontal or vertical. Define NORITAKE_VERTICAL to match the mode:

Consult the module specification for setting the jumpers to select the interface.

GU-U100 offers parallel and serial interfaces. The interface is controlled by NORITAKE_INTERFACE.

The library must be told which pins connect the host to the module. Each signal has a preprocessor variable ending with _PORT and _PIN.

E.g. for the chip select 1 pin:

    #define CS1_PIN     3
    #define CS1_PORT    PORTA

Parallel

#define DATA_PORT   PORTD
#define RS_PIN      0
#define RS_PORT     PORTA
#define RW_PIN      1
#define RW_PORT     PORTA
#define E_PIN       2
#define E_PORT      PORTA
#define CS1_PIN     3
#define CS1_PORT    PORTA
#define CS2_PIN     4
#define CS2_PORT    PORTA
#define RESET_PIN   5
#define RESET_PORT  PORTA

Parallel is the fastest interface but uses the most pins. Each signal is controlled by a separate pin.

Code that was written for LCDs will use the parallel interface. Minor modifications may be necessary as discussed in the Replacing LCDs section.

  • DATA - data bits 0 - 7 (must be on pins 0 - 7 of given port)
  • RS - command (0) / data (1) signal
  • RW - write (0) / read (1) signal
  • E - enable signal
  • CS1 - chip select 1 (left side or top)
  • CS2 - chip select 2 (right side or bottom)
  • RST - reset module, active low

Serial Interface Type 1: CU-UW

#define SIO_PIN     4
#define SIO_PORT    PORTG
#define CS_PIN      7
#define CS_PORT     PORTB
#define SCK_PIN     3
#define SCK_PORT    PORTG
#define RESET_PIN   0
#define RESET_PORT  PORTA

This interface uses the minimum number of pins, but requires up to two bytes to be sent per data item or command. Data is input and output over the same line.

SI/SO, CS, SCK, and RST lines are used.

The CS (chip select) here is for the entire module. It is not the same as CS1 or CS2.

A status byte must be sent when CS is lowered. This status byte sets the state of CS1, CS2, RW, and RS. Commands and data may be sent continuously without re-sending this status byte until CS is raised or the status of CS1, CS2, RW, or RS needs to change. After this, commands and data bytes are sent or received.

  • SIO - I/O pin
  • CS - module chip select (not to be confused with CS1 and CS2)
  • SCK - synchronous serial clock
  • RST - reset module, active low

Serial Interface Type 2: SPI

#define SO_PIN      4
#define SO_PORT     PORTG
#define SCK_PIN     3
#define SCK_PORT    PORTG
#define RESET_PIN   0
#define RESET_PORT  PORTA
#define CS2_PIN     1
#define CS2_PORT    PORTA
#define CS1_PIN     2
#define CS1_PORT    PORTA
#define SI_PIN      3
#define SI_PORT     PORTA

This interface allows you to use the module on an SPI bus as two slave devices selected by CS1 and CS2. Data is sent to the module on a separate line from data received from the module.

SO, SCK, RST, CS1, CS2, and SI lines are used.

A status byte similar to the Type 1 interface must be sent to change RW and RS.

  • SO - output (data/status) sent from the module to the host
  • SCK - synchronous serial clock
  • RST - reset module, active low
  • CS1 - chip select 1 (left side or top), active low
  • CS2 - chip select 2 (right side or bottom), active low
  • SI - input (data/commands) sent to the module from the host

Serial Interface Type 3: Signal Separate

#define RS_PIN      7
#define RS_PORT     PORTB
#define SCK_PIN     3
#define SCK_PORT    PORTG
#define RESET_PIN   0
#define RESET_PORT  PORTA
#define CS2_PIN     1
#define CS2_PORT    PORTA
#define CS1_PIN     2
#define CS1_PORT    PORTA
#define SI_PIN      3
#define SI_PORT     PORTA

This has the potential to be the fastest serial interface since no status byte ever need be sent.

Since there is no pin to output from the module, many methods may be restricted in use since they rely on reading the display memory.

This interface is primarily useful for simple or pre-rendered high-speed animation with fewer pins than the parallel interface.

RS, SCK, RST, CS1, CS2, and SI lines are used.

  • RS - command (0) / data (1) signal
  • SCK - synchronous serial clock
  • RST - reset module, active low
  • CS1 - chip select 1 (left side or top), active high
  • CS2 - chip select 2 (right side or bottom), active high
  • SI - input (data/commands) sent to the module from the host

Method Reference

Convenience Methods

uint8_t align(uint8_t v);

Align a value to the next highest 8-dot block (i.e. values that are not divisible by 8 are rounded up).

In horizontal mode, y values need to be aligned; x values need to be aligned in vertical mode.

v value to align

Returns: Aligned value.

uint8_t clip(uint8_t v);

Align a value to the previous 8-dot block (i.e. values that are not divisible by 8 are rounded down).

In horizontal mode, y values need to be aligned; x values need to be aligned in vertical mode.

v value to clip

Returns: Clipped value.

uint8_t fontAdvance();

Get the font width including the gutter space. The cursor will be moved horizontally by this amount when working with text-based methods.

Returns: Advance width of the font: fontWidth + fontGutter

Primitives

void init();

Initialize the module.

This must be called after reset().

Module State:

  • x = 0
  • y = 0
  • display = on
  • power save mode = off
  • brightness = 100%
  • font = NULL
  • fontWidth = 0
  • fontHeight = 0
  • fontGutter = 1

void reset();

Reset the module.

After a reset, call init() before any other method.

void command(uint8_t bits, bool chip);

Send a command to the module. The command's bit patterns are detailed in the module's specification.

Use caution when sending commands.

The library does not attempt to understand commands. If a setting on the module is changed, the member variables of the library should be updated to reflect those changes.

bits command to send
chip chip to send the command to

void setCursor(uint8_t x, uint8_t y);

If the cursor is already at the given position, no command is sent to the module.

Set the cursor to (x, y).

If (x, y) is beyond the limits of the screen, the request is ignored.

In horizontal mode, the cursor in the module only accepts y values aligned to 8-dot blocks; x values must be aligned in vertical mode. In either case, if not divisible by 8, the value is rounded down when used with writeData() and readData().

Other methods compensate for the misalignment.

x x coordinate: 0 ≤ x < WIDTH
y y coordinate: 0 ≤ y < HEIGHT

void writeData(uint8_t data);

Write to the display memory at the cursor position.

In horizontal mode, if the cursor y was not divisible by 8, then it is rounded down to the previous 8-dot block and all 8 dots of the block will be overwritten.

This increments the x counter and causes wrapping. If x was 127, then x will be 0 and y will be y+8. If y is greater than 64, y wraps to 0.

In vertical mode, if the cursor x was not divisible by 8, then it is rounded down to the previous 8-dot block and all 8 dots of the block will be overwritten.

This increments the y counter and causes wrapping. If y was 127, then x will be 0 and x will be x+8. If x is greater than 64, x wraps to 0.

data data to write to the display memory

uint8_t readData();

Serial interface type 3 always returns 0.

Read from the display memory at the cursor position.

In horizontal mode, if the cursor y was not divisible by 8, then it is rounded down to the previous 8-dot block and all 8 dots of the block will be overwritten.

This increments the x counter and causes wrapping. If x was 127, then x will be 0 and y will be y+8. If y is greater than 64, y wraps to 0.

In vertical mode, if the cursor x was not divisible by 8, then it is rounded down to the previous 8-dot block and all 8 dots of the block will be overwritten.

This increments the y counter and causes wrapping. If y was 127, then x will be 0 and x will be x+8. If x is greater than 64, x wraps to 0.

Returns: Data read from the display memory.

uint8_t peek(uint8_t x, uint8_t y);

Serial interface type 3 always returns 0.

Read from the display memory at the given position. setCursor(x, y) is called before and after readData().

Returns: The data read from the display memory at the given position.

uint8_t readStatus(bool chip);

Serial interface type 3 always returns 0.

Read the status of the chip.

Returns: Chip status as a combination of:

  • 0x80 - Busy
  • 0x20 - Chip Off
  • 0x10 - Resetting

void setScreenBrightness(uint8_t percent);

This will bring the module out of power save mode.

Set screen brightness.

percent brightness value: 13% ≤ percent < 100%.

Percentages are rounded up to the next selectable value:

  • 100%
  • 87.5%
  • 75%
  • 62.5%
  • 50%
  • 37.5%
  • 25%
  • 12.5%

void displayOff(bool powerSave);

Power save mode consumes less power than both turning all dots off and turning the display off but requires more time to turn back on.

Turn the display off.

powerSave true enables power save mode; false disables power save mode

void displayOn();

Turn the display on after it has been turned off. This will also disable power save mode.

Character-Based Movements

void back();

See fontAdvance().

Move the cursor back by one character width in the current font. If the cursor is within one character width of the start of a line, the cursor moves to the end of the previous line. If the cursor was within one character width of (0, 0), it is moved to (0, 0).

This can also be used by printing '\b'.

void carriageReturn();

Move the cursor to the beginning of the current line.

This can also be used by printing '\r'.

void crlf();

Move the cursor to the beginning of the next line as though carriageReturn() and lineFeed() were called.

This can also be used by printing "\r\n".

void forward();

See fontAdvance().

Move the cursor forward by one character width in the current font. If the cursor is within one character width of the right edge of the screen, the cursor is moved to the beginning of the next line. If the cursor is at the end of the display, the cursor is moved to (0, 0).

This can also be used by printing '\t'.

void home();

Move the cursor to (0, 0).

This can also be used by printing '\x0b'.

void lineFeed();

Move the cursor to the next line. If on the last line of the display, the cursor is moved to (0, 0).

This can also be used by printing '\n'.

Printing

Setting Font

This sets the current font, its width, and its height.

See the drawImage().

Each character is a width×height bitmap. The bitmaps for each character defined must come one after another (aligned to bytes) in Flash ROM (program ROM). Characters from 0x20 to 0xff may be defined.

data data for characters in bitmap format in Flash ROM (program ROM)
width width of each character not including gutter space
height height of each character
gutter the width of empty space between characters

void setFont(const uint8_t *data, uint8_t width, uint8_t height);
void setFont(const uint8_t *data, uint8_t width, uint8_t height, uint8_t gutter);

Printing Characters and Strings

There are many variations of the print method. Variations that end with _p print from the Flash ROM (program ROM) of the host. Variations that end with ln print and then go to the next line as if carriageReturn() and lineFeed() had been called.

When used with serial interface type 3, all 8-dot groups that the character touches will be cleared.

The background the size of fontAdvance()×fontHeight is cleared before drawing the character. The bottom dots of the bottom group of 8 vertical dots are preserved if the font height is not a multiple of 8. E.g. if the font is defined to be 10 dots high, the top 10 dots are cleared, and the bottom 6 are left untouched.

See fontAdvance().

When the cursor is within one character width of the end of the screen, text is wrapped to the next line as though crlf() was called.

See Character-Based Movements and clearScreen().

Characters below 0x20 are control characters. Any control character that is not defined is ignored.

void print(char c);
void print(const char *buffer, size_t size);
void print(const char *str);
void print_p(const char *buffer, size_t size);
void print_p(const char *str);
void println(char c);
void println(const char *buffer, size_t size);
void println(const char *str);
void println_p(const char *buffer, size_t size);
void println_p(const char *str);

Printing Numbers

Print a number max characters long.

The fill character is inserted on the left if the number has less than max digits.

  • ' ' (Space) right-aligns
  • '0' prefixes the number with zeroes
  • 0 prints only the necessary digits

bool numberString(char buf[10], unsigned long number, uint8_t max, char fill);
bool print(int number, uint8_t max, char fill);
bool print(long number, uint8_t max, char fill);
bool print(unsigned long number, uint8_t max, char fill);
bool print(unsigned number, uint8_t max, char fill);

Returns: false and does not print any characters if:

  • max is > 10
  • number requires more than max digits

Printing Numbers in Bases

Print a number in the given base.

number number to print
base base to print in; 2 ≤ base ≤ 36

bool print(int number, uint8_t base);
bool print(long number, uint8_t base);
bool print(unsigned long number, uint8_t base);
bool print(unsigned number, uint8_t base);

Graphics

void clearScreen();

Clear the screen and move the cursor to (0, 0).

This can also be used by printing '\x0c'.

Inverting Colors

void invertOn()
void invertOff();

Invert the colors of drawing methods.

Only dots written after this call are affected. The existing screen image does not change.

void setDot(uint8_t x, uint8_t y, bool on);

This should not be used from serial interface type 3. Setting multiple dots in the same 8-dot group will overwrite existing dots.

Set the dot at (x, y).

If (x, y) is beyond the limits of the screen, the request is ignored.

x x coordinate: 0 ≤ x < WIDTH
y y coordinate: 0 ≤ y < HEIGHT

void drawCircle(uint8_t cx, uint8_t cy, uint8_t radius, bool on);

This should not be used from serial interface type 3.

Draw a circle centered at (cx, cy) with the given radius.

Dots beyond the limits of the screen are ignored.

cx x coordinate: 0 ≤ cx < WIDTH
cy y coordinate: 0 ≤ cy < HEIGHT
radius radius of the circle:
0 ≤ cx-radius ≤ WIDTH
0 ≤ cx+radius ≤ WIDTH
0 ≤ cy-radius ≤ HEIGHT
0 ≤ cy+radius ≤ HEIGHT
on true lights dots; false turns dots of the circle off

Drawing Images

Memory is laid out as in Memory Layout in Hardware Operation; however, bitmaps are not limited to 64×64-dot blocks.

Draw an image from (x, y) to (x+width, y+height). data is a pointer to Flash ROM (program ROM) image data.

In horizontal mode, the width must be less than or equal to the image width in memory, stride. The height may be less than the total image height in memory.

Dots beyond the limits of the screen are ignored.

In vertical mode, the height must be less than or equal to the image height in memory, stride. The width may be less than the total image width in memory.

Dots beyond the limits of the screen are ignored.

When used with serial interface type 3, all 8-dot groups that the images touches will be cleared.

Dots in the same 8-dot group but not inside the specified rectangle are preserved when the image is drawn so that its y values are not divisible by 8.

void drawImage(const uint8_t *data, uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t stride);
void drawImage(const uint8_t *data, uint8_t x, uint8_t y, uint8_t width, uint8_t height);

data Image data in the same format as display memory
x x coordinate: 0 ≤ x < WIDTH
y y coordinate: 0 ≤ y < HEIGHT
width width to draw to screen: 0 ≤ x+width ≤ stride ≤ WIDTH
height height to draw to screen: 0 ≤ y+height ≤ HEIGHT
stride the width of the bitmap in memory in horizontal mode
the height of thebitmap in memory in vertical mode

void drawLine(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, bool on);

This should not be used from serial interface type 3.

Draw a line from (x1, y1) to (x2, y2).

Dots beyond the limits of the screen are ignored.

x1 start x coordinate: 0 ≤ x1 < WIDTH
y1 start y coordinate: 0 ≤ y1 < HEIGHT
x2 end x coordinate: 0 ≤ x2 < WIDTH
y2 end y coordinate: 0 ≤ y2 < HEIGHT
on true lights dots; false turns dots of the line off

void drawRect(uint8_t x1, uint8_t y1, uint8_t width, uint8_t height, bool on);

This should not be used from serial interface type 3.

Draw the outline of a rectangle from (x1, y1) to (x2, y2).

Dots beyond the limits of the screen are ignored.

x x coordinate: 0 ≤ x < WIDTH
y y coordinate: 0 ≤ y < HEIGHT
width width: 0 ≤ x+width ≤ WIDTH
height height: 0 ≤ y+height ≤ HEIGHT
on true lights dots; false turns dots of the rectangle off

void fillRect(uint8_t x1, uint8_t y1, uint8_t width, uint8_t height, bool on);

This should not be used from serial interface type 3 unless the rectangle begins and ends on vertical dots that are divisible by 8.

Fill the rectangle from (x1, y1) to (x2, y2).

Dots beyond the limits of the screen are ignored.

x x coordinate: 0 ≤ x < WIDTH
y y coordinate: 0 ≤ y < HEIGHT
width width: 0 ≤ x+width < WIDTH
height height: 0 ≤ y+height < HEIGHT
on true lights dots; false turns dots of the rectangle off