A motion controller program development system based on a general programming language

The motion controller program development system based on a general-purpose programming language solves the problems of high learning costs and low development efficiency of traditional self-developed scripting languages, enabling efficient program development and debugging, and improving the development efficiency and readability of motion controllers.

CN122308814APending Publication Date: 2026-06-30WUXI XIVI SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WUXI XIVI SCI & TECH CO LTD
Filing Date
2026-02-25
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

The self-developed dedicated scripting languages ​​of traditional motion controllers result in high learning costs, long development cycles, and serious waste of developer resources. Furthermore, the lack of rich library functions and development tools from general programming languages ​​limits the readability, reusability, and integration capabilities with enterprise systems.

Method used

This invention provides a motion controller program development system based on a general-purpose programming language. By constructing a program document management, code editing and debugging module and a multi-view interactive interface, it enables direct compilation and hardware execution of high-level language code, supports the state synchronization and real-time monitoring of multi-task programs, and provides code completion and error warning by combining intelligent auxiliary units.

Benefits of technology

It significantly reduces learning costs, improves development efficiency and code readability, achieves program reusability and debuggability, enhances the standardization of the development process and the predictability of execution, and strengthens the openness and flexibility of motion control applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122308814A_ABST
    Figure CN122308814A_ABST
Patent Text Reader

Abstract

This invention discloses a motion controller program development system based on a general-purpose programming language, relating to the field of motion control software development. The system includes: a program document management module for creating, opening, closing, and synchronously managing the status of multiple motion control program documents, and supporting unified state switching between editing, compiling, running, and debugging states; an integrated editing and debugging module for providing a code editing environment conforming to the syntax of a general-purpose programming language, and integrating compilation control, debugging control, and a real-time communication interface with the motion controller hardware; and a multi-view interactive interface for simultaneously presenting program document identifiers and status views, a code editing view and debugging control panel for the currently active program document, and a program execution status and result output view. This solution reduces the time cost and technical barriers associated with learning dedicated scripting languages, and simultaneously enhances code readability and debuggability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of motion control software development, and in particular to a motion controller program development system based on a general-purpose programming language. Background Technology

[0002] Motion controllers, as core components of industrial automation, robotics, and CNC systems, are primarily responsible for complex tasks such as multi-axis cooperative motion planning and real-time closed-loop control. Traditionally, to balance performance and ease of use, most motion controller manufacturers tend to provide self-developed dedicated scripting languages ​​or graphical programming environments for users to perform secondary development and logic arrangement. These dedicated scripts are usually deeply coupled to specific hardware architectures and function libraries. While they can simplify basic operations, they limit developers to the ecosystem and technology stack defined by the supplier. As modern industrial applications increasingly demand functional flexibility, development efficiency, and system maintainability, providing developers with more open, universal, and efficient programming methods while preserving the real-time performance and reliability of underlying control has become an important direction for technological evolution in the field of motion control.

[0003] While the current mainstream approach of using self-developed dedicated scripting languages ​​lowers the barrier to entry for writing control logic to some extent, it has significant inherent limitations: First, the script syntax, semantics, and APIs of different manufacturers are incompatible, requiring developers to relearn a closed programming system every time they switch to or adapt to a different hardware platform, resulting in high learning costs, long development cycles, and significant waste of human resources. Second, these scripting languages ​​are typically limited in functionality and have weak ecosystems, lacking the rich library functions, mature development toolchains, and broad developer community support found in general-purpose programming languages, making it difficult to implement complex algorithms, debug and optimize code, and maintain it long-term. Finally, dedicated scripts often cannot directly utilize the high-level language features and software engineering best practices already available in the general programming domain, restricting the readability, reusability, and integration capabilities of motion control programs with upper-level enterprise information systems, thus creating a technical barrier and hindering the rapid iteration and open innovation of industrial automation systems. Therefore, based on the above challenges, this invention proposes a motion controller program development system based on a general-purpose programming language. Summary of the Invention

[0004] To address the aforementioned issues, the present invention aims to provide a motion controller program development system based on a general-purpose programming language. This system breaks down the programming technology barriers between different motion control hardware, allowing developers to use internationally recognized high-level languages ​​such as C to write programs. This significantly reduces learning costs and development barriers, and enables efficient management, state control, and error troubleshooting of multi-task programs, ultimately improving the readability and portability of motion control application code.

