How to use the instrument control?

freeFree Technical Resource

This content is free to read, suitable for basic learning and search traffic.

How to use the instrument control?

What is a gauge control?

How to use the instrument control?Figure

The dial can reflect data changes on the user's host and meet the user's needs for an instrument interface. It is commonly used to display parameters such as speed and voltage. Our company provides the following two methods to implement

gauge control: as shown in the figure above, suitable for all platforms, gauge control can display the dial

Scope of application: gauge control, full series

Example download link: "<Serial port screen dial application> (click to jump)"

4.1 Introduction to gauge control properties

This section introduces the properties of gauge control. The property window is shown below

How to use the instrument control?Figure1

Starting value

The minimum value of the gauge range, with a minimum of "0"

Ending value

The maximum value of the instrument range, with a maximum of "360", also indicates 0°

Initial value

The value initially indicated by the pointer. When the initial value is set to "45", it is displayed as follows

How to use the instrument control?Figure2

Display value

The scale value on the dial. The option can be selected as "Yes" or "No", and it only takes effect when the "Dial Type" is set to "Self-drawn Dial".

How to use the instrument control?Figure3

Font size

Set the size of the scale values on the dial. If set to 16, it is displayed as follows

How to use the instrument control?Figure4

Color of values

Set the color of the scale values on the dial. If set to yellow, it is displayed as follows

How to use the instrument control?Figure5

Dial type

Divided into "Custom-drawn Dial", "Background Image", and "Transparent", as shown below

Custom-drawn Dial

The default dial type is "Custom Dial", which can display scale values, as shown below

How to use the instrument control?Figure6
Background Image

Background Image: When the dial type is "Background Image", a dial image can be inserted

[Transparency]
  • Starting Angle: The initial pointing angle of the pointer, for example, if the starting angle is set to 180°
  • Ending Angle: The final pointing angle of the pointer on the dial, for example, if the ending angle is set to 0° (360°)
  • Rotation Direction: Divided into "Clockwise" and "Counterclockwise". 1. Clockwise: The pointer moves in a clockwise direction. 2. Counterclockwise: The pointer moves in a counterclockwise direction.

Scale (Custom Dial Mode)

Display Background Color

Display the background color of the dial. Can be selected as "Yes" or "No"

Background Color

Set a solid color background for the dial. This parameter setting is supported when "Display Background Color" is set to "Yes"

Display main line

The main line is the outermost circle of the gauge. Select "Yes" or "No"

Main line color

Set the main line to a single color, such as blue

Main line width

Set the width of the main line, such as "4"

Scale

Set the number of major scales, default is 4 scales

Scale color

Set the single color of the scales, default is red

Scale width

Set the width of the scales, default is 2

Display sub-scale

Select "Yes" or "No"

Sub-scale

Set the number of sub-scales, default is 9 scales

Sub-scale width

Set the single color of the scales, default is red

Sub-scale color

Set the width of the scales, default is 2

Hand type

You can set the type of the hand, which is divided into "straight line", "triangle", and "quadrangle". Default is "triangle", as shown below

How to use the instrument control?Figure7

Hand color

Color of the hand. Default is red

Center Color

The color of the pointer center. The default is gray

4.2 Instrument Control Application

Screen Configuration

Import the corresponding artwork image in the "Background Image" of the "Instrument Control" screen, and add one instrument control (Control ID: 1) and one text control (Control ID: 2) to the screen, as shown below

How to use the instrument control?Figure8

Property Configuration

In the property window of the instrument control, set the "Start Value" to "0", "End Value" to "110", "Initial Value" to "45", "Display Value" to "No", "Dial Type" to "Transparent", "Start Angle" to "180", "End Angle" to "360 (0)", and "Pointer Type" to "Quadrangle". The property configuration is shown below

How to use the instrument control?Figure9

Run Preview

Run the virtual screen, and establish a connection between the VisualTFT software and the virtual screen using a "Virtual Serial Port". Open the "Command Assistant", select "Progress Bar/Gauge/Slider" from the left navigation bar, and set the "Update Progress Bar/Gauge/Slider" command parameters. As in the example routine, control the instrument control (Control ID: 1) in the screen (Screen ID: 0), fill in the "Value" as "60", and click "Send"; or drag the slider in the Command Assistant to set the instrument control value. Similarly, set the text control value to "60". The running effect is shown below

How to use the instrument control?Figure10

Single-chip Program

The user's single-chip program for updating the instrument control, refer to the function declaration in the him.dever.h file and the definition in the him.dever.c file in the development package Keil program. The function definition declaration in the Keil program is shown below

/**********************************************************************
** Function name:    void SetMeterValue (uint16 screen_id,
**                                       uint16 control_id,
**                                       uint32 value)
** Descriptions:设置仪表值
** input parameters: screen_id: 画面ID
**                  control_id: 控件ID
**                       value: 需要设置的控件值
** output parameters:   无
** Returned value:    无
*********************************************************************/
{
    ……
    SetMeterValue(0,1,60);//设置画面0、控件1仪表控件值为60
    ……
}
Related Tags
Put this resource to use in a real project?

Go to the Tool Center for message parsing, CRC verification and device debugging, or submit your requirements for selection and integration advice.

Engineer Membership

Turn this article into actionable debugging resources

After activation, you can use advanced message parsing, resource pack downloads, code examples, engineering cases and priority technical support, suitable for real project delivery.

Unlimited Advanced Tools
Resource & Code Packs
Complete Engineering Case Library
Priority Technical Support

Leave a Reply

Your email address will not be published. Required fields are marked *.