CN114706570A - Graphical programming system - Google Patents

Graphical programming system Download PDF

Info

Publication number
CN114706570A
CN114706570A CN202210328901.8A CN202210328901A CN114706570A CN 114706570 A CN114706570 A CN 114706570A CN 202210328901 A CN202210328901 A CN 202210328901A CN 114706570 A CN114706570 A CN 114706570A
Authority
CN
China
Prior art keywords
control
module
code
graphical
programming
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210328901.8A
Other languages
Chinese (zh)
Inventor
史洪玮
王宜怀
张新新
陈林
董迎秋
张加香
刘苏桐
夏子钧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial Technology Research Institute Suqian College
Original Assignee
Industrial Technology Research Institute Suqian College
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial Technology Research Institute Suqian College filed Critical Industrial Technology Research Institute Suqian College
Priority to CN202210328901.8A priority Critical patent/CN114706570A/en
Publication of CN114706570A publication Critical patent/CN114706570A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Computation (AREA)
  • Evolutionary Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a graphical programming system, which comprises: the system comprises an upper computer programming environment unit, an engineering file operation module, an E-Python translation module, a source code compiling module and a serial port updating module; the system comprises an upper computer programming environment unit, an E-Python translation module, a serial port updating module and a lower computer terminal device, wherein the upper computer programming environment unit inputs or outputs a graphical engineering file, the upper computer programming environment unit outputs a Python source code engineering file after programming the graphical engineering file, the E-Python translation module translates the Python source code engineering file into a C/C + + source code engineering file, the C/C + + source code engineering file is converted into an executable code by the source code translation module, and the executable code is finally output to the lower computer terminal device through the serial port updating module. The invention has the advantages that: the real-time requirement and the intelligent requirement of the embedded system can be met, and the embedded system has strong convenience in use.

Description