[0005] To achieve the above objectives, this invention provides a motion controller program development system based on a general-purpose programming language. The core of this system lies in constructing a unified graphical interface comprising a program document management area, a code editing area, a document navigation area, and an output area. Through the program document management module, it enables the creation, opening, state synchronization, and batch operation of multiple control programs. The code editing area provides a syntax-compliant interface for highlighted editing, compilation, and debugging, and achieves real-time communication with the motion controller hardware, supporting direct compilation and deployment of code to the hardware for execution. A coherent program state machine is designed to achieve dynamic linkage between the interface control logic and the program execution state. Simultaneously, through multi-view collaboration, developers can simultaneously complete code writing, program uploading, real-time debugging, status monitoring, and result analysis within a single interface, thus forming a complete closed-loop workflow from development to deployment.

[0006] In a first aspect, the present invention provides a motion controller program development system based on a general-purpose programming language, comprising: The program document management module is used to create, open, close, and manage the status of multiple motion control program documents, and supports unified state switching between editing, compiling, running, and debugging states. An integrated editing and debugging module is provided to offer a code editing environment that follows the syntax of a general programming language, and integrates compilation control, debugging control, and a real-time communication interface with the motion controller hardware; The compiler optimization strategy configuration module allows users to set weight coefficients for at least three optimization dimensions for motion control tasks, including memory usage weight, worst-case execution time weight, and inter-task scheduling interval variance weight. Based on the user-defined weight coefficients, it generates a composite optimization objective function to guide the compiler in performing multi-objective adaptive optimization. An adaptive compilation engine, responding to user strategy configurations, dynamically balances code memory usage, real-time performance, and timing determinism during the compilation process to generate executable instructions that match specified hardware resources and task constraints; A multi-view interactive interface for simultaneous presentation: The program document management module outputs the program document identifier and status view; The integrated editing and debugging module provides a code editing view and debugging control panel for the currently active program document; A view of the program execution status and result output fed back by the motion controller hardware; The system, through the integrated editing and debugging module, compiles the user-written general programming language code and directly sends it to the motion controller hardware for execution, thereby enabling the programming, debugging, and real-time monitoring of motion control tasks.

[0007] Furthermore, the program document management module supports parallel state maintenance and batch operations on multiple program documents. The batch operations include at least unified initialization, unified compilation and uploading, and unified start / stop control of the selected documents.

[0008] Furthermore, in the integrated editing and debugging module, the debugging control includes breakpoint setting, single-step execution, running to breakpoint, and real-time variable monitoring functions. The debugging command is sent to the motion controller hardware through the real-time communication interface to trigger the corresponding debugging action on the hardware side, thereby realizing precise tracking and control of the program execution flow on the hardware side.

[0009] Furthermore, the debugging control function in the integrated editing and debugging module also includes: The execution path prediction and preloading unit is used to perform the following steps when the debug session starts: Perform static analysis on the current program and construct its control flow graph; Based on the control flow graph and the set breakpoints, and combined with the branch probability model, the preload urgency of each breakpoint is calculated. A preload priority queue is generated based on the preload urgency. A low-priority background communication thread asynchronously prefetches and caches variable states and memory data associated with breakpoints from the motion controller hardware according to the priority queue. When the program reaches a breakpoint, it prioritizes reading debugging data from the local cache and updating the interface.

[0010] Furthermore, in the multi-view interactive interface, each program document identifier is associated with a context operation menu in the status view. This menu provides at least the following operation options: open to the editing view, close the view, remove from the system, save the corresponding program to the hardware storage, and view or set document attributes, so as to provide flexible and context-aware document management capabilities.

[0011] Furthermore, the operation of saving the corresponding program to the hardware memory triggers the system to write the executable instruction stream after compiling the current document code into the non-volatile storage space of the motion controller hardware through the real-time communication interface, thereby realizing the persistent storage and rapid deployment of the program on the hardware side.

[0012] Furthermore, the system defines a set of coherent program development process states, including: ready state, editing state, successful compilation state, running state, debugging state, and exception state; the system interface dynamically enables or disables the corresponding control function buttons according to the current main state to guide users to follow the correct development process and prevent misoperation.

[0013] Furthermore, in the debug state, the system prohibits direct switching of the active program document until the debug session ends or the user actively exits the debug state, thereby ensuring the focus of the debug session and the consistency of the data.

[0014] Furthermore, the general programming language is C, and the code editing environment provides code highlighting, syntax structure prompts, and compilation error location functions related to C language syntax, which significantly improves the convenience, readability, and early error detection capabilities of code writing.

