A coupler integrating digital quantity, analog quantity and serial communication functions and a control method

By designing a coupler that integrates digital, analog and serial communication functions, the cost and space problems of multiple independent modules in the existing technology are solved, and efficient integration of functions and improvement of operation efficiency is achieved.

CN119447759BActive Publication Date: 2025-04-08SHENZHEN HUAMAO AOTE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510033426.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-09
Publication Date
2025-04-08
Estimated Expiration
2045-01-09

AI Technical Summary

Technical Problem

In the prior art, the digital input and output module, the analog acquisition control module and the serial communication module are independent of each other, resulting in that when an industrial control system needs to have these functions at the same time, multiple independent modules must be arranged separately, which increases cost and space occupation.

Method used

A coupler is designed that integrates digital analog and serial communication functions, and the serial port unit, ADC unit, DAC unit and protocol processing unit are integrated on the first PCB board, and connected to the digital processing unit on the second PCB board through the SPI interface to achieve the integration of functions.

Benefits of technology

The number of modules is reduced, the cost and space occupation is reduced, the space utilization efficiency is improved, and the overall operation efficiency is improved through reasonable task allocation and asynchronous processing mechanisms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119447759B_ABST
    Figure CN119447759B_ABST
Patent Text Reader

Abstract

The present application provides a coupler and control method integrating digital quantity, analog quantity and serial communication functions, and relates to the field of waveguide device technology. The serial port unit, ADC unit, DAC unit and protocol processing unit are integrated into the first PCB board, and the digital quantity processing unit is placed on the second PCB board and connected with the SPI interface, so as to realize the integration of digital quantity, analog quantity and serial communication functions. Compared with independent modules, the number of modules is reduced, thereby reducing the cost. At the same time, the layout difficulty of the product is reduced and the space utilization efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of waveguide devices, and in particular to a coupler and a control method integrating digital quantity, analog quantity and serial communication functions. Background Art

[0002] In the field of industrial control, the deepening of the concept of intelligent manufacturing and the continuous guidance of relevant energy-saving and efficiency-enhancing policies have prompted it to develop rapidly in the direction of miniaturization and integration. In this process, precise and efficient control is the key to ensuring the stability of the production process and improving product quality.

[0003] However, in the related art, digital input and output modules, analog acquisition control modules and serial communication modules are independently distinguished from each other during design and sale. This means that when the industrial control system needs to have the above three functions at the same time, the corresponding three independent modules must be arranged on site. In this way, a series of problems inevitably arise. From a cost perspective, the purchase of multiple independent modules will inevitably increase the cost of the production line significantly, covering the purchase cost of the module itself, the installation and commissioning cost, and the subsequent maintenance costs. In addition, when multiple independent modules are assembled, each needs to occupy a certain physical space, which adds up to a large amount of additional space. This undoubtedly increases the difficulty and complexity of the layout for some products with limited space.

[0004] Therefore, in the related art, there is no coupler that has a digital quantity input and output module, an analog quantity acquisition control module and a serial communication module at the same time. Summary of the invention

[0005] The present application provides a coupler and a control method integrating digital quantity, analog quantity and serial communication functions, which is used for a coupler to integrate an input and output module, an analog quantity acquisition control module and a serial communication module, thereby reducing costs and improving space utilization efficiency.

[0006] In the first aspect, the present application provides a coupler integrating digital quantity, analog quantity and serial communication functions, including: a first PCB board, the first PCB board is connected to the second PCB board through an SPI interface, the first PCB board is integrated with a serial port unit realizing a serial port function, an ADC unit realizing an analog quantity input function, a DAC unit realizing an analog quantity output function and a protocol processing unit responsible for protocol interaction; the first PCB board is equipped with a first timer and a second timer, the first timer is used to regulate the operation of the DAC unit, the SPI interface and the protocol processing unit, the second timer is used to regulate the operation of the serial port unit, the period of the first timer is lower than that of the second timer, and the priority is higher than that of the second timer; a second PCB board, the second PCB board is provided with a digital quantity processing unit realizing digital quantity input and output functions.