Graphical programming system
Technical Field
The invention belongs to the technical field of computers, and particularly relates to a graphical programming system.
Background
Research shows that most of the current embedded bottom-layer development depends on C/C + + as a development language. However, with the gradual change of embedded development requirements, the traditional C/C + + cannot meet some embedded systems with complex requirements, so the Python language is introduced into the embedded programming system. Because Python is an interpretive language and cannot meet the real-time requirement of an embedded system, a compiled embedded Python (hereinafter referred to as E-Python) needs to be designed and implemented and incorporated into a graphical programming system.
Disclosure of Invention
The purpose of the invention is realized by the following technical scheme.
Based on the requirement of the current embedded system for intellectualization and the convenience of the graphical programming system, the invention aims to design and realize the graphical embedded programming system with Python as the bottom layer programming language.
According to an aspect of the present invention, there is provided a graphical programming system comprising:
the system comprises an upper computer programming environment unit, an engineering file operation module, an E-Python translation module, a source code compiling module and a serial port updating module; the system comprises an upper computer programming environment unit, an E-Python translation module, a serial port updating module and a lower computer terminal device, wherein the upper computer programming environment unit inputs or outputs a graphical engineering file, the upper computer programming environment unit outputs a Python source code engineering file after programming the graphical engineering file, the E-Python translation module translates the Python source code engineering file into a C/C + + source code engineering file, the C/C + + source code engineering file is converted into an executable code by the source code translation module, and the executable code is finally output to the lower computer terminal device through the serial port updating module.
Further, the method further comprises the following steps: and the file export module is used for exporting the Python source code engineering file into a standard engineering file.
Further, the upper computer programming environment unit comprises a graphical programming environment subunit, an environment switching module and a code programming environment subunit, and the environment switching module is used for switching a programming mode between the graphical programming environment subunit and the code programming environment subunit.
Furthermore, the graphical programming environment subunit comprises an icon code library, an icon configuration module, a control operation module, a hardware configuration module, a source code generation module and a first information output module; the code programming environment subunit comprises a code editing module, a text operation module, a graphic code comparison module and a second information output module.
Furthermore, the graphical programming environment subunit realizes the development of a graphical program, and realizes the graphical programming by dragging an icon control, connecting the control and/or configuring the control operation; and the code programming environment subunit realizes secondary programming of the program, and performs secondary programming in a text code line writing mode on the basis of the source code generated by graphical programming.
Further, the system uses the window as a front-end interface carrier, starts the main window by newly building project engineering or opening existing engineering files, and adopts the design of combining the main window and the sub-windows: the main window body consists of four plates which are respectively an icon control area, a graphical programming area, a code display area and an information prompt area; the main window menu bar provides a file operation function, a program compiling function, a serial port updating function, an engineering file exporting function, a serial port debugging function, a BIOS repairing function, a hardware detection function, an information visualization function and a code secondary editing function.
Further, the icon controls include event controls, execution controls, sensor controls, communication controls, flow control controls, and subroutine controls.
Further, the control operation module is used for connecting a line and deleting a control, wherein the specific operation for deleting the control is as follows: respectively removing the connection lines between the control to be deleted and the parent control and the child control thereof; copying the child control information stored in the control to be deleted into the parent control of the child control, and copying the parent control information stored in the control to be deleted into the child control of the parent control, so as to realize the bidirectional association between the parent control and the child control of the control to be deleted; leading out a connecting line from the parent control exit point of the control to be deleted to the child control entry point of the control to be deleted, and realizing the connection between the parent control and the child control of the control to be deleted; and finally, releasing the resources occupied by the control to be deleted, and completing the deleting operation.
Further, the source code generation module is used for storing the codes carried by the control in the control according to the code type classification; the control realizes the development of a graphical program through operation in a graphical programming panel, and codes stored in the control are generated in a source code file in a one-to-one correspondence mode according to positions; in the process of generating the source code, firstly traversing all the controls stored in the graphical programming panel, taking a main control, an event control or a subprogram control as an initial control, and inserting the codes of the sub-controls one by one until the sub-controls are null, namely traversing to the last control.
Furthermore, the source code compiling module adopts a gcc compiler as a compiling tool and adopts a cross compiling mode.
The invention has the advantages that: the real-time requirement and the intelligent requirement of the embedded system can be met, and the embedded system has strong convenience in use.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a diagram illustrating a graphical programming system architecture according to an embodiment of the present invention.
FIG. 2 illustrates a graphical programming system main interface schematic according to an embodiment of the present invention.
FIG. 3 illustrates a schematic diagram of a secondary programming interface according to an embodiment of the present invention.
Fig. 4 is a schematic diagram illustrating configuration popup windows of a buzzer control and configuration popup windows of a delay control according to an embodiment of the present invention.
Fig. 5 shows a schematic view of a visualization interface according to an embodiment of the invention.
FIG. 6 illustrates a line graph of data acquired according to an embodiment of the present invention.
Fig. 7 shows a class a diagram labeling intent obtained according to an embodiment of the present invention.
Fig. 8 shows a B-class diagram labeling intent obtained according to an embodiment of the present invention.
Fig. 9 shows a class C diagram labeling intent obtained according to an embodiment of the present invention.
FIG. 10 illustrates a UML class diagram of icon control classes according to an embodiment of the present invention.
FIG. 11 illustrates a six type control icon diagram of an icon control library.
Fig. 12 shows a design schematic diagram of three types of icons of a built-in three-color lamp control.
FIG. 13 is a schematic source code diagram of graphical code generation.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
1 software System framework design
The essence of the upper computer software for realizing graphical programming is that the icon is dragged to a programming area, the relevant code line is generated and inserted into the pre-stored engineering file, then the engineering file is compiled into an executable file through the compiling function of the upper computer, and finally the executable file is burned into the lower computer. Therefore, the realization of the upper computer software not only needs to design a framework of the software, but also needs to design a framework of the project engineering file of the bottom layer and formulate a uniform file template.
1.1 underlying engineering document framework design
Table 4-1 is the design of the underlying engineering document architecture, which follows the hierarchical principle and componentization idea of embedded software development. The architecture consists of four parts: the four parts of the hierarchical association of the CPU, the MCU, the driving member and the application file further meet the hierarchical principle of software design; the component part is divided into a bottom component, an application component and a software component, and the bottom component, the application component and the software component are respectively stored in respective folders, so that the design idea of componentization is matched.
Figure BDA0003572463620000041
When the upper computer software processes the underlying engineering software, instructions are received mainly by an isr. When the task of the upper computer is executed, the bottom engineering file is added with relevant code information according to the requirements of the user, and finally the program obtains an expected operation result according to the execution flow.
1.2 Upper computer software framework design
The framework design of the software is the basis of software development, and an excellent software framework can improve the reusability of the software, reduce the production cost of the software and be beneficial to the future growth of the software. The method follows the design principle of software engineering, aims at an efficient and safe system operation environment, and develops upper computer software with clear hierarchy, clear structure and definite functions, and the framework of the upper computer software is shown in figure 1.
As shown in fig. 1, the graphic programming system of the present invention includes: the system comprises an upper computer programming environment unit, an engineering file operation module, an E-Python translation module, a source code compiling module, a serial port updating module and a file exporting module. The system comprises an upper computer programming environment unit, an E-Python translation module, a serial port updating module and a lower computer terminal device, wherein the upper computer programming environment unit inputs or outputs a graphical engineering file, the upper computer programming environment unit outputs a Python source code engineering file after programming the graphical engineering file, the E-Python translation module translates the Python source code engineering file into a C/C + + source code engineering file, the C/C + + source code engineering file is converted into an executable code by the source code translation module, and the executable code is finally output to the lower computer terminal device through the serial port updating module. In addition, the file export module can export the Python source code engineering file into a standard engineering file.
The upper computer programming environment unit comprises a graphical programming environment subunit, an environment switching module and a code programming environment subunit, wherein the environment switching module is used for switching a programming mode between the graphical programming environment subunit and the code programming environment subunit. The graphical programming environment subunit comprises an icon code library, an icon configuration module, a control operation module, a hardware configuration module, a source code generation module and an information output module. The code programming environment subunit comprises a code editing module, a text operation module, a graphic code comparison module and an information output module.
The upper computer programming environment consists of two parts: graphical programming environments and code programming environments. The graphical programming environment realizes the development of graphical programs, and the graphical programming is realized by operations of dragging an icon control, connecting the control, configuring the control and the like; the code programming environment realizes the secondary programming of the program, and after the program enters the environment, secondary programming is carried out on the basis of source codes generated by graphical programming in a text code line writing mode.
2 realizing the software function of the upper computer
The upper computer software is designed and compiled by adopting C # WinForm technology, the window is used as a front-end interface carrier, and a main window is started by newly building project engineering or opening existing engineering files. The upper computer software adopts the design of combining the main window body and the sub window body: the main form body is composed of four plates which are respectively an icon control area, a graphical programming area, a code display area and an information prompt area. In addition, a main window menu bar provides a file operation function, a program compiling function, a serial port updating function, an engineering file exporting function, a serial port debugging function, a BIOS repairing function, a hardware detection function, an information visualization function, a code secondary editing function and the like; many functions in the main window body can be realized by one key, and functions which cannot be realized by one key, such as information visualization, code secondary editing, serial port debugging and the like, can be realized by providing a back-end cs file corresponding to the functions.
2.1 Main interface
The main interface is created when a project file is newly built or opened, and the interface window is set to be an MDI container so that the sub-window can be opened under the main window. The main interface adopts Weifen Luo.WinFormsUI.Docking to realize the layout shown in the figure 2, and is divided into four parts.
(1) An icon control area. The icon control area is used for storing icon controls used for programming, and the module is displayed in a tree menu list mode by adopting a tree graph TreeView control.
(2) And patterning the programming region. The icon control is dragged to a programming area, and operations related to programming, such as connection of the control, configuration of the control and the like, can be realized in the area, and the icon control is also the most core part in the upper computer software.
(3) A code display area. And in the programming process, the Python source code is generated in the area in real time for each configuration of the control. The area adopts a TabControl control to create TabPage for displaying the contents of two files, i.e. main.py and isr.py, and the code contents are displayed by creating a text box through a CTextEditMenu class.
(4) And an information prompt area. The information prompt area is also called an information output window and is mainly used for prompting various information such as compiling state, compiling information, serial port burning progress and the like, and the output of the information is realized by binding various output events through the RichTextBox control.
2.2 Source code reprogramming interface
The interface is a sub-interface of upper computer software, and a secondary programming interface can be opened from a main interface menu bar by 'entering an advanced mode' as shown in fig. 3. The design of the interface does not recreate a child frame, but is modified accordingly based on the main interface. The main interface menu bar is realized by ToolStripMenuItem, and a pool-type variable IsAdvanceMode is defined in a single-click event of 'entering the advanced mode' to judge whether the interface menu bar is in the advanced mode currently. If the current interface is in the advanced mode, namely the code programming environment, the hidden states of the icon control window and the graphical programming window are set to true, and at the moment, only a code display window and an information output window are left in the interface. A function setreadOnly for setting whether a code is read only is defined in the software of the upper computer, and the parameter is a pool type. In a graphical programming environment, setting the function parameter to true to realize that the text code cannot be written at the moment; in a text programming environment, setting a parameter to false indicates that the code can be written at this time.
2.3 control configuration interface
And when the control is clicked, the control configuration interface pops up in a popup window mode to realize the configuration of the icon control. The configuration of each icon control needs to be designed and configured according to the characteristics of the icon control, for example, the small lamp control needs to set a switch state, a state inversion and the like, and the NB initialization control needs to set the IP address, the port number and the like of the relevant parameters thereof. The configuration function of the control is designed and completed by adding controls such as Label, TextBox, RadioButton, ComboBox and the like in the configuration form, and the Button control is added to determine the completion of the configuration of the control. Only after the ok button is clicked will the source code be displayed in the code area. Fig. 4 shows a configuration popup window of a buzzer control and a configuration popup window of a delay control.
2.4 visual interface
When the upper computer software is used for developing the embedded application, the acquired external data information can be output in multiple modes. The invention provides external components such as an LCD (liquid crystal display) screen and the like as an output mode. In addition, the upper computer also provides a visual interface which can be used as the output of data. The visual interface of the invention presents data in a line chart mode, is suitable for reading sensor data and can obviously observe the change of the data. As shown in fig. 5, the visualization interface is composed of two parts: setting a line graph and viewing the line graph.
When setting the line graph, it is necessary to set a time interval for data acquisition and determine the sensor type. In the drop-down box for the sensor type, the type is only displayed for selection when the sensor is accessed. After the line graph is generated, the line graph is continuously updated according to the time interval of data acquisition, and the updating of the line graph can be stopped at any time to export the line graph in a picture form or an Excel format to realize actual data application. Writing a test program of a visual interface: two temperature sensors are used and are in different environments by holding the sensors by hands and the like. The line graph of the acquired data is shown in fig. 6.
3 icon control module design and implementation
In a graphical programming system, an icon control is an indispensable element and is a basic unit for realizing graphical programming. Traditional graphical programming software cannot realize free customization of icon controls, which may result in that the development of a certain application system cannot be completed due to the lack of certain functions. The invention designs a method for realizing rapid addition and deletion of icon controls in a configuration file mode, and can provide freely customized icons according to hardware requirements.
3.1 visual classification design of icon controls
Due to the large number of types of icons, the icons need to be classified according to multi-directional elements to better manage the icon control library. The icons are designed according to two modes of horizontal classification design and vertical classification design, wherein the horizontal classification design is different forms of the icons, and the vertical classification is to classify and attribute all the icons according to characteristics.
1. Icon horizontal classification design
Three types of icons need to be designed for one icon in the icon library, and are respectively marked as A type, B type and C type in the invention. The class A icons are control icons as shown in FIG. 7, representing icon control areas; the B-type icon is shown in FIG. 8 and represents a control icon dragged into the graphical programming region; the class C icon is shown in fig. 9, and compared with the class B icon, a circle of dark mark is added on the periphery of the icon to indicate that the mouse hovers above the icon at the moment. The invention designs three types of icons to represent three different states in the programming process, so that the system has a friendly programming interface.
2. Icon longitudinal classification design
The icon controls in the graphical programming are equivalent to code statements used in the programming process, and a set of icon controls classified by knowledge elements are designed according to hardware requirements and software function requirements. The common icons are divided into six types, and the following is a detailed description of these six types of controls.
(1) And (6) event control. When a control in that type is triggered, the MCU generates an interrupt at that time. Such controls typically need to meet a certain condition, such as when a human infrared sensor detects a human, triggering an interrupt condition, at which time an isr.
(2) And executing the control. The type control can output a control signal to the outside, and controls such as a buzzer, an LCD display screen and the like can transmit signals to the outside to realize the actual action of the embedded system.
(3) A sensor control. The type control can acquire information data from the outside, for example, the acceleration sensor, the sound sensor and the like receive data information due to the change of some external relevant factors, and then the data information is uploaded to the MCU for processing.
(4) A communication control. The type control can realize the data communication between the MCU and the outside, and the MCU belongs to the communication control class no matter the data transmission is of a wired type or a wireless type. For example, the NB-IoT related control and the serial port related control can both realize data transmission of the device.
(5) And (5) controlling the flow. The type control is used for defining the execution flow and execution logic of a program, and a flow control module is an element which cannot be missed whether the program is text code line programming or graphical programming. The condition loop, the counting loop and the like which are commonly used in the programming are all flow control controls.
(6) A subroutine control. The type control provides subprogram definition and subprogram calling, and is a control type designed according to the software function requirement. The type control can encapsulate the function, and the readability of the graphical code is improved.
The controls are 6 control icon types designed according to the requirements of the graphical programming system at present, and a user can add control types according to the requirements of the user, for example, the controls required by the system are added or copied to the type of controls according to the classification design of the embedded application system, so that the graphical programming of the system is more conveniently realized.
3.2 icon control class design
After the icon controls are classified according to the functional characteristics, scientific modeling is carried out on the icon controls, icon control classes with clear hierarchical structures are abstracted from the iconic icon controls, and the UML diagram of the class is shown in figure 10. The main function of the icon control class implementation is the creation of an icon control object, and the created object is an important component of graphical codes and is also the basis for implementing graphical programming software.
The Icon class in the figure is a base class of the Icon control, contains basic information of the Icon control, provides a general method for the control, and cannot be instantiated. The basic information of the icon control is such as: the control type, the control name, the control Icon, the control display position information and the like are predefined in the Icon class. The Icon class is designed as the base class, so that the software program has better iterative updating capability.
The GeneralIcon class is a subclass of the Icon class, inherits Icon information in the Icon class and a general method, and adds an entry point and an exit point to an Icon object on the basis of the Icon to realize the dragging effect of the Icon, the operation of copying, pasting, cutting, deleting, the configuration of a control and the like. The general icon class can be instantiated, and the display icons and the icon display positions can be preset to realize the initialization of the icon library. The general icon is instantiated firstly, and then is initialized, and the upper computer software adjusts the layout icon control library according to the setting condition to display the layout icon control library in the graphical programming main panel. The controls in the upper computer are all of the general icon type.
3.3 configurable design implementation of icon controls
Most of traditional graphical programming software directly packages and integrates icons in an icon library, which causes great limitation in the development of embedded systems. The invention adopts a mode of configuring the file, stores the icon control information in the file, and can dynamically update the content of the icon library by directly reading the information in the configuration file when the software program is started. The method adopts the configuration file to realize the configuration of the icon control, thereby greatly improving the expandability of the software.
1. Configuration file format
The invention adopts JSON format as data storage format, which is a light data exchange format. The JSON format configuration file is used as a carrier for storing control information, because the encoding and decoding difficulty of the format is low, the analysis and the generation of a computer are facilitated, and the programming efficiency of the graphical code is improved. In addition, the space of the graphical control information occupying the memory can be saved by adopting the format, and the program running efficiency is improved. The JSON format also has higher readability, and the hierarchical structure is clear and concise, so that the writing and reading are more convenient.
The JSON format consists of a series of related "key-value pairs," taking the configuration information of the icon control "LCD display" as an example: one control information represents one object in the configuration file, with a pair of parenthesis enclosing the "key-value pair". In parenthesis, each line of text separated by an english comma is a set of "key-value pairs". Each set of "key-value pairs" consists of two parts: english colons are taken as intervals, keys are arranged on the left side of the colons, and corresponding values are arranged on the right side of the colons. The "key" can only take the form of a string of characters, and the "value" can take the form of a string of characters, an array, a number, or another object.
Figure BDA0003572463620000101
2. Control information import icon library
The method sets 'config.json' as a configuration file and stores control information in the file in a key-value pair form. After the upper computer software is started, the program automatically loads control information in a configuration file' config. An IconBoxInfo class is created in the upper computer software and used for loading a configuration file, and the control information and the connection information of the extensible hardware are analyzed. The IconBoxInfo class defines a dictionary variable controlIconDic for storing the parsed content.
FIG. 11 shows six types of control icons of the icon control library. Most external extensible hardware is placed in three categories of event controls, execution spaces and sensor controls, built-in communication components are stored in the communication controls, and software controls are stored in the process controls and the subprogram controls. The icon control library is realized by designing a child form frmIconBox, and when a user opens or creates a new project file, a program creates the child form to generate an icon control module. And creating a root node of a type control on the tree treeViewIConBox in a constructor of the child form frmIConBox, and respectively placing the controls in the dictionary variable controlIConDic into the corresponding control root nodes according to type classification.
3.4 architected additive design of icon
The content in the above section can realize the free addition of the icon control by the configuration file "config.
1. Control icon landscape design
Three types of icons are designed A, B, C for the "three color lights built in" control according to the icon horizontal sort design in section 2.1 as shown in fig. 12.
The three types of icons all adopt PNG format, and are named according to standard format after the design is finished, wherein the standard format is as follows: png ", where the number 1 represents a class a icon, the number 2 represents a class B icon, and the number 3 represents a class C icon. Therefore, the three types of icons of the "three color built-in lamp" control are respectively expressed as "three color built-in lamp 1. png", "three color built-in lamp 2. png" and "three color built-in lamp 3. png" in the order of A, B, C types. And after the steps are completed, adding the pictures into the specified folder for storage.
2. Control information addition
As can be known from the configurable implementation manner of the control in section 2.3, control information needs to be added to the "config. The control information stored in the file is as follows: control name, control type and control icon information. The json configuration information for the "built-in tri-color light" control is as follows.
Figure BDA0003572463620000121
3. Creating a configuration form
The purpose of creating a separate configuration form for the control is to set parameters of the icon control or select different functions of the same control, and the control can ensure correct generation of the source code only if the configuration is successful. Some controls are single in function and do not need to be separately created for configuration forms without setting parameters. And the control is set with the turning-on, turning-off and state switching of the red, green and blue lamps according to the characteristics of the three-color lamp to realize the regulation and control of the built-in three-color lamp. Taking the option of lighting a blue light as an example, after configuration is completed, a corresponding Python code is generated as follows.
Adding the following Python code lines in the initialization code initialization to complete the initialization of the control:
Figure BDA0003572463620000122
the following Python lines of code are added to the code InsertCode at the location of the inserted control to enable the operation of executing the control:
Figure BDA0003572463620000123
4 building of graphical programming environment
The implementation steps of the graphical programming are as follows: the control in the icon control library is firstly dragged to the graphical programming area, and then the controls are connected according to certain logic, so that the control is more readable like a flow chart. After the graphical program taking the control as the code is well programmed, the source code can be automatically generated in the code display area. Because the Python is adopted as the source code in the invention, the Python can not be directly compiled into the executable file by the traditional compiling technology. According to the requirement of an embedded Python application architecture, a translation step is added to the Python program in the compiling process compared with the C/C + + compiling. Therefore, the Python source code can be compiled into an executable file which can be directly executed by a computer through a compiling technology after being translated, and then the executable file is burnt into a lower computer through a serial port so as to realize the development of an embedded system. By analyzing the implementation steps of the graphical programming, the main elements of the graphical programming environment are found to be as follows: icon controls, connecting lines, automatic generation of source codes, a compiling technology and a serial port burning technology. This section will describe the steps of graphical programming environment construction around these elements.
4.1 control code Generation design
The icon is adopted to replace the text line programming, only the connecting line between the icon is used to greatly reduce the difficulty of embedded programming in macroscopic view, but the text code line carried by the control is inserted into the source code file according to the specific position in microscopic view. Inserting lines of text code into a source code file appears simple, but not true. Not only do all code statements need to be placed in the correct location, but the Python used in the present invention requires more for the code format. Therefore, a mode of storing the source codes in a classified manner is designed to realize the insertion of the control carrying codes.
The software of the upper computer defines a Code class for storing codes generated by the control, a variable Code of the Code class is defined in the general icon class, and the essence of setting the control configuration form is to modify the codes stored in the Code variable. Member variables are defined in the Code class by classifying each part of the Code in the source Code file.
TABLE 4-5code Member parsing
Figure BDA0003572463620000131
Figure BDA0003572463620000141
4.2 control actual operation analysis and implementation
The user does not need to know the details of the programming when using graphical programming. During operation, the controls are connected only by adopting a connection mode, and the written graphical program needs a user to give the user practical application significance. The specific operation of the control mainly comprises connection and control deletion, and the technology for realizing the basic operation is analyzed in this section.
1. Wire bonding operations
The invention determines the execution sequence of the control by adopting a connection mode. The graphical program can only start from a "main" control, an event control, and a subroutine control. These three types of controls may serve as initial controls for the program.
The operation of the link between the controls is similar to a doubly linked list. Each control contains parent and son members, parent representing the parent of the control, and son representing the child of the control. Meanwhile, the control is a child control of the parent control and a parent control of the child control. The method for setting the parent-child controls is used for generating bidirectional association between the two controls so as to ensure that the controls are arranged in an absolute sequence.
When the control is dragged to the graphical panel and is not connected with the line, the values of parent and son are null. The general icon defines entry points and exit points of controls corresponding to member variables InPic and OutPic, and the upper computer completes the connection operation between the controls through the two members. Taking the connection operation between the control A and the control B as an example: clicking the exit point of the control A by the mouse, leading out a line with an arrow from the exit point of the control A, starting the line connection operation, and recording and storing the control A object by the upper computer; the mouse stops at the arrow of the connecting line at the moment, the mouse clicks the entry point of the control B, the upper computer judges whether the connecting line between the control A and the control B is legal or not, and if the connecting line is legal, the two controls are connected in a coordinate positioning mode; and finally, the upper computer sets the child control of the control A as the control B, and the father control of the control B is the control A.
2. Control delete operation
The control can realize the deletion operation of the control on the graphical programming panel. If the control is not connected with other controls, the control can be directly deleted on the graphical programming panel, and all information of the control is contained. If the control is connected with other controls, the control needs to be separated from the connecting line when deleted. This operation is also similar to deleting a node in a doubly linked list. Because the control in the connection line, the parent control and the child control are stored in two directions, the parent control and the child control of the control need to be modified respectively to realize that the control is stripped from the program. And realizing the specific operation of deleting the control: respectively clearing the connecting lines between the control to be deleted and the parent control and the child control thereof; copying child control information stored in a control to be deleted into a parent control of the control, copying parent control information stored in the control to be deleted into a child control of the control, and realizing bidirectional association between the parent control and the child control of the control to be deleted; leading out a connecting line from the parent control exit point of the control to be deleted to the child control entry point of the control to be deleted, and realizing the connection between the parent control and the child control of the control to be deleted; and finally, releasing the resources occupied by the control to be deleted, and completing the deleting operation.
4.3 automatic Source code Generation techniques
As can be seen from section 4.1, the codes carried by the widgets are stored in the widgets according to the code types in a classified manner. The control realizes the development of the graphical program through related operations in the graphical programming panel, and simultaneously codes stored in the control are generated in the source code file in a one-to-one correspondence mode according to the positions.
In the process of generating the source code, the upper computer firstly traverses all the controls stored in the graphical programming panel, takes a main control, an event control or a subprogram control as an initial control, and inserts the codes of the sub-controls one by one until the sub-controls are null, namely, the upper computer traverses to the last control. FIG. 13 shows the source code for graphical code generation.
4.4 compiling and burning techniques
1. Program compiling technique
After the graphical program is compiled to generate the source code, the source code needs to be compiled into a file which can be directly executed by a computer through a compiling technology, and a cross compiling mode is generally adopted. The present invention employs a gcc compiler as a compilation tool.
A large number of parameters need to be configured by adopting a cross compiling mode, and the program compiling efficiency can be improved by using the batch processing function of the make tool in the GNU compiler. The make tool executes instructions in a batch file Makefile, and compiling rules and linking rules of the program are defined in the Makefile. In the compiling rule, the conversion from the files of the 'S' and the 'c' to the file of the intermediate file 'o' is realized by using an 'arm-none-eabi-gcc' tool; in the compiling principle, the generation of the conversion of the intermediate file from the o file to the executable file from the hex file and the elf file is realized by using an 'arm-none-eabi-g + +' tool and an 'arm-none-objcopy' tool.
The software of the upper computer calls a make tool to execute Makefile to realize the operation of compiling the program by using the cmd window, and key codes of the software are shown as follows.
Figure BDA0003572463620000161
The upper computer software also obtains information prompt in the compiling process by binding information output events, and key codes of the information prompt are shown as follows.
Figure BDA0003572463620000162
2. Program burning technology
And the program generates an executable file after being compiled, and the upper computer burns the executable file into the lower computer terminal equipment to realize the operation of the equipment. The upper computer provides a one-key burning function in a main interface menu bar. In the burning process, the connection of the equipment is firstly confirmed, and the burning of the executable file can be completed only on the basis of successful connection of the equipment. And after the equipment is successfully connected, loading a hex file generated by compiling. The hex file is a file format for storing program machine code, each line in the file comprises a hex record, and each record comprises 6 fields: start mark, data length, offset, recording type, data area, and checksum. The upper computer needs to judge whether the hex is legal or not, and if so, the hex file is analyzed into frame format data. And the upper computer sends the analyzed frame format data to the equipment one frame by one frame, each frame of data needs to obtain the correct response of the equipment to send the next frame of data, and the machine code is successfully burnt to the terminal equipment until all the data frames are sent.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (10)