[0015] Furthermore, the system also includes a context-aware intelligent assistance unit that interacts with the integrated editing and debugging module and the program document management module. This unit is used to analyze the semantic context of the code, the current program state, and the hardware resource configuration in real time, proactively provide code completion suggestions, parameter compliance checks, and early warnings of potential logical conflicts related to the field of motion control, and provide correction or optimization solutions.

[0016] Secondly, a method for developing motion controller programs based on a general-purpose programming language is also provided. This method is based on the system described in the first aspect and includes: Create or open one or more motion control program documents through the program document management module; In the integrated editing and debugging module, code for the currently active program document is written or modified using a general-purpose programming language; The code is compiled using the compilation control function in the integrated editing and debugging module and uploaded to the motion controller hardware via the real-time communication interface; Through the run or debug control function in the integrated editing and debugging module, instructions are sent to the motion controller hardware to trigger program execution or enter debug mode. In the program execution status and result output view of the multi-view interactive interface, the program execution flow, status feedback and data output of the motion controller hardware are monitored in real time. The execution status of multiple program documents is centrally monitored and managed in the program document management module.

[0017] Furthermore, in debug mode, the method sends single-step execution or run to the next breakpoint instruction to the hardware through the debug control function; based on the execution status returned by the hardware, the system automatically highlights the currently executing line of code in the code editing view and updates variable information in the output view, thereby achieving visual synchronization and accurate mapping between the software editing interface and the hardware execution status.

[0018] This invention provides an integrated development system for motion controllers based on a general-purpose programming language. The system achieves centralized development and real-time debugging of motion control programs by constructing a unified software architecture that includes a program documentation management module, an integrated editing and debugging module, and a multi-view interactive interface. Specifically, the program documentation management module is responsible for the creation, state synchronization, and lifecycle management of multi-task programs; the integrated editing and debugging module provides a syntax-aware code editing environment and establishes real-time communication with the motion controller hardware, supporting integrated execution of code compilation, download, running, and debugging operations; the multi-view interactive interface synchronously presents information such as document status, code editing, debugging control, and hardware execution feedback. The entire system coordinates the behavior of each module through a state machine mechanism, enabling developers to complete a closed-loop operation from program writing, compilation, deployment to runtime monitoring within a unified platform.

[0019] This system significantly reduces the time cost and technical barriers associated with learning specialized scripting languages, and improves the collaborative efficiency of developing complex control tasks through centralized management and batch operations of multiple program documents. Benefiting from the ecosystem advantages of a general-purpose language and the system's integrated debugging capabilities, the system simultaneously enhances code readability, reusability, and debuggability. Furthermore, the multi-view real-time synchronization and status linkage mechanism provides transparent monitoring of the program execution process, ensuring the standardization of the development process and the predictability of execution results, thereby comprehensively improving the openness, flexibility, and engineering level of motion control program development.

[0020] Beneficial effects By implementing the motion controller program development system based on a general programming language provided by the present invention, the following technical effects are achieved: (1) The multi-state unified management mechanism for program documents defines and maintains a coherent state machine for each program document and implements state-driven control logic linkage at the interface layer. It provides developers with a clear, consistent and error-proof program lifecycle management model, ensuring the standardization of operation processes and the controllability of state switching in a multi-task development environment.

[0021] (2) The hardware code direct writing and execution monitoring closed loop based on real-time communication opens up a direct channel from high-level language code editing to the issuance of hardware executable instruction streams, and realizes the synchronous feedback of execution status and data. It constructs a highly integrated workflow, eliminates the multiple conversions and manual transmission links in traditional development, greatly shortens the iteration cycle from program modification to verification feedback, and improves the overall development efficiency.

[0022] (3) The flexible compilation optimization strategy quantifies users' preferences for real-time performance, memory usage, and timing stability into configurable optimization weights, and drives the compilation process to perform multi-objective adaptive trade-offs, thereby achieving targeted optimization of the performance characteristics of motion control code. It improves the matching degree between the generated code and specific hardware resource constraints and task-critical requirements, and enhances the overall operating efficiency and determinism of the program in complex or constrained industrial scenarios.

[0023] (4) The incremental debugging information preloading mechanism effectively overcomes the interaction delay caused by on-site communication delay in traditional debugging modes by proactively predicting the program execution path and asynchronously pre-fetching relevant data during the debugging session. It shortens the information response time after breakpoint triggering, realizes near real-time debugging status refresh, thereby improving the developer's debugging experience and problem diagnosis efficiency, and minimizes interference with real-time hardware control tasks.