[0007] By adopting the above technical solution, the serial port unit, ADC unit, DAC unit and protocol processing unit are integrated into the first PCB board, and the digital quantity processing unit is placed on the second PCB board and connected via the SPI interface, thus realizing the integration of digital quantity, analog quantity and serial communication functions. Compared with independent modules, the number of modules is reduced, thereby reducing costs. At the same time, the difficulty of product layout is reduced and the space utilization efficiency is improved.

[0008] In combination with some embodiments of the first aspect, in some embodiments, the first PCB board triggers the first timer and the second timer during the waiting conversion completion stage of the ADC unit.

[0009] By adopting the above technical solution, the first timer and the second timer are triggered when the ADC unit is waiting for the conversion to be completed, and the ADC conversion waiting time is cleverly utilized. The first timer can handle tasks related to analog output, digital output and protocol communication in a timely manner, and the second timer handles serial communication tasks, avoiding time waste caused by task waiting and improving overall operation efficiency.

[0010] In combination with some embodiments of the first aspect, in some embodiments, after the first timer is triggered, the protocol processing unit performs protocol communication, transmits the analog output sent by the host computer to the DAC unit, and then transmits the digital output to the second PCB board through the SPI interface.

[0011] By adopting the above technical solution, after the first timer is triggered, the operation is performed in the order of the protocol processing unit, the DAC unit, and the SPI interface. The protocol processing unit quickly carries out protocol communication, promptly receives the analog output instruction issued by the host computer, and transmits it to the DAC unit, so that the analog output conversion process can be started immediately. Because the update of the analog output depends on the quick response of the instruction reception and the DAC unit, this sequential arrangement avoids the situation that may cause the analog output instruction to be delayed, such as processing the SPI transmission first, and eliminates the extra time overhead, so it can ensure that the analog output is updated in the first time, effectively reducing the analog output delay. Subsequently, the digital output is quickly transmitted to the second PCB board through the SPI interface.

[0012] In combination with some embodiments of the first aspect, in some embodiments, the first PCB board is connected to the second PCB board through a pin header.

[0013] By adopting the above technical solution, the data interaction between the two PCB boards can be effectively guaranteed to avoid data loss or errors caused by loose connection or signal interference.

[0014] In a second aspect, the present application provides a control method for a coupler integrating digital quantity, analog quantity and serial communication functions, which is applied to the coupler integrating digital quantity, analog quantity and serial communication functions in the first aspect, comprising: setting the operation sequence of the ADC unit in the main cycle of the first PCB board; making the ADC unit run with the main cycle of the first PCB board; when the first timer is triggered, the main cycle of the first PCB board is interrupted; the protocol processing unit, the DAC unit and the SPI interface are operated in sequence according to the execution sequence, and after the operation is completed, the main cycle of the first PCB board is continued; when the second timer is triggered and the first timer is not triggered, the serial port unit is started, and after the operation is completed, the main cycle of the first PCB board is continued; the operation sequence of the digital quantity processing unit is set in the main cycle of the second PCB board; the digital quantity processing unit is run with the main cycle of the second PCB board; in the second PCB board, the reception of the SPI interface is set to an interrupt mode, and the interrupt mode is that after the SPI interface transmits data, the main cycle of the first PCB board is interrupted and the data transmitted by the SPI interface is received.

[0015] By adopting the above technical solution, the ADC unit is placed in the main loop of the first PCB board and the first timer is used to interrupt the main loop to perform protocol processing, DAC and SPI interface operations, while the second timer is used to control the serial port unit to start. While the ADC conversion process is carried out in an orderly manner in the main loop, key protocol processing, analog output and related data interaction can be efficiently executed when the timer is triggered. It avoids the long waiting time caused by driving each function in sequence, such as eliminating the situation where other functions can only wait idle during ADC conversion. Through reasonable task allocation and asynchronous processing mechanism, each functional module can make full use of time resources and greatly reduce the delay of the overall cycle.

