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.
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 number of bits required to represent this value defines the number of bits of the endpoint to display. It also limits the numerical display to this value. It is recommended to always use the 2^n – 1 values for the desired number of endpoint bits to display. This value is in base 10.
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())
endCode 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