[0024] (5) Context-aware intelligent assisted programming, through deep integration of professional knowledge and rules in the field of motion control, can perform real-time semantic analysis and compliance checks on the code being written. It can proactively prevent typical development pitfalls such as resource conflicts, parameter overruns, and logical errors, and advance the error detection and correction process, thereby reducing rework costs and improving the quality of the first-time code writing and the smoothness of the development process. Attached Figure Description

[0025] To make the above-described motion controller program development system based on a general programming language of the present invention more obvious and understandable, the accompanying drawings used in the specific embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0026] Figure 1 This diagram illustrates the context menu for the program's document navigation area. Figure 2 A schematic diagram showing the program document management area interface and batch control functions; Figure 3 This is a schematic diagram of the code editing and debugging area interface. Detailed Implementation

[0027] Example 1: This embodiment provides a motion controller program development system and its implementation method based on a general-purpose programming language. The system constructs an integrated development environment that uses the general-purpose C language as the programming medium, deeply integrates editing, debugging, and hardware interaction, and systematically solves the inherent defects of traditional dedicated scripting languages ​​in terms of openness, development efficiency, and debugging visualization through multi-view collaboration, state machine-driven mechanisms, and context-aware management mechanisms.

[0028] like Figure 1 As shown, the program documentation navigation area provides a highly integrated contextual operation menu for each opened program document. This design not only provides basic document operation functions but also deeply integrates the characteristics of motion controller hardware management, achieving a seamless closed loop from software development to hardware deployment. In the traditional motion control development process, code writing, compilation, debugging, and final burning to hardware are usually separate steps, potentially involving multiple independent tools, leading to process fragmentation, inefficiency, and susceptibility to errors. This system completely changes this model by integrating a "Save to Hardware" option into the right-click menu. When the user selects this option, the system does not simply save a text file but triggers a series of automated operations: First, the system calls a built-in compiler optimized for the target motion controller hardware to compile the C language source code in the current editing window into a hardware-executable machine instruction stream in real time; then, through a highly reliable real-time communication interface established at the system's underlying level, the instruction stream is directly written to a designated area in the non-volatile storage medium of the motion controller hardware. This process integrates multiple steps that traditionally require manual intervention, such as compilation, linking, transmission, and burning, into a coherent automated action, greatly simplifying the deployment process and reducing the possibility of human error. More importantly, it enables the development environment to understand the hardware's storage structure and execution characteristics, achieving true development-as-deployment. Furthermore, the context menu includes Properties options for viewing and setting document-related hardware parameters, such as the program's starting address in hardware memory, priority, and trigger conditions, further enhancing the software's control over hardware resource configuration.

[0029] like Figure 2As shown, the program document management area uses a comprehensive interface combining a table and a unified control button group. Each row in the table represents an independent motion control program document. Its Buffer column identifies the document number, the Select column provides checkboxes for batch selection, the Open column indicates whether it is open in the editing area, the Lines column displays the number of lines of code, and the Status column provides real-time feedback on the program's current status in the system and hardware, such as ready, editing, compiled successfully, running, debugging, or exception. The functions of the control button group above are not static but dynamically linked to the Status column information of the selected row in the table below, forming a status-aware batch operation mechanism. For example, when a user selects three program documents simultaneously, but their Statuses are compiled successfully, running, and editing respectively, the Run button may be disabled or only effective for the document in the compiled successfully state, while the Stop button may only be effective for the document in the running state. The system maintains a precise program state model in the background, ensuring the atomicity and consistency of any batch operation commands. Specifically, the system verifies the legality and sequence of operations on all selected documents, then sends the corresponding control command sequence to the hardware in an orderly manner via a real-time communication interface, and synchronously updates the status display of all relevant documents. This design solves the challenge of unified version management, coordinated testing, and synchronized start / stop of multiple control logics when developing complex systems with multiple collaborative motion control tasks. It allows developers to intuitively monitor and manage the lifecycle of all motion control tasks within a single interface, much like managing operating system processes, significantly improving the engineering level, collaborative efficiency, and system reliability of multi-task development.