[0016] In combination with some embodiments of the second aspect, in some embodiments, the operation process of the ADC unit includes: a sending channel conversion phase, a waiting conversion completion phase, and a data obtaining phase; the time when the first timer is triggered is in the waiting conversion completion phase; the time when the second timer is triggered is in the waiting conversion completion phase.

[0017] By adopting the above technical solution, the relationship between the time of each stage of the ADC unit and the timer triggering time is clarified, ensuring that the first timer and the second timer are reasonably triggered when the ADC unit is waiting for the conversion to be completed. In this way, the first timer can handle the analog and digital output and protocol communication in a timely manner without affecting the normal operation of the ADC unit, and the second timer can handle the serial port communication, so that each functional module can be reasonably allocated and coordinated in time, avoiding functional conflicts and time waste.

[0018] In combination with some embodiments of the second aspect, in some embodiments, after the SPI interface completes operation, the second timer is triggered.

[0019] By adopting the above technical solution, the second timer is triggered after the SPI interface is completed, so that the startup timing of the serial port unit is connected with the SPI interface data transmission. This avoids data backlog or transmission delay caused by the serial port unit starting too early or too late, and ensures smooth data transmission between different functional modules.

[0020] In combination with some embodiments of the second aspect, in some embodiments, the period of the first timer is 1 millisecond; the period of the second timer is 1.5 milliseconds.

[0021] By adopting the above technical solution, this timer cycle setting and priority arrangement ensures the timely processing of important tasks, takes into account different functional requirements, and improves the overall performance and stability of the coupler.

[0022] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:

[0023] 1. The serial port unit, ADC unit, DAC unit and protocol processing unit are integrated on the first PCB board, and the digital quantity processing unit is placed on the second PCB board and connected with the SPI interface, thus realizing the integration of digital quantity, analog quantity and serial communication functions. Compared with independent modules, the number of modules is reduced, thus reducing the cost. At the same time, the layout difficulty of the product is reduced and the space utilization efficiency is improved.

[0024] 2. Place the ADC unit in the main loop of the first PCB board and use the first timer to interrupt the main loop to perform protocol processing, DAC and SPI interface operations, and use the second timer to control the serial port unit to start. While the ADC conversion process is carried out in an orderly manner in the main loop, key protocol processing, analog output and related data interaction can be efficiently executed when the timer is triggered. It avoids the long waiting time caused by driving each function in sequence, such as eliminating the situation where other functions can only wait idle during ADC conversion. Through reasonable task allocation and asynchronous processing mechanism, each functional module can make full use of time resources and greatly reduce the delay of the overall loop. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 It is a structural schematic diagram of a coupler integrating digital quantity, analog quantity and serial communication functions in an embodiment of the present application.

[0026] Figure 2 It is a flow chart of a control method of a coupler integrating digital quantity, analog quantity and serial communication functions in an embodiment of the present application. DETAILED DESCRIPTION

[0027] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more listed items.

[0028] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.

[0029] A coupler integrating digital quantity, analog quantity and serial communication functions, comprising:

[0030] A first PCB board, the first PCB board is connected to the second PCB board through an SPI interface, and the first PCB board is integrated with a serial port unit realizing a serial port function, an ADC unit realizing an analog input function, a DAC unit realizing an analog output function, and a protocol processing unit responsible for protocol interaction;

[0031] The first PCB board is equipped with a first timer and a second timer, the first timer is used to regulate the operation of the DAC unit, the SPI interface and the protocol processing unit, and the second timer is used to regulate the operation of the serial port unit. The period of the first timer is lower than that of the second timer, and the priority of the first timer is higher than that of the second timer;

[0032] The second PCB board is provided with a digital quantity processing unit realizing digital quantity input and output functions.