1. A graphical programming system, comprising:
the system comprises an upper computer programming environment unit, an engineering file operation module, an E-Python translation module, a source code compiling module and a serial port updating module; the system comprises an upper computer programming environment unit, an E-Python translation module, a serial port updating module and a lower computer terminal device, wherein the upper computer programming environment unit inputs or outputs a graphical engineering file, the upper computer programming environment unit outputs a Python source code engineering file after programming the graphical engineering file, the E-Python translation module translates the Python source code engineering file into a C/C + + source code engineering file, the C/C + + source code engineering file is converted into an executable code by the source code translation module, and the executable code is finally output to the lower computer terminal device through the serial port updating module.
2. The graphical programming system of claim 1,
further comprising: and the file export module is used for exporting the Python source code engineering file into a standard engineering file.
3. The graphical programming system according to claim 1 or 2,
the upper computer programming environment unit comprises a graphical programming environment subunit, an environment switching module and a code programming environment subunit, wherein the environment switching module is used for switching a programming mode between the graphical programming environment subunit and the code programming environment subunit.
4. The graphical programming system of claim 3,
the graphical programming environment subunit comprises an icon code library, an icon configuration module, a control operation module, a hardware configuration module, a source code generation module and a first information output module; the code programming environment subunit comprises a code editing module, a text operation module, a graphic code comparison module and a second information output module.
5. The graphical programming system of claim 4,
the graphical programming environment subunit realizes the development of a graphical program, and realizes the graphical programming by dragging an icon control, connecting the control and/or configuring the control operation; and the code programming environment subunit realizes secondary programming of the program, and performs secondary programming in a text code line writing mode on the basis of the source code generated by graphical programming.
6. The graphical programming system of claim 5,
the system uses a window as a front-end interface carrier, starts a main window by newly building project engineering or opening existing engineering files, and adopts the design of combining the main window with a sub-window: the main window body consists of four plates which are respectively an icon control area, a graphical programming area, a code display area and an information prompt area; the main window menu bar provides a file operation function, a program compiling function, a serial port updating function, an engineering file exporting function, a serial port debugging function, a BIOS repairing function, a hardware detection function, an information visualization function and a code secondary editing function.
7. The graphical programming system of claim 5,
the icon controls include event controls, execution controls, sensor controls, communication controls, flow control controls, and subroutine controls.
8. The graphical programming system of claim 4,
the control operation module is used for connecting lines and deleting controls, wherein the specific operation for deleting the controls is as follows: respectively clearing the connecting lines between the control to be deleted and the parent control and the child control thereof; copying the child control information stored in the control to be deleted into the parent control of the child control, and copying the parent control information stored in the control to be deleted into the child control of the parent control, so as to realize the bidirectional association between the parent control and the child control of the control to be deleted; leading out a connecting line from the parent control exit point of the control to be deleted to the child control entry point of the control to be deleted, and realizing the connection between the parent control and the child control of the control to be deleted; and finally, releasing the resources occupied by the control to be deleted, and completing the deleting operation.
9. The graphical programming system of claim 4,
the source code generation module is used for storing the codes carried by the control in the control according to the code types in a classified manner; the control realizes the development of a graphical program through operation in a graphical programming panel, and codes stored in the control are generated in a source code file in a one-to-one correspondence mode according to positions; in the process of generating the source code, firstly traversing all the controls stored in the graphical programming panel, taking a main control, an event control or a subprogram control as an initial control, and inserting the codes of the sub-controls one by one until the sub-controls are null, namely traversing to the last control.
10. The graphical programming system of claim 1,
the source code compiling module adopts a gcc compiler as a compiling tool and adopts a cross compiling mode.
CN202210328901.8A 2022-03-30 2022-03-30 Graphical programming system Pending CN114706570A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210328901.8A CN114706570A (en) 2022-03-30 2022-03-30 Graphical programming system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210328901.8A CN114706570A (en) 2022-03-30 2022-03-30 Graphical programming system