[0030] like Figure 3As shown, the code editing and debugging area is far more than just a code editor with added debugging functionality. Through deep low-level integration, it constructs a visual debugging environment that is synchronized in real-time with the internal debugging engine of the motion controller hardware, enabling bidirectional interaction. This achieves real-time, precise mapping and visualization of high-level language source code and hardware instruction execution flow. In traditional motion control development, debugging often relies on dedicated monitoring software provided by hardware manufacturers, observing memory addresses, register values, or interpreting dedicated script status codes. This process is not intuitive and has a significant cognitive gap with the high-level language code written by the developer. In this system, when a developer sets a breakpoint next to a line of C language source code in the code editing view, this action is not merely a marker in the local editor. The system parses the source code location corresponding to the breakpoint, calculates its exact address in the final executable machine instruction flow through compiler mapping relationships, and then sends this breakpoint setting information to the debugging support unit of the motion controller hardware via a real-time communication interface. When the user clicks the "Run" or "Run to Breakpoint" button, the hardware begins executing the program and automatically pauses upon encountering the set breakpoint address. The hardware debugging unit then actively captures a complete snapshot of the execution state at that moment, including data such as the program counter, general-purpose registers, special-function registers, and memory regions of variables related to the current execution point. This snapshot is then transmitted back to the host computer development system via a communication interface. Upon receiving the data, the system does not simply display it in its raw form but performs a reverse mapping: using the symbol table and debugging information generated during compilation, it accurately maps the underlying machine state returned by the hardware back to the original C language source code line and highlights that line of code in the editing view. Simultaneously, the system parses the returned memory data and updates and displays the current values ​​of each variable in the variable monitoring window or hover tooltip based on the variable name and type. For single-step debugging, each click completes a full loop. This process allows the debugging process to be entirely based on the developer's familiar C language source code as the basic interaction unit and observation perspective, making the internal execution state of the motion controller hardware completely transparent and intuitive to the developer.

[0031] Furthermore, all modules do not operate in isolation, but are uniformly coordinated by a global, coherent program state machine. This state machine defines the set of states that the system and each program document can be in, as well as the legal transition conditions between states and the actions that trigger the transitions. This state model is strictly implemented in the interaction logic of the entire user interface. For example, when a program document enters debug mode, the state machine rules will simultaneously apply to other modules: in the navigation area, operations that might disrupt the debugging context, except for those related to stopping debugging, may be disabled in the right-click menu of the document; in the management area, the Select checkbox of the row containing the document may be locked to prevent accidental deselection or inclusion in other batch operations during debugging; in the editing area, buttons such as compile and run, in addition to debugging-related buttons, will also be disabled. This globally consistent state linkage mechanism enforces the standardization and rigor of the development process at the system level, effectively preventing problems such as inconsistent program states, hardware control conflicts, or invalid debugging data caused by user misoperation.

[0032] Example 2: Building upon the aforementioned embodiments, and considering the severely limited hardware resources of motion controllers, a dynamic and configurable optimization strategy adapter is introduced during the compilation phase of the integrated development environment. Traditional compilation optimization is typically geared towards general-purpose computing platforms, and its optimization objectives deviate from the real-time and multi-task coordination requirements of motion control scenarios. This embodiment defines a composite optimization objective function that includes weights for memory usage, worst-case execution time, and variance of inter-task scheduling intervals. The system allows developers to dynamically adjust the values ​​of different weights based on the priority of specific control tasks, thereby guiding the compiler to generate optimal executable code under specific constraints.

[0033] In the compilation settings panel of the integrated editing and debugging module, a resource optimization strategy configuration area has been added. This area provides three sliders or numerical input boxes, corresponding to memory usage weight, worst-case execution time weight, and inter-task scheduling interval variance weight, respectively, and offers several preset typical scenario templates for users to select with one click.

[0034] The system internally defines a unique optimization objective function to guide the compiler backend in selecting the optimization path. One form of this function is:

[0035] In the formula, The smaller the value of the composite optimization objective function, the better the overall performance under the given weights; To estimate program memory usage; This represents the maximum amount of memory available to the controller hardware. This represents the worst-case execution time. This is the theoretical deadline for the task; The variance of the task execution cycle interval; , and The weighting coefficients configured for the user satisfy... .

[0036] When a user triggers a compilation operation, the system not only sends the C language source code to the compiler, but also transmits the weight coefficients set by the user and the optimization requirements of the target function to the compiler backend through specific compiler instructions or configuration files.

[0037] When optimizing and generating code, the compiler backend no longer simply pursues the fastest execution speed. Instead, based on the received target function, it makes trade-off decisions in multiple optimization stages such as register allocation, loop unrolling, and instruction scheduling to generate machine code that minimizes the value of the target function.