[0033] Among them, the SPI interface is a serial peripheral interface, which is used to indicate the channel for high-speed, full-duplex data transmission between the first PCB board and the second PCB board. It follows specific communication protocols and electrical specifications to achieve efficient data interaction. The serial port unit refers to a circuit module that can realize the serial port communication function, which is used to indicate that the unit can send and receive data according to different serial port standards to meet the serial port communication requirements with external devices or host computers. The ADC unit refers to an analog input conversion unit, which is used to indicate that it can convert the continuously changing analog signal input from the outside for subsequent digital processing and analysis. The DAC unit refers to an analog output conversion unit, which is used to indicate that it can convert digital signals into analog signal outputs to drive external analog execution devices. The protocol processing unit refers to a circuit module responsible for processing the communication protocol, which is used to indicate that the unit can parse and construct the protocol data required for communication between different devices to ensure the accuracy and integrity of data transmission. The digital quantity processing unit refers to a circuit module on the second PCB board, which is used to indicate that it can process external digital quantity signals, and can also output internally generated digital quantity signals to external digital quantity devices, etc.

[0034] It can be seen that the serial port unit, ADC unit, DAC unit and protocol processing unit are integrated into the first PCB board, and the digital quantity processing unit is placed on the second PCB board and connected with the SPI interface, thus realizing the integration of digital quantity, analog quantity and serial communication functions. Compared with independent modules, the number of modules is reduced, thus reducing the cost. At the same time, the difficulty of product layout is reduced and the space utilization efficiency is improved.

[0035] In some embodiments, the first PCB board triggers the first timer and the second timer during the waiting conversion completion stage of the ADC unit.

[0036] At this stage, since the coupler makes full use of time and improves the collaborative efficiency of each functional module, the first timer and the second timer will be triggered. After the first timer is triggered, it starts working according to the set cycle (for example, set to 1 millisecond). First, the protocol processing unit will be started. The protocol processing unit will quickly establish a communication connection with the host computer, receive various types of information sent by the host computer according to the agreed communication protocol, and then pass the received instructions related to analog output to the DAC unit. The DAC unit converts the corresponding digital quantity signal into an analog quantity signal according to the instruction and outputs it to the corresponding control port, driving the external analog quantity device to perform the corresponding action. At the same time, the first PCB board will also transmit the relevant digital quantity data to the second PCB board through the SPI interface for subsequent processing. After the second timer is triggered (assuming that its cycle is set to 1.5 milliseconds), it will start the serial port unit. The serial port unit will organize and encapsulate the current operating status data of the coupler into a data frame that conforms to the protocol format according to the set serial port communication protocol, and send it to the host computer through the serial port line, or receive other control instructions, parameter configuration information, etc. sent by the host computer, so as to realize the information interaction between the coupler and the outside. By triggering these two timers at the same time when the ADC unit is waiting for the conversion to be completed, different functions such as analog output control, data interaction and serial communication can be carried out in parallel, avoiding the time waste caused by the execution of each function in sequence and improving the operating efficiency and real-time performance of the entire coupler.

[0037] It can be seen that the first timer and the second timer are triggered when the ADC unit is waiting for the conversion to be completed, which cleverly utilizes the ADC conversion waiting time. The first timer can handle tasks related to analog output, digital output and protocol communication in a timely manner, and the second timer handles serial communication tasks, avoiding time waste caused by task waiting and improving overall operation efficiency.

[0038] In some embodiments, after the first timer is triggered, the protocol processing unit performs protocol communication, transmits the analog output sent by the host computer to the DAC unit, and then transmits the digital output to the second PCB board through the SPI interface.

[0039] It can be seen that after the first timer is triggered, the operation is performed in the order of the protocol processing unit, the DAC unit, and the SPI interface. The protocol processing unit quickly carries out protocol communication, promptly receives the analog output instruction issued by the host computer, and transmits it to the DAC unit, so that the analog output conversion process can be started immediately. Because the update of the analog output depends on the quick response of the instruction reception and the DAC unit, this sequential arrangement avoids the situation that may cause the analog output instruction to be delayed, such as processing the SPI transmission first, and eliminates the additional time overhead, so it can ensure that the analog output is updated in the first time, effectively reducing the analog output delay. Subsequently, the digital output is quickly transmitted to the second PCB board through the SPI interface.

[0040] In some embodiments, the first PCB board is connected to the second PCB board via a pin header.

[0041] It can be seen that the data interaction between the two PCB boards can be effectively guaranteed to avoid data loss or errors caused by loose connection or signal interference.

[0042] Before describing the control method of the above-mentioned coupler integrating digital quantity, analog quantity and serial communication functions, the problems in the actual use process are described first; taking the first PCB board as an example, since it needs to achieve multiple functions such as analog input (i.e., "ADC function"), analog output (i.e., "DAC function"), serial communication (i.e., "COM function") and protocol communication, the entire coupler architecture becomes more complicated. In this process, a large number of timing arrangements and delay waiting problems are involved. For example, the time consumed to drive the ADC is between 4 and 60 milliseconds, which is closely related to the ADC sampling rate. The higher the sampling rate, the shorter the time consumption, but the greater the result fluctuation; driving the DAC only takes 0.5 milliseconds; driving the serial communication takes a range of 0.1 to 0.4 milliseconds, and the more serial ports are opened, the longer the delay; driving the SPI to interact with the second PCB board for data requires 0.2 milliseconds. If the ADC (ADC unit), DAC (DAC unit), COM (serial port unit) and SPI (SPI interface) are driven in sequence in one cycle, the entire cycle will take 4.8 to 60.8 milliseconds. Such a long delay is unacceptable and will seriously affect the response speed and control accuracy of the product.

[0043] The control method applied to the above-mentioned coupler integrating digital quantity, analog quantity and serial communication functions includes:

[0044] S101, setting the operation sequence of the ADC unit in the main cycle of the first PCB board; making the ADC unit run along with the main cycle of the first PCB board;

[0045] In some embodiments, the operation sequence of the ADC unit is set in the main loop of the first PCB board, which means that the ADC unit becomes a part of this loop process and will perform operations according to the established order and rhythm of the main loop. During each cycle of the main loop, the ADC unit will continue to detect whether there is a signal input from the externally connected analog signal source. Once a valid analog signal is detected, it will immediately start its internal conversion process, first perform a sampling operation, discretize the analog signal according to the set sampling frequency, and then quantize the sampled signal and convert it into a digital signal. These digital signals will then be temporarily stored, waiting for subsequent other functional modules to further process or be used for analysis and judgment operations within the coupler, so as to ensure that the analog input function is stably and orderly integrated into the entire coupler operation.

[0046] S102, when the first timer is triggered, the main loop of the first PCB board is interrupted; the protocol processing unit, the DAC unit and the SPI interface are operated in sequence according to the execution order, and after the operation is completed, the main loop of the first PCB board is continued;

[0047] In some embodiments, when the first timer is triggered, since the first timer generates a timing signal according to its pre-set cycle (such as 1 millisecond), the main loop of the first PCB board will interrupt the current operation process. Then, according to the execution order, the protocol processing unit is started first, and it will quickly establish a communication connection with the host computer or other associated devices, and receive various types of data or instructions issued by the host computer according to the previously agreed communication protocol. After completing the communication interaction, the relevant analog output instructions are then accurately passed to the DAC unit. After receiving the instruction, the DAC unit will convert the corresponding digital quantity signal into an analog quantity signal through its internal digital-to-analog conversion circuit according to the instruction content, and output it to the corresponding external device port to drive the external analog quantity device to perform the corresponding action. After that, the first PCB board will transmit the digital quantity data to the second PCB board through the SPI interface, and transmit the data according to the communication protocol of the SPI interface. After completing this series of operations, the coupler will restore the main loop of the first PCB board and continue the subsequent other task processes, so as to ensure the efficiency and timeliness of analog output and related data interaction, and avoid the situation of chaotic execution order or long waiting between various functions.

[0048] S103, when the second timer is triggered and the first timer is not triggered, the serial port unit is started, and after the operation is completed, the main cycle of the first PCB board is continued;

[0049] In some embodiments, when the second timer is triggered and the first timer is not triggered, the serial port unit is started. The serial port unit will start to execute the corresponding communication task according to its pre-configured serial communication protocol. If it is to send data to the host computer, it will first obtain the coupler status information from the relevant storage area on the first PCB board, and then encapsulate the data in the format specified by the serial communication protocol, and send the data bit by bit to the host computer through the serial port line; if it is to receive data sent by the host computer, the serial port unit will monitor the level changes on the serial port line in real time. Once it detects that there is data incoming, it will unpack the data according to the protocol, extract the instructions or data content therein, and use it for subsequent processing in the coupler. After completing these serial communication tasks, the coupler will continue the main cycle of the first PCB board to ensure that the entire coupler can orderly perform data interaction and task execution while taking into account the needs of different functional modules, so as to avoid conflicts between serial communication and other functions and affect the normal operation of the coupler.

[0050] S104, setting the operation sequence of the digital quantity processing unit in the main cycle of the second PCB board; making the digital quantity processing unit run along with the main cycle of the second PCB board;

[0051] In some embodiments, during each cycle of the main cycle of the second PCB board, the digital quantity processing unit will continuously detect whether there is a digital quantity signal input from the externally connected digital quantity signal source. Once a valid digital quantity signal is received, it will be processed according to a pre-set processing rule, such as first passing through a filtering circuit to remove clutter interference in the signal, and then performing a logical judgment to determine whether the digital quantity signal meets certain preset logical conditions, and decide whether to output the corresponding digital quantity signal to control the external digital quantity device based on the judgment result. At the same time, the digital quantity processing unit can also output the digital quantity signal generated internally to the external digital quantity device through the corresponding output port, so as to realize the stable and orderly operation of the digital quantity input and output function on the second PCB board.

[0052] S105. In the second PCB board, the reception of the SPI interface is set to an interrupt mode. The interrupt mode is that after the SPI interface transmits data, the main cycle of the first PCB board is interrupted to receive the data transmitted by the SPI interface.

[0053] In some embodiments, when the first PCB board needs to transmit important data to the second PCB board through the SPI interface, or the second PCB board waits to receive key data from the first PCB board, it is the time for this step to be executed, which is common in industrial control scenarios where data is frequently exchanged between two PCB boards. In the second PCB board, the reception of the SPI interface is set to interrupt mode, which means that once the SPI interface starts to transmit data, no matter what task the main loop of the first PCB board is performing at that time, the main loop will be interrupted immediately. Then the coupler will quickly switch to the processing flow of SPI interface data reception, according to the communication protocol of the SPI interface, the transmitted data is received bit by bit, and the corresponding verification operation is performed to ensure the accuracy of the data, and the received data is stored in a pre-set cache area, waiting for the digital quantity processing unit or other related functional modules on the subsequent second PCB board to be further processed. After completing the reception and preliminary processing of the SPI interface data, the coupler will restore the main loop of the first PCB board and continue the task flow that was interrupted before. Through this interrupt mode, it can be guaranteed that during the SPI interface data transmission process, the data will not be delayed due to other tasks of the main loop, which improves the efficiency and reliability of data interaction between the two PCB boards and ensures smooth data flow of the entire industrial control system.

[0054] It can be seen that the ADC unit is placed in the main loop of the first PCB board and the first timer is used to interrupt the main loop to perform protocol processing, DAC and SPI interface operations, while the second timer is used to control the serial port unit to start. While the ADC conversion process is carried out in an orderly manner in the main loop, the key protocol processing, analog output and related data interaction can be efficiently executed when the timer is triggered. It avoids the long waiting caused by driving each function in sequence, such as eliminating the situation where other functions can only wait idle during ADC conversion. Through reasonable task allocation and asynchronous processing mechanism, each functional module can make full use of time resources and greatly reduce the delay of the overall cycle.

[0055] In some embodiments, the operation process of the ADC unit includes: a sending channel conversion phase, a waiting conversion completion phase, and a data acquisition phase;

[0056] The time when the first timer is triggered is in the stage of waiting for the conversion to be completed; the time when the second timer is triggered is in the stage of waiting for the conversion to be completed.

[0057] In the stage of waiting for the conversion to be completed, since the ADC unit itself needs a certain amount of time to perform the conversion operation, if you simply wait for it to complete the conversion during this period, it will cause idle waste of coupler resources. Therefore, the first timer is triggered according to its set period (for example, set to 1 millisecond). When the trigger occurs, the protocol processing unit will be started first. The protocol processing unit will quickly establish a communication connection with the host computer or other related devices, and receive various types of data or instructions from the outside according to the pre-set communication protocol. After completing the communication interaction, the relevant analog output instructions will be accurately passed to the DAC unit. After receiving the instruction, the DAC unit will convert the corresponding digital signal into an analog signal through its internal digital-to-analog conversion circuit according to the instruction content, and output it to the corresponding external device port to drive the external analog device to perform the corresponding action. At the same time, the first PCB board will transmit the digital data that needs to be transmitted to the second PCB board through the SPI interface, such as some status information that controls the digital devices on the second PCB board, and transmit the data according to the communication protocol of the SPI interface. By triggering the first timer and executing related functions at this stage, the analog conversion process and other key functions (such as analog output, data interaction, etc.) are processed in parallel, thereby improving the overall operating efficiency and real-time performance of the coupler.

[0058] Similarly, in the stage of waiting for the conversion to be completed, the second timer is triggered according to its set cycle (for example, set to 1.5 milliseconds), and the serial port unit is started after being triggered. The serial port unit will start to perform the corresponding communication task according to its pre-configured serial communication protocol. If it is sending data to the upper computer, it will first obtain the coupler status information such as the current operating parameters of the device and the data collected by the sensor from the relevant storage area on the first PCB board, and then encapsulate the data in the format specified by the serial communication protocol, and send the data bit by bit to the upper computer through the serial port line; if it is receiving data sent by the upper computer, the serial port unit will monitor the level changes on the serial port line in real time. Once it detects that there is data incoming, it will unpack the data according to the protocol and extract the instructions or data content for subsequent processing in the coupler, such as adjusting the operating status of the device according to the received control instructions. By triggering the second timer to perform the serial communication task when the ADC unit is waiting for the conversion to be completed, this time is fully utilized, so that the coupler can exchange information with the outside in a timely manner while performing analog conversion, thereby improving the overall operation efficiency and functionality of the coupler.

[0059] It can be seen that the relationship between the time of each stage of the ADC unit and the timer trigger time is clarified to ensure that the first timer and the second timer are reasonably triggered when the ADC unit is waiting for the conversion to be completed. In this way, the first timer can handle the analog and digital output and protocol communication in a timely manner without affecting the normal operation of the ADC unit, and the second timer can handle the serial port communication, so that each functional module can be reasonably allocated and coordinated in time, avoiding functional conflicts and time waste.

[0060] In some embodiments, after the SPI interface operation is completed, the second timer is triggered.

[0061] In some embodiments, after the SPI interface is completed, it means that the data has been successfully transmitted from the first PCB board to the second PCB board according to the communication protocol of the SPI interface. At this time, the second timer is triggered, and it starts working according to the set period (such as 1.5 milliseconds), thereby driving the serial port unit to start. Through such a sequential arrangement, it is ensured that after the SPI interface data transmission is completed, the serial port communication task can be carried out in time, and the orderly connection of data interaction and information feedback between different functional modules of the coupler is realized, thereby improving the overall coordination and operation efficiency of the coupler.

[0062] It can be seen that the second timer is triggered after the SPI interface is completed, so that the startup timing of the serial port unit is connected with the SPI interface data transmission. This avoids data backlog or transmission delay caused by the serial port unit starting too early or too late, and ensures smooth data transmission between different functional modules.

[0063] The period of the first timer is 1 millisecond; the period of the second timer is 1.5 milliseconds.

[0064] It can be seen that this timer cycle setting and priority arrangement ensures the timely processing of important tasks, takes into account different functional requirements, and improves the overall performance and stability of the coupler.

[0065] In summary, the analog output delay is jointly determined by the first timer regulating part of the process and the second timer participating in the overall coordination. For example, the sum of the two times is 2.5 milliseconds. The serial communication (COM) delay is also because its operation is affected by the pre-influence of the related operations triggered by the first timer and the second timer directly triggers the serial port unit to work, so the cumulative duration is 2.5 milliseconds. The increase in digital input and output delay is due to the fact that the relevant data processing and SPI interface transmission will take a certain amount of time when the first timer is triggered, which is 1.1 milliseconds more in total. The analog input single channel delay is 1 millisecond more because in its critical waiting conversion completion stage, the first timer will trigger other operations, which will slightly delay the process of analog input, but it can achieve the integration and optimization of the coupler function. Compared with pure analog modules, pure digital modules and COM modules, this coupler has a slight delay increment during the function integration process due to the timer coordinating the collaborative work of various functional modules, but in return, multiple functions are integrated into one device. This avoids the complicated process and high cost of purchasing, installing, debugging and maintaining multiple independent modules separately, while reducing the large amount of space occupied by the dispersed layout of multiple modules. Considering the cost control and space utilization of the overall coupler, it has great advantages and value, and can better meet the needs of the industrial control field for efficient, economical and integrated couplers.

[0066] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

[0067] As used in the above embodiments, the term "when..." may be interpreted to mean "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. Similarly, the phrases "upon determining..." or "if (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.

Claims

1. A coupler integrating digital quantity, analog quantity and serial communication functions, characterized in that: include: A first PCB board, wherein the first PCB board is connected to the second PCB board via an SPI interface, wherein a serial port unit for realizing a serial port function, an ADC unit for realizing an analog input function, a DAC unit for realizing an analog output function, and a protocol processing unit responsible for protocol interaction are integrated on the first PCB board; a first timer and a second timer are provided on the first PCB board, wherein the first timer is used to regulate the operation of the DAC unit, the SPI interface, and the protocol processing unit, and the second timer is used to regulate the operation of the serial port unit, wherein the period of the first timer is lower than that of the second timer, and the priority of the first timer is higher than that of the second timer; The second PCB board is provided with a digital quantity processing unit realizing digital quantity input and output functions; The first PCB board triggers the first timer and the second timer during the waiting conversion completion stage of the ADC unit; after the first timer is triggered, the protocol processing unit performs protocol communication, transmits the analog output sent by the host computer to the DAC unit, and then transmits the digital output to the second PCB board through the SPI interface.

2. The coupler according to claim 1, characterized in that The first PCB board is connected to the second PCB board via a pin header.

3. A control method for a coupler integrating digital quantity, analog quantity and serial communication functions, characterized in that: The coupler integrating digital quantity, analog quantity and serial communication functions as claimed in any one of claims 1 to 2 comprises: The operation sequence of the ADC unit is set in the main cycle of the first PCB board; the ADC unit is operated along with the main cycle of the first PCB board; When the first timer is triggered, the main loop of the first PCB board is interrupted; the protocol processing unit, the DAC unit and the SPI interface are operated in sequence according to the execution order, and after the operation is completed, the main loop of the first PCB board is continued; When the second timer is triggered and the first timer is not triggered, the serial port unit is started, and after the operation is completed, the main cycle of the first PCB board is continued; The operation sequence of the digital quantity processing unit is set in the main cycle of the second PCB board; the digital quantity processing unit is operated along with the main cycle of the second PCB board; In the second PCB board, the reception of the SPI interface is set to an interrupt mode, and the interrupt mode is that after the SPI interface transmits data, the main cycle of the first PCB board is interrupted to receive the data transmitted by the SPI interface.

4. The method according to claim 3, characterized in that The operation process of the ADC unit includes: a sending channel conversion stage, a waiting conversion completion stage, and a data acquisition stage; The time when the first timer is triggered is in the waiting conversion completion stage; The time when the second timer is triggered is in the stage of waiting for the conversion to be completed.

5. The method according to claim 3, characterized in that: After the SPI interface is completed, the second timer is triggered.

6. The method according to claim 3, characterized in that The period of the first timer is 1 millisecond; the period of the second timer is 1.5 milliseconds.

Citation Information

Patent Citations

  • Printed board circuit automatic test system and test method

    CN117347817A

  • High speed data transfer for analog-to-digital converters

    US20160204791A1