This post was last edited by Digital Leaf on 2021-11-21 12:00
In the previous article, SGTools was used to generate a simple interface, so it is easy to use SGTools, and you don’t even need to read any information. However, there are still some complex operations that require the combination of SGTools and command formats.
The first thing to do is to interact with the screen using the serial port. As mentioned before, because it is a standard 232 interface, a USB to 232 cable is required.
Then use Dupont wire to connect the 232 line and the screen.
In the installation directory of SGTools, there is a serial port tool TOPWAY SGTools Command Tools. With this tool, you can find many specific communication protocols.
Of course, you can also use custom instructions to get familiar with related operations, and custom instructions are also suitable for some complex situations that are not defined by the software. Customization is equivalent to an ordinary serial port.
After connecting the screen and turning on the power supply, it is connected
It is very simple to change some strings in real time, display values, etc. You can just operate it directly. If the display is wrong, you can read it back and have a look. I have experienced it many times and found that most of the failures are caused by the failure of data to be sent successfully.
In the SGTools control, there are two operations: curve and drawing board. At first, I didn't understand the difference between them, so I used them interchangeably and took some detours. But later I understood them more thoroughly. The curve control can display curve variables. When the content in the curve variable array is updated, the related curve will be updated in real time on the screen. The screen supports 5 types of curves: point, line, bottom fill, top fill, and area fill.
The curve control needs to be used in conjunction with the curve variable. This is what I made a mistake at the beginning.
This width is multiplied by the point width in the attribute, which I discovered after drawing it several times.
Finally, you can use the drawing command to draw the curve.
The reason why curves and drawing boards are easily confused is that drawing boards are similar to curves. After understanding them, you will find that the way data is filled is different, and the drawing board can draw more types of drawings, not just curves.
First, use the drawing board control to drag out an area where you can draw.
The rest depends on the serial port transmission instructions
Then I thought about the whole complex, and then I thought of the five-pointed star, and then I calculated the coordinates of the five-pointed star for a long time... (a lot of brain cells died), and then converted it into hexadecimal, and then combined it into a serial port command
Fortunately, the five-pointed star was finally drawn
Drawing effect:
Finally, there is the animation control, which is quite interesting. It can display a small animation on some pages to increase the fun of the page content.
Animation not only needs to create an animation range, but also needs to build animation on the left first to configure the animation
In the property page, you can upload resources, further edit them, and preview the final effect (finally there is a control that supports previewing effects )
Animation effects:
SGTools builds a framework, draws the display area of the specified control, and then operates through instructions to be responsible for the specific content. Therefore, it can be found that there is still a lot of room for upgrading SGTools. Some display content, coordinates and so on can be defined synchronously. This way of coexisting with instructions simplifies the initial design and facilitates subsequent changes.