Publications (1)

Publication Number Publication Date
CN114706570A true CN114706570A (en) 2022-07-05

Family

ID=82171513

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210328901.8A Pending CN114706570A (en) 2022-03-30 2022-03-30 Graphical programming system

Country Status (1)

Country Link
CN (1) CN114706570A (en)

Similar Documents

Publication Publication Date Title
US8327280B2 (en) Programmatic analysis of graphical sub-programs within a graphical program
US7650594B2 (en) Graphical program analyzer with framework for adding user-defined tests
US8640100B2 (en) Debugging a statechart using a graphical program
CN103197929B (en) A kind of graphic programming system and method for children-oriented
WO2015039628A1 (en) Visualization step programming method
US20180173503A1 (en) System and method for graphical programming
US20050268173A1 (en) Programmatically analyzing a graphical program by traversing objects in the graphical program
WO2018184359A1 (en) Application simulation method for payment terminal, mobile terminal and readable storage medium
US6215488B1 (en) Method and system for designing a graphical user interface for an electronic consumer product
Wielenga Beginning netbeans ide: For java developers
CN114706570A (en) Graphical programming system
Pérez-Castillo et al. ANDRIU. A Technique for Migrating Graphical User Interfaces to Android (S).
Olsen Jr et al. Research directions for user interface software tools
CN101650656B (en) Control method for software logic input device, input control system and computer system
Jinhui et al. The application of qt/embedded on embedded linux
CN112199097B (en) Installation package generation method, installation package generation device, computer equipment and storage medium
Covington et al. The Red-R framework for integrated discovery
Wang Review and testing of plugins in Flutter for Android and IOS
Kragelund Advanced tool support for requirements engineering
Harel et al. Capturing and executing behavioral requirements: the play-in/play-out approach
Petkov GUI for component behavior–based on REMES
CN117573487A (en) Automatic execution method and system based on USB-HID device
Gold A Hierarchical State Machine Editor for Eclipse
Lorenat Automated user interface generation from minimal specifications
Holsapple¹ et al. 40506, USA. 2Department of Business Administration, Sung Kyun Kwan University, Seoul, Korea. 3Department of Management Science and Information Systems, University of Texas at Austin, Austin, Texas 78712, USA.

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination