okDigitDisplay (Wire Out)

This component allows a flexible way to display numerical information to your design.  The okDigitDisplay is simply a read-only (Wire Out) version of the okDigitEntry.  Just like the okDigitEntry, its endpoint attachment can span multiple Wire Out endpoints as necessary (according to the ‘maxvalue’ setting).

ELEMENTTYPEDESCRIPTION
positionPOSITIONPosition of the top left corner.
sizeSIZESize in pixels.
labelTEXTLabel text, shown inside the button.
tooltipTEXTTooltip text.
endpointHEX BYTEEndpoint address for the corresponding Wire Out.  The display will span multiple consecutive endpoints as necessary.
bitNUMBERThis bit on the endpoint is the LSB for the display.
maxvalueBIGNUMBERThe maximum allowed value in the display.
radixNUMBERNumerical radix of the entry (2, 8, 10 [default], or 16).

XML Example

<object class="okDigitDisplay"> <position>5,215</position> <size>200,30</size> <maxvalue>65535</maxvalue> <radix>16</radix> <endpoint>0x20</endpoint> <bit>0</bit> </object>
Code language: HTML, XML (xml)

Lua Scripting

This component supports executing a script function when the value of the specified bit of the given endpoint changes. By default, the digits displayed by the control will also be updated, however this can be prevented by calling event:PreventDefault() as described in the “Default Behaviour” section of FrontPanel Scripting.

Notice that this component can also be used as a standalone indicator, not bound to any input wire. In this case it must have a name, so that it can be used by the other script functions, as otherwise it would be perfectly unusable.

The event parameter of the script function provides GetValue() method returning the numeric value corresponding to the new wire in value.

The digitdisplay object, provided to the script function, or returned by FindDigitDisplay() method of the panel object, provides the same additional methods as okDigitEntry component, please see their description there.

Here is an example of a function showing the doubled value of a device wire value in the okDigitDisplay which is connected to the device wire out and also showing the actual value in another okDigitDisplay component used in “manual” mode:

Lua:

function OnDigitDisplay(dd, event) local device = event:GetDevice() local value = device:GetWireOutValue(0x20) -- Double the value displayed. dd:SetValue(value * 2) -- And prevent it from being updated by default, as this -- would override the value set above. event:PreventDefault() -- And also set the actual value in another control. okUI:FindPanel("panel1"):FindDigitDisplay("actual_value"):SetValue(event:GetValue()) end
Code language: PHP (php)

All XML components that support Lua scripting also inherit from the Control class. Please refer to the FrontPanel Scripting documentation for more information on this class.

Example Screenshot