Modbus - OLED 64x48 Bricklet

This is the description of the Modbus protocol for the OLED 64x48 Bricklet. General information and technical specifications for the OLED 64x48 Bricklet are summarized in its hardware description.

API

A general description of the Modbus protocol structure can be found here.

Basic Functions

BrickletOLED64x48.write
Function ID:
  • 1
Request:
  • data – Type: uint8[64], Range: [0 to 255]
Response:
  • no response

Appends 64 byte of data to the window as set by new_window.

Each row has a height of 8 pixels which corresponds to one byte of data.

Example: if you call new_window with column from 0 to 63 and row from 0 to 5 (the whole display) each call of write (red arrow) will write one row.

Display pixel order

The LSB (D0) of each data byte is at the top and the MSB (D7) is at the bottom of the row.

The next call of write will write the second row and so on. To fill the whole display you need to call write 6 times.

BrickletOLED64x48.new_window
Function ID:
  • 2
Request:
  • column_from – Type: uint8, Range: [0 to 63]
  • column_to – Type: uint8, Range: [0 to 63]
  • row_from – Type: uint8, Range: [0 to 5]
  • row_to – Type: uint8, Range: [0 to 5]
Response:
  • no response

Sets the window in which you can write with write. One row has a height of 8 pixels.

BrickletOLED64x48.clear_display
Function ID:
  • 3
Request:
  • empty payload
Response:
  • no response

Clears the current content of the window as set by new_window.

BrickletOLED64x48.write_line
Function ID:
  • 6
Request:
  • line – Type: uint8, Range: [0 to 5]
  • position – Type: uint8, Range: [0 to 12]
  • text – Type: char[13]
Response:
  • no response

Writes text to a specific line with a specific position. The text can have a maximum of 13 characters.

For example: (1, 4, "Hello") will write Hello in the middle of the second line of the display.

You can draw to the display with write and then add text to it afterwards.

The display uses a special 5x7 pixel charset. You can view the characters of the charset in Brick Viewer.

The font conforms to code page 437.

Advanced Functions

BrickletOLED64x48.set_display_configuration
Function ID:
  • 4
Request:
  • contrast – Type: uint8, Range: [0 to 255], Default: 143
  • invert – Type: bool, Default: false
Response:
  • no response

Sets the configuration of the display.

You can set a contrast value from 0 to 255 and you can invert the color (black/white) of the display.

BrickletOLED64x48.get_display_configuration
Function ID:
  • 5
Request:
  • empty payload
Response:
  • contrast – Type: uint8, Range: [0 to 255], Default: 143
  • invert – Type: bool, Default: false

Returns the configuration as set by set_display_configuration.

BrickletOLED64x48.get_identity
Function ID:
  • 255
Request:
  • empty payload
Response:
  • uid – Type: char[8]
  • connected_uid – Type: char[8]
  • position – Type: char, Range: ['a' to 'h', 'z']
  • hardware_version – Type: uint8[3]
    • 0: major – Type: uint8, Range: [0 to 255]
    • 1: minor – Type: uint8, Range: [0 to 255]
    • 2: revision – Type: uint8, Range: [0 to 255]
  • firmware_version – Type: uint8[3]
    • 0: major – Type: uint8, Range: [0 to 255]
    • 1: minor – Type: uint8, Range: [0 to 255]
    • 2: revision – Type: uint8, Range: [0 to 255]
  • device_identifier – Type: uint16, Range: [0 to 216 - 1]

Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.

The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port). A Bricklet connected to an Isolator Bricklet is always at position 'z'.

The device identifier numbers can be found here