Modbus - Segment Display 4x7 Bricklet

This is the description of the Modbus protocol for the Segment Display 4x7 Bricklet. General information and technical specifications for the Segment Display 4x7 Bricklet are summarized in its hardware description.

API

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

Basic Functions

BrickletSegmentDisplay4x7.set_segments
Function ID:
  • 1
Request:
  • segments – Type: uint8[4], Range: [0 to 127]
  • brightness – Type: uint8, Range: [0 to 7]
  • colon – Type: bool
Response:
  • no response

The 7-segment display can be set with bitmaps. Every bit controls one segment:

Bit order of one segment

For example to set a "5" you would want to activate segments 0, 2, 3, 5 and 6. This is represented by the number 0b01101101 = 0x6d = 109.

The brightness can be set between 0 (dark) and 7 (bright). The colon parameter turns the colon of the display on or off.

BrickletSegmentDisplay4x7.get_segments
Function ID:
  • 2
Request:
  • empty payload
Response:
  • segments – Type: uint8[4], Range: [0 to 127]
  • brightness – Type: uint8, Range: [0 to 7]
  • colon – Type: bool

Returns the segment, brightness and color data as set by set_segments.

Advanced Functions

BrickletSegmentDisplay4x7.start_counter
Function ID:
  • 3
Request:
  • value_from – Type: int16, Range: [-999 to 9999]
  • value_to – Type: int16, Range: [-999 to 9999]
  • increment – Type: int16, Range: [-999 to 9999]
  • length – Type: uint32, Unit: 1 ms, Range: [0 to 232 - 1]
Response:
  • no response

Starts a counter with the from value that counts to the to value with the each step incremented by increment. length is the pause between each increment.

Example: If you set from to 0, to to 100, increment to 1 and length to 1000, a counter that goes from 0 to 100 with one second pause between each increment will be started.

Using a negative increment allows to count backwards.

You can stop the counter at every time by calling set_segments.

BrickletSegmentDisplay4x7.get_counter_value
Function ID:
  • 4
Request:
  • empty payload
Response:
  • value – Type: uint16, Range: [-999 to 9999]

Returns the counter value that is currently shown on the display.

If there is no counter running a 0 will be returned.

BrickletSegmentDisplay4x7.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

Callbacks

BrickletSegmentDisplay4x7.CALLBACK_COUNTER_FINISHED
Function ID:
  • 5
Response:
  • empty payload

This callback is triggered when the counter (see start_counter) is finished.