..
 #############################################################
 # This file was automatically generated on 2015-05-08.      #
 #                                                           #
 # If you have a bugfix for this file and want to commit it, #
 # please fix the bug in the generator. You can find a link  #
 # to the generators git repository on tinkerforge.com       #
 #############################################################


:breadcrumbs: <a href="../../index.html">Home</a> / <a href="../../index.html#software-modbus">Software</a> / Modbus - Segment Display 4x7 Bricklet

.. |device_identifier_constant| unicode:: 0xA0
   :trim:

.. _segment_display_4x7_bricklet_modbus:

Modbus - Segment Display 4x7 Bricklet
=====================================

This is the description of the :ref:`Modbus protocol <llproto_modbus>` for the :ref:`Segment Display 4x7 Bricklet <segment_display_4x7_bricklet>`. General information and technical
specifications for the Segment Display 4x7 Bricklet are summarized in its :ref:`hardware description
<segment_display_4x7_bricklet_description>`.

.. _segment_display_4x7_bricklet_modbus_api:

API
---

A general description of the Modbus protocol structure can be found
:ref:`here <llproto_modbus>`.




Basic Functions
^^^^^^^^^^^^^^^



.. modbus:function:: BrickletSegmentDisplay4x7.set_segments

 :functionid: 1
 :request segments: uint8[4]
 :request brightness: uint8
 :request colon: bool

 :noresponse: no response

 The 7-segment display can be set with bitmaps. Every bit controls one
 segment:
 
 .. image:: /Images/Bricklets/bricklet_segment_display_4x7_bit_order.png
    :scale: 100 %
    :alt: Bit order of one segment
    :align: center
 
 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.
 
.. modbus:function:: BrickletSegmentDisplay4x7.get_segments

 :functionid: 2
 :emptyrequest: empty payload

 :response segments: uint8[4]
 :response brightness: uint8
 :response colon: bool

 Returns the segment, brightness and color data as set by 
 :modbus:func:`set_segments <BrickletSegmentDisplay4x7.set_segments>`.
 


Advanced Functions
^^^^^^^^^^^^^^^^^^

.. modbus:function:: BrickletSegmentDisplay4x7.start_counter

 :functionid: 3
 :request value_from: int16
 :request value_to: int16
 :request increment: int16
 :request length: uint32

 :noresponse: no response

 Starts a counter with the *from* value that counts to the *to*
 value with the each step incremented by *increment*.
 The *length* of the increment is given in ms.
 
 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.
 
 The maximum values for *from*, *to* and *increment* is 9999, 
 the minimum value is -999.
 
 Using a negative increment allows to count backwards.
 
 You can stop the counter at every time by calling :modbus:func:`set_segments <BrickletSegmentDisplay4x7.set_segments>`.
 
.. modbus:function:: BrickletSegmentDisplay4x7.get_counter_value

 :functionid: 4
 :emptyrequest: empty payload

 :response value: uint16

 Returns the counter value that is currently shown on the display.
 
 If there is no counter running a 0 will be returned.
 
.. modbus:function:: BrickletSegmentDisplay4x7.get_identity

 :functionid: 255
 :emptyrequest: empty payload

 :response uid: char[8]
 :response connected_uid: char[8]
 :response position: char
 :response hardware_version: uint8[3]
 :response firmware_version: uint8[3]
 :response device_identifier: uint16

 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' or 'd'.
 
 The device identifier numbers can be found :ref:`here <device_identifier>`.
 |device_identifier_constant|
 


.. _segment_display_4x7_bricklet_modbus_callbacks:

Callbacks
^^^^^^^^^

.. modbus:function:: BrickletSegmentDisplay4x7.CALLBACK_COUNTER_FINISHED

 :functionid: 5

 :emptyresponse: empty payload


 This callback is triggered when the counter (see :modbus:func:`start_counter <BrickletSegmentDisplay4x7.start_counter>`) is
 finished.
 