[0038] After compilation, the system will not only display success or error messages in the output area, but also generate an optimization report that estimates and displays the performance of the generated code. , and The estimated value and the calculated comprehensive objective function value provide a quantitative basis for users to evaluate and adjust optimization strategies.

[0039] This method introduces a flexible compilation optimization strategy. On an STM32H743 ARM Cortex-M7 architecture motion controller (480MHz clock speed, equipped with 512KB SRAM), a medium-complexity control program with three independent motion axes (performing linear / circular interpolation tasks, 2ms cycle), two position PID closed-loop control loops (1ms cycle), and an asynchronous serial communication task (load rate approximately 15%) was used as the test load. The program was compared with a traditional general-purpose compilation method using a fixed optimization level. The program was compiled using two standard optimization levels provided by the GCC 11.2 compiler: fixed optimization level for code size and execution speed, and a flexible optimization strategy. Measurements were performed under simulated real-world load conditions using an instruction cycle counter and memory analysis tools. The results show that, while ensuring all tasks strictly meet their deadlines, the method reduces the average memory usage of the generated code by approximately 18% compared to the fixed optimization level; and, with similar memory usage, reduces the cycle variance of the worst-case execution time for each task by approximately 35%. This confirms that the method can achieve synergistic optimization of memory efficiency and real-time performance based on user configuration, in addition to the different single objectives emphasized by traditional fixed optimization strategies, and significantly improve the overall performance of generated code in resource-constrained real-time motion control scenarios.

[0040] Example 3: Building upon the aforementioned embodiments, this paper proposes an incremental dynamic loading mechanism for debugging information to address the issue that frequent hardware communication for data acquisition during motion control program debugging, such as breakpoint setting and variable monitoring, may interfere with real-time control tasks. Before debugging begins, this mechanism analyzes the program control flow graph and, based on user-defined breakpoints and monitoring points, predicts the most likely sequence of debugging information requests to be triggered during program execution. While ensuring the real-time performance of the main control thread, the system utilizes idle communication bandwidth or background threads to preload and cache variable memory snapshots, register states, and other information that may be needed in the next few steps. When the program actually reaches a breakpoint, the required data is partially or fully ready, thereby significantly reducing the waiting delay for debugging commands.

[0041] When a user sets breakpoints and starts debug mode, the system first performs static analysis on the current program and constructs its control flow graph. Simultaneously, it records the locations of all breakpoints and the set of monitored variables.

[0042] Starting from the current program counter position, the system analyzes the possible branches that can be executed subsequently. Based on static branch history or a simple branch probability model, an execution probability is assigned to each branch. A formula for calculating the preloading urgency of debugging information required to reach a breakpoint from the current point is:

[0043] In the formula, breakpoint The urgency of preloading; To ensure that all execution points reach the breakpoint from the current execution point Sum of predicted paths; To follow a given path Multiply the probabilities of all branches together; For path The probability that the j-th branch will be executed; To follow this path Execute from the current point to the breakpoint. The estimated number of instruction steps required.

[0044] The system calculates each breakpoint The values ​​are sorted to form a preload priority queue. An incremental preload plan is then developed, taking into account the real-time communication bandwidth budget with the hardware. For example, priority is given to preloading... The memory address mapping and current value of the variables associated with the two breakpoints with the highest values.

[0045] In addition to the main debug control thread, a low-priority background communication thread is started. According to the preloading plan, this thread sends non-intrusive memory read requests to the motion controller hardware through the real-time communication interface, and caches the acquired debug data locally.

[0046] When a user action triggers the program to stop at a breakpoint, the system first searches for the variable data corresponding to that breakpoint in the local cache. If a match is found, the debug interface is immediately updated, achieving zero-wait response. Simultaneously, the system uses this breakpoint as a new starting point to dynamically update the prediction model and preloading plan, achieving dynamic rolling updates of the debug information cache.

[0047] To quantify the actual performance of this mechanism, a comparative experiment was designed on a real motion controller hardware platform equipped with an EtherCAT bus master chip, comparing it with the traditional serial debugging mode that requests debugging data entirely on demand. In addition to the core logic containing 5 conditional branches and 3 loops, the test program added a high-priority periodic interrupt task to simulate a multi-task preemptive environment, and injected controllable timing jitter into the communication link to simulate industrial field interference. The experiment used the communication cycle as the basic unit of time, defined as the average time required for the motion controller to complete one smallest unit of read / write command interaction through its dedicated debugging interface. Under the same test program and breakpoint settings, compared with the traditional fully on-demand serial debugging mode, the average delay from issuing the continue command to fully acquiring and updating the variable values ​​at all breakpoints was 10 communication cycles. After enabling this mechanism, the delay under the same conditions was stably reduced to 1-2 communication cycles, with an absolute delay reduction of approximately 400-450 microseconds. The results show that even in a more realistic industrial scenario that simulates task preemption and communication jitter, predictive caching can significantly mitigate the delay in debugging interaction caused by communication latency, reducing the time to obtain debugging information from hundreds of microseconds to tens of microseconds, achieving near-instantaneous debugging status updates, and keeping the interference to real-time control tasks on the hardware side at an extremely low level.

[0048] Example 4: Building upon the aforementioned embodiments, this system deeply integrates domain knowledge of motion control programming into the integrated development environment, forming a context-aware intelligent assistance system. This system analyzes the code being written by the developer in real time, combining the current development process status of the program documentation, configured hardware parameters, and the semantic context of the code to proactively provide hierarchical intelligent prompts, ranging from code completion and parameter suggestions to error warnings and repair solutions. In particular, it can predict potential defects that may lead to real-time failures, resource conflicts, or control logic errors before the code is compiled and executed, and provide one-click correction or optimization suggestions, greatly improving development efficiency and code reliability.

[0049] The system has a built-in structured knowledge base that covers: detailed signatures, parameter ranges, usage examples, and real-time characteristics of all supported motion control function APIs; a library of common programming error patterns; and resource specifications of the specific motion controller hardware to be connected.

[0050] While the developer types code, the background analysis engine continues to work. It not only performs regular syntax analysis, but also semantic context analysis, including: identifying whether the function where the cursor is located is in an interrupt context, analyzing the access patterns of variables in the control loop, and evaluating the matching degree between task cycle and execution time.

[0051] Based on the analysis results and the current development process status, the system triggers different levels of intelligent suggestions. For example: In edit mode, when the user enters a motion control function name, the parameters are automatically completed, and parameter values ​​are recommended based on knowledge base suggestions. When a code pattern of calling a time-consuming function in a high-speed interrupt is detected, it is marked with a wavy line next to the code, and hovering over it displays "Warning: This call may affect the real-time performance of the interrupt response. It is recommended to move it to the main loop."

[0052] Before compilation or during saving, the system performs a deep static check. If two tasks are detected attempting to access the same physical axis with incompatible cycles, a warning message will pop up: "Conflict warning: Task A and Task B are both configured as control axis 1, but their cycles are 5ms and 10ms respectively, which may cause control conflicts. Recommendations: [1] Modify the task cycles; [2] Use a mutual exclusion mechanism; [3] Reassign the control axis."

[0053] The prompts not only point out the problem but also provide one-click or wizard-style correction solutions. For example, for errors where parameters are out of range, a slider is provided for users to adjust; for resource conflicts, a graphical interface is provided for users to reallocate the mapping relationship between tasks and resources.

[0054] The system records whether developers adopt or ignore the prompts, and with user authorization, it can anonymously feed new, verified error patterns discovered locally back to the cloud knowledge base to update and enrich the knowledge base of all users, thus enabling the continuous evolution of the system.

[0055] To objectively evaluate the actual performance of this method, a controlled comparative experiment was designed and executed, comparing it with a conventional code editor that only provides basic syntax highlighting and post-compilation error messages. The experiment selected a well-defined standard functional program as the development task. This program was required to implement the initialization of a three-axis motion controller, linear and circular interpolation motion, PID-based closed-loop position control, and simple motion fault detection and handling logic, totaling approximately 25 core functions and 1200 lines of code. The experiment recruited 24 engineers with backgrounds in motion control development but varying levels of familiarity. Using stratified random sampling, they were evenly divided into an experimental group (using an intelligent assistance system) and a control group (using a conventional editor with only basic syntax highlighting and error messages) based on their self-assessed experience level. Both groups independently completed the writing of the standard program in the same isolated development environment, with successful compilation and correct functional verification as the completion marker. The effective development time for each developer was recorded during the experiment. Statistical results showed that the average development time for the experimental group was 6.8 hours, and the average development time for the control group was 9.1 hours. Independent samples t-tests showed that the development efficiency of the experimental group was significantly higher than that of the control group. Furthermore, system log analysis revealed that, on average, each developer in the experimental group had 3.2 potential errors related to motion control logic and resource conflicts actively intercepted and corrected by the system during the coding phase. In contrast, these errors in the control group were all discovered only during the compilation or debugging phase. The results demonstrate that proactive context awareness and deep analysis can effectively prevent typical development pitfalls and significantly improve initial coding quality and overall development efficiency.

Claims

1. A motion controller program development system based on a general-purpose programming language, characterized in that, include: The program document management module is used to create, open, close, and manage the status of multiple motion control program documents, and supports unified state switching between editing, compiling, running, and debugging states. An integrated editing and debugging module is provided to offer a code editing environment that follows the syntax of a general programming language, and integrates compilation control, debugging control, and a real-time communication interface with the motion controller hardware; The compiler optimization strategy configuration module allows users to set weight coefficients for at least three optimization dimensions for motion control tasks, including memory usage weight, worst-case execution time weight, and inter-task scheduling interval variance weight. Based on the user-defined weight coefficients, it generates a composite optimization objective function to guide the compiler in performing multi-objective adaptive optimization. An adaptive compilation engine that responds to user strategy configurations and dynamically balances memory usage, real-time performance, and timing determinism during the compilation process; A multi-view interactive interface for simultaneous presentation: The program document management module outputs the program document identifier and status view; The integrated editing and debugging module provides a code editing view and debugging control panel for the currently active program document; A view of the program execution status and result output fed back by the motion controller hardware.

2. The system according to claim 1, characterized in that: The program document management module supports parallel state maintenance and batch operations on multiple program documents. The batch operations include at least unified initialization, unified compilation and uploading, and unified start and stop control of the selected documents.

3. The system according to claim 1, characterized in that: In the integrated editing and debugging module, the debugging control includes breakpoint setting, single-step execution, running to breakpoint and real-time variable monitoring functions, and the debugging command is sent to the motion controller hardware through the real-time communication interface to trigger the corresponding debugging action on the hardware.

4. The system according to claim 3, characterized in that: The debugging control function in the integrated editing and debugging module also includes: The execution path prediction and preloading unit is used to perform the following steps when the debug session starts: Perform static analysis on the current program and construct its control flow graph; Based on the control flow graph and the set breakpoints, and combined with the branch probability model, the preload urgency of each breakpoint is calculated. A preload priority queue is generated based on the preload urgency. A low-priority background communication thread asynchronously prefetches and caches variable states and memory data associated with breakpoints from the motion controller hardware according to the priority queue. When the program reaches a breakpoint, it prioritizes reading debugging data from the local cache and updating the interface.

5. The system according to claim 1, characterized in that: In the multi-view interactive interface, each program document identifier is associated with a context operation menu in the status view. The menu provides at least the following operation options: open to edit view, close view, remove from system, save the corresponding program to hardware storage, and view or set document properties.

6. The system according to claim 5, characterized in that: The operation of saving the corresponding program to the hardware memory triggers the system to write the executable instruction stream after compiling the current document code into the non-volatile storage space of the motion controller hardware through the real-time communication interface.

7. The system according to claim 1, characterized in that: The system defines a set of coherent program development process states, including: ready state, editing state, successful compilation state, running state, debugging state, and exception state; the system interface dynamically enables or disables the corresponding control function buttons according to the current main state.

8. The system according to claim 7, characterized in that: In the debug state, the system prohibits direct switching of the active program document until the debug session ends or the user actively exits the debug state.

9. A method for developing motion controller programs based on a general-purpose programming language, characterized in that: The method is implemented based on the system described in any one of claims 1-8: The method includes: Create or open one or more motion control program documents through the program document management module; In the integrated editing and debugging module, code for the currently active program document is written or modified using a general-purpose programming language; The code is compiled using the compilation control function in the integrated editing and debugging module and uploaded to the motion controller hardware via the real-time communication interface; Through the run or debug control function in the integrated editing and debugging module, instructions are sent to the motion controller hardware to trigger program execution or enter debug mode. In the program execution status and result output view of the multi-view interactive interface, the program execution flow, status feedback and data output of the motion controller hardware are monitored in real time. The execution status of multiple program documents is centrally monitored and managed in the program document management module.

10. The system according to claim 1, characterized in that: In debug mode, the method sends single-step execution or run to the next breakpoint instruction to the hardware through the debug control function; based on the execution status returned by the hardware, the system automatically highlights the currently executing line of code in the code editing view and updates the variable information in the output view.