A multi-channel sampling method, system, storage medium and electronic device

By automatically switching the event signal connection of the multi-channel PWM module with the SAR ADC, and using the asynchronous event acquisition arbitrator to set the PWM priority, the sampling channel disorder caused by false triggering in the multi-motor control system is solved, and sampling reliability is improved and the microcontroller area is saved.

CN114421816BActive Publication Date: 2025-06-24GREE ELECTRIC APPLIANCE INC OF ZHUHAI +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111522529.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-13
Publication Date
2025-06-24
Estimated Expiration
2041-12-13

AI Technical Summary

Technical Problem

In the existing multi-motor control system, when a single-chip microcontroller coordinates the control process of multiple motors, it is easy to cause sampling channels to be disordered due to error triggering, affecting the real-time control of the motor and the accuracy of current sampling.

Method used

By automatically switching the event signal connection of the multi-channel PWM module with the SAR ADC, the corresponding relationship between the multi-channel PWM and the ADC is configured using the pre-configured connection configuration data, the corresponding relationship between the multiple ADC channel is automatically triggered, and the priority of the PWM is set through the asynchronous event acquisition arbitrator to avoid channel disorder caused by false triggering.

Benefits of technology

It improves sampling reliability in multi-motor control systems, avoids sampling channel disorder caused by false triggering, saves microcontroller area, and supports multiple PWM asynchronous event signals to trigger ADC sampling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114421816B_ABST
    Figure CN114421816B_ABST
Patent Text Reader

Abstract

The present invention discloses a multi-channel sampling method, system, storage medium and electronic device. The multi-channel sampling method includes: receiving an event acquisition instruction, configuring the corresponding relationship between multiple PWMs and ADCs according to the first set of configuration data in the pre-configured connection configuration data, and enabling event acquisition; when a PWM event signal is acquired, continuously sending a sampling trigger signal for a preset number of sampling channels to the ADC corresponding to the PWM, triggering the ADC channel corresponding to the PWM to perform sampling; if the sampling of all channels of the ADC corresponding to the PWM has been completed, sending a synchronization signal to the ADC corresponding to the PWM to cause the ADC corresponding to the PWM to start sampling from the starting sampling channel. Since it can automatically switch the event signal connection between multiple PWM modules and the SAR ADC, and also supports asynchronous triggering of multiple groups of channels of the ADC by the event signals of multiple PWM modules, it is convenient to use; it avoids the continuous disorder of sampling channels due to a single mis-triggering, improving the reliability; it can share a high-speed SAR ADC module, greatly saving the area of the microcontroller.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of ADC multi-channel sampling, and particularly to a multi-channel sampling method, system, storage medium and electronic device. Background Art

[0002] Since a single chip controls multiple motors, which has advantages such as high reliability, convenience and low cost for coordinating the control processes of multiple motors, a multi-motor control system often requires a microcontroller to provide a single-chip solution. For example, a microcontroller for multi-motor control usually includes multiple PWM modules and multiple SAR ADCs. A single-channel or dual-channel high-speed SAR ADC (5MSPS) can meet the real-time current sampling requirements of a multi-motor control system in a multi-channel sharing manner. The multiple PWM modules may trigger the ADC sampling actions of multiple channels in real time at any time, and a single PWM module can also trigger different ADC sampling channels at different times.

[0003] Currently, a microcontroller generally uses real-time event signal lines to transmit real-time events between different modules. The event signals of multiple SAR ADCs and the event signals of multiple PWM modules are connected in a cross matrix manner. At the same time, a single SAR ADC is only connected to the event signal of a single PWM module. Therefore, it is necessary for the user to switch the connections of the multiple PWM modules and the SAR ADCs in turn to automatically trigger the sampling of multiple ADC channels. However, once a mis-trigger occurs, it may cause the sampling data to continuously have channel confusion and cannot be restored, and the motor will also face the risk of out-of-control due to the failure of current sampling. Summary of the Invention

[0004] In view of the above problems, the present invention provides a multi-channel sampling method, system, storage medium and electronic device. It can automatically switch the connection of the event signals between multiple PWM modules and the SAR ADC, which is convenient to use; it avoids the continuous confusion of sampling channels due to a single mis-trigger, improving the reliability of sampling; the current sampling of a multi-motor control system can share a single high-speed SAR ADC module, greatly saving the area of the microcontroller.

[0005] In the first aspect of the present invention, a multi-channel sampling method is provided, and the method includes:

[0006] Receiving an event acquisition instruction, configuring the correspondence between multiple PWMs and ADCs according to the first set of configuration data in the pre-configured connection configuration data, and starting event acquisition;

[0007] When a PWM event signal is acquired, continuously sending a sampling trigger signal of a preset number of sampling channels to the ADC corresponding to the PWM to trigger the ADC channel corresponding to the PWM to perform sampling;

[0008] If the sampling of all channels of the ADC corresponding to the PWM has been completed, a synchronization signal is sent to the ADC corresponding to the PWM, causing the ADC corresponding to the PWM to start sampling from the starting sampling channel.

[0009] In some embodiments, the pre-configured connection configuration data includes the event signal connection configuration between the multi-channel PWM module and the ADC.

[0010] In some embodiments, the pre-configured connection configuration data is stored in the event acquisition buffer.

[0011] In some embodiments, it is stored in the event acquisition buffer in a preset order.

[0012] In some embodiments, if all channel samplings are not completed, the corresponding relationship between the multi-channel PWM and the ADC is automatically configured according to the next set of configuration data in the pre-configured connection configuration data, and event acquisition is restarted.

[0013] In some embodiments, configuring the corresponding relationship between the multi-channel PWM and the ADC includes:

[0014] Connecting the multi-channel PWM and the multi-channel ADC through a cross matrix, where the event signal line of any one PWM is connected to the sampling trigger signal line of any one ADC through the cross matrix.

[0015] In some embodiments, the method further includes:

[0016] Setting the priority of the PWM through an asynchronous event acquisition arbiter;

[0017] When event signals of at least two PWMs are simultaneously acquired, the acquired event signals are processed in sequence according to the priority order of the PWMs.

[0018] In a second aspect of the present invention, a multi-channel sampling system is provided, and the system includes:

[0019] A configuration unit, configured to receive an event acquisition instruction, configure the corresponding relationship between the multi-channel PWM and the ADC according to the first set of configuration data in the pre-configured connection configuration data, and start event acquisition;

[0020] A sampling unit, configured to continuously send a sampling trigger signal of a preset number of sampling channels to the ADC corresponding to the PWM when a PWM event signal is acquired, triggering the ADC corresponding to the PWM to perform channel sampling;

[0021] A synchronization unit, configured to send a synchronization signal to the ADC corresponding to the PWM if the sampling of all channels of the ADC corresponding to the PWM has been completed, causing the ADC corresponding to the PWM to start sampling from the starting sampling channel.

[0022] In a third aspect of the present invention, there is provided a storage medium storing a computer program executable by one or more processors to implement the multi-channel sampling method as described above.

[0023] In a fourth aspect of the present invention, there is provided an electronic device including a memory and a processor, wherein a computer program is stored on the memory, and the memory and the processor are communicatively connected to each other. When the computer program is executed by the processor, the multi-channel sampling method as described above is implemented.

[0024] Compared with the prior art, the technical solution of the present invention has the following advantages or beneficial effects:

[0025] It can automatically switch the event signal connection between multiple PWM modules and the SAR ADC, which is convenient to use; it avoids the continuous confusion of sampling channels due to a single mis-trigger, improving the reliability; the current sampling of the multi-motor control system can share a high-speed SAR ADC module, greatly saving the area of the microcontroller. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts.

[0027] Figure 1 It is a flowchart of a multi-channel sampling method provided by an embodiment of the present application;

[0028] Figure 2 It is a schematic diagram of automatic triggering of ADC multi-channel sampling and synchronization by multiple PWM modules provided by an embodiment of the present application;

[0029] Figure 3 It is a schematic diagram of asynchronous triggering of multiple groups of ADC channel sampling by multiple PWM events provided by an embodiment of the present application;

[0030] Figure 4 It is a schematic diagram of a multi-channel sampling system provided by an embodiment of the present application;

[0031] Figure 5 It is a connection block diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0032] The embodiments of the present application will be described in detail below in conjunction with the accompanying drawings and examples, so as to fully understand how the present application uses technical means to solve technical problems and the implementation process of achieving corresponding technical effects and implement accordingly. The embodiments of the present application and each feature in the embodiments can be combined with each other on the premise of not conflicting, and the formed technical solutions are all within the protection scope of the present application.

[0033] Embodiment 1

[0034] This embodiment provides a multi-channel sampling method. Figure 1 It is a flowchart of a multi-channel sampling method provided by an embodiment of the present application. As Figure 1 shown, the method of this embodiment includes:

[0035] S100. Receive an event acquisition instruction, configure the correspondence between multiple channels of PWM and ADC according to the first set of configuration data in the pre-configured connection configuration data, and start event acquisition.

[0036] In some embodiments, the pre-configured connection configuration data includes the event signal connection configuration between multiple PWM modules and the ADC.

[0037] In some embodiments, the pre-configured connection configuration data is stored in the event acquisition buffer.

[0038] Optionally, in the dual-motor sensorless vector control, in order to stagger the running time of the control algorithm, the control algorithm is run in the interrupt handling program after the two-phase current sampling is completed, and two channels of PWM are used to trigger two groups of ADC sampling channels at staggered times. Among them, each channel of PWM triggers a group of ADC sampling channels every two cycles. For example, the first channel of PWM1 samples the two-phase current of the first motor in odd cycles, and the second channel of PWM2 samples the two-phase current of the second motor in even cycles.

[0039] For example, the connection configuration data 00 indicates the connection between PWM1 and the first group of sampling channels of ADC1, and the connection configuration data 01 indicates the connection between PWM2 and the second group of sampling channels of ADC1. If both the connection between PWM1 and the first group of sampling channels of ADC1 and the connection between PWM2 and the second group of sampling channels of ADC1 are required, then the two groups of configurations 00 and 01 need to be written in the event acquisition buffer.

[0040] It should be noted that the connection configuration data is stored in the event acquisition buffer in a preset order, including: sequentially writing the connection configuration data and storing it in the written order. As Figure 2 shown, Figure 2 It is a schematic diagram of automatic triggering of multi-channel sampling and synchronization of multiple PWM modules to the ADC provided by an embodiment of the present application.

[0041] In some embodiments, the PWM module is the Pulse Width Modulation module, and the ADC includes the SAR ADC, i.e., the Successive Approximation Register Analog-to-Digital Converter.

[0042] In some embodiments, configuring the correspondence between multiple PWMs and ADCs includes:

[0043] Connecting multiple PWMs and multiple ADCs through a cross matrix, where the event signal line of any one PWM is connected to the sampling trigger signal line of any one ADC through the cross matrix.

[0044] In some embodiments, the connection configuration data can be obtained from the event acquisition buffer through the event module.

[0045] The event module is a signal connection management module between various peripheral modules of the microcontroller or between external and internal modules, and can trigger the real-time operation of peripherals at high speed, such as the real-time acquisition of the ADC.

[0046] Specifically, the event module takes out the first connection configuration data 00 from the event acquisition buffer and writes 00 into the configuration register of the cross matrix of multiple PWMs and ADC1, so that PWM1 is connected to the first group of sampling channels of ADC1.

[0047] S200. When the PWM event signal is collected, continuously send a sampling trigger signal with a preset number of sampling channels to the ADC corresponding to the PWM, and trigger the ADC channel corresponding to the PWM to perform sampling.

[0048] In the above dual-motor sensorless vector control, the number of sampling channels is set to 2. After the event module collects the overflow or underflow event of PWM1, the event module continuously sends two event signals to ADC1, triggering two consecutive channels of ADC1 to sample the two-phase current.

[0049] In some embodiments, the multi-channel sampling method further includes:

[0050] If all channel samplings are not completed, automatically configure the correspondence between multiple PWMs and ADCs according to the next set of configuration data in the pre-configured connection configuration data, and restart the event acquisition.

[0051] If not all channels have been sampled and the sampling trigger signal for the first group of channels has been sent, the event module retrieves the second connection configuration data 01 from the event acquisition buffer and writes the connection configuration data 01 into the configuration register of the cross matrix of the multi-channel PWM and ADC1, so that PWM2 is connected to the second group of sampling channels of ADC1, and then continues to execute step S200.

[0052] S300. If sampling of all channels of the ADC corresponding to the PWM has been completed, a synchronization signal is sent to the ADC corresponding to the PWM to cause the ADC corresponding to the PWM to start sampling from the starting sampling channel.

[0053] In some embodiments, the default sampling channel includes channel 0. After the ADC is reset to the default sampling channel, the next sampling starts from this default sampling channel, that is, event sampling restarts from this default sampling channel.

[0054] In the above dual-motor sensorless vector control, after all channel groups of ADC1 have been sampled, the event module sends a synchronization signal to ADC1 to force ADC1 to start sampling from sampling channel 0 next time, and at the same time, the current pointer of the event acquisition buffer points back to the connection configuration data 00.

[0055] In some embodiments, the multi-channel sampling method further includes:

[0056] Setting the priority of the PWM through the asynchronous event acquisition arbiter;

[0057] When event signals of at least two PWMs are simultaneously collected, the collected event signals are processed in sequence according to the priority order of the PWMs.

[0058] In some embodiments, processing the collected event signals in sequence according to the priority order of the PWMs includes the content described in step S200.

[0059] As Figure 3 shown, Figure 3 FIG. is a schematic diagram of asynchronous triggering of multi-group ADC channel sampling by multi-channel PWM events provided by an embodiment of the present application. In dual-motor sensorless vector control, if the user cannot arrange the sampling moments of multi-channel motor currents at staggered times, the asynchronous event acquisition arbiter of the event module can be started. Multiple trigger signal connection lines can be set between the asynchronous event acquisition arbiter and the ADC, including trigger signal lines and synchronization signal lines. Among them, one channel group corresponds to a group of trigger signal lines.

[0060] Specifically, the first PWM1 triggers ADC1 to collect the two-phase current of the first motor, and the second PWM2 triggers ADC1 to collect the two-phase current of the second motor. Since the number of cycles of the two PWMs is not an integer multiple relationship, the occurrence times of the overflow event and underflow event of PWM1 and PWM2 may collide. In this case, an asynchronous event acquisition arbiter can be used for arbitration.

[0061] The arbiter determines whether there is a channel generating an event signal. When multiple groups of channels generate event signals, according to the set priority order, it determines which group of channels to process first.

[0062] For example, when the priority of PWM1 is set to be greater than that of PWM2, since the asynchronous event acquisition arbiter continuously polls multiple PWMs, when it is found that PWM1 and PWM2 simultaneously generate an overflow or underflow event, the event of PWM1 is processed first according to the set priority.

[0063] It should be noted that the priority order can be set according to the actual needs of the user, and no specific limitation is made here.

[0064] According to the pre-setting, multiple event signals are sent to a certain ADC channel group to trigger the sampling of multiple consecutive channels of the ADC channels in this group.

[0065] Specifically, the trigger signal line of channel group 1 continuously sends two event signals to ADC1, triggering ADC1 to sample the two-phase current of the first motor through two consecutive channels; after the processing is completed, since PWM2 also generates an overflow or underflow event, then two event signals are continuously sent to ADC1 through the trigger signal line of channel group 2, triggering ADC1 to sample the two-phase current of the second motor through two consecutive channels.

[0066] In this embodiment, by receiving an event acquisition instruction, according to the first set of configuration data in the pre-configured connection configuration data, the corresponding relationship between multiple PWMs and ADCs is configured, and event acquisition is enabled; when a PWM event signal is collected, a sampling trigger signal with a preset number of sampling channels is continuously sent to the ADC corresponding to the PWM, triggering the ADC channels corresponding to the PWM to perform sampling; if the sampling of all channels of the ADC corresponding to the PWM has been completed, a synchronization signal is sent to the ADC corresponding to the PWM, so that the ADC corresponding to the PWM starts sampling from the starting sampling channel. It can automatically switch the event signal connection between multiple PWM modules and SAR ADCs, support the asynchronous event signal of multiple PWMs to trigger ADC sampling, and is convenient to use; it avoids the continuous disorder of sampling channels due to a single mis-trigger, improving the reliability; the current sampling of the multi-motor control system can share one high-speed SAR ADC module, greatly saving the microcontroller area.

[0067] Embodiment 2

[0068] This embodiment provides a multi-channel sampling system. Figure 4 As shown in the schematic diagram of a multi-channel sampling system provided by an embodiment of this application, Figure 4 as shown, the system 400 of this embodiment includes:

[0069] A configuration unit 401, configured to receive an event acquisition instruction, configure the correspondence between multiple PWMs and ADCs according to the first set of configuration data in the pre-configured connection configuration data, and start event acquisition.

[0070] In some embodiments, the pre-configured connection configuration data includes the event signal connection configuration between multiple PWM modules and the ADC.

[0071] In some embodiments, the pre-configured connection configuration data is stored in an event acquisition buffer.

[0072] Optionally, in dual-motor sensorless vector control, in order to stagger the running time of the control algorithm, the control algorithm is run in the interrupt handling program after the two-phase current sampling is completed, and two PWMs are used to trigger two groups of ADC sampling channels at staggered times. Among them, each PWM triggers a group of ADC sampling channels every two cycles. For example, the first PWM1 samples the two-phase current of the first motor in odd cycles, and the second PWM2 samples the two-phase current of the second motor in even cycles.

[0073] For example, the connection configuration data 00 indicates that PWM1 is connected to the first group of sampling channels of ADC1, and the connection configuration data 01 indicates that PWM2 is connected to the second group of sampling channels of ADC1. If both PWM1 needs to be connected to the first group of sampling channels of ADC1 and PWM2 needs to be connected to the second group of sampling channels of ADC1, then the two sets of configurations 00 and 01 need to be written in the event acquisition buffer.

[0074] It should be noted that the storage in the event acquisition buffer in the preset order includes: sequentially writing the connection configuration data and storing it in the written order.

[0075] In some embodiments, the PWM module is the Pulse Width Modulation module, and the ADC includes the SAR ADC, that is, the Successive Approximation Register Analog-to-Digital Converter.

[0076] In some embodiments, configuring the correspondence between multiple PWMs and ADCs includes:

[0077] Connect multiple PWMs and multiple ADCs through a crossbar matrix. Among them, the event signal line of any one PWM is connected to the sampling trigger signal line of any one ADC through the crossbar matrix.

[0078] In some embodiments, connection configuration data can be obtained from the event acquisition buffer through an event module.

[0079] The event module is a signal connection management module between various peripheral modules of the microcontroller, or between external and internal modules, and can trigger the real-time operation of peripherals at high speed, such as the real-time acquisition of the ADC.

[0080] Specifically, the event module takes out the first connection configuration data 00 from the event acquisition buffer and writes 00 into the configuration register of the crossbar matrix of multiple PWMs and ADC1, so that PWM1 is connected to the first group of sampling channels of ADC1.

[0081] The sampling unit 402 is used to continuously send sampling trigger signals with a preset number of sampling channels to the ADC corresponding to the PWM when a PWM event signal is collected, and trigger the ADC corresponding to the PWM to perform channel sampling.

[0082] In the above dual-motor sensorless vector control, the number of sampling channels is set to 2. After the event module collects the overflow or underflow event of PWM1, the event module continuously sends two event signals to ADC1, triggering ADC1 to sample two-phase currents through two consecutive channels.

[0083] In some embodiments, the sampling unit 402 is further used for:

[0084] If all channel samplings are not completed, automatically configure the corresponding relationship between multiple PWMs and ADCs according to the next set of configuration data in the pre-configured connection configuration data, and restart event acquisition.

[0085] If all channel samplings are not completed and the sampling trigger signals for the first group of channels have been sent, the event module takes out the second connection configuration data 01 from the event acquisition buffer and writes the connection configuration data 01 into the configuration register of the crossbar matrix of multiple PWMs and ADC1, so that PWM2 is connected to the second group of sampling channels of ADC1, and then continues to sample through the sampling unit.

[0086] The synchronization unit 403 is used to send a synchronization signal to the ADC corresponding to the PWM if all channels of the ADC corresponding to the PWM have been sampled, so that the ADC corresponding to the PWM starts sampling from the starting sampling channel.

[0087] In some embodiments, the default sampling channel includes channel 0. After the ADC is reset to the default sampling channel, the next sampling starts from this default sampling channel, that is, event sampling restarts from this default sampling channel.

[0088] In the above dual-motor sensorless vector control, after all channel groups of ADC1 are sampled, the event module sends a synchronization signal to ADC1, forcing ADC1 to start sampling from sampling channel 0 next time, and at the same time, the current pointer of the event acquisition buffer points back to connection configuration data 00 again.

[0089] In some embodiments, the multi-channel sampling system further includes a priority setting unit for setting the priority of PWM through an asynchronous event acquisition arbiter; and

[0090] When event signals of at least two PWM signals collected simultaneously are present, the collected event signals are processed in sequence according to the priority order of PWM.

[0091] In some embodiments, processing the collected event signals in sequence according to the priority order of PWM includes the content described in sampling unit 402.

[0092] In dual-motor sensorless vector control, if the user cannot arrange the sampling moments of multiple motor currents at staggered times, the asynchronous event acquisition arbiter of the event module can be started. Multiple sets of trigger signal connection lines can be set between the asynchronous event acquisition arbiter and the ADC, including trigger signal lines and synchronization signal lines. Among them, one channel group corresponds to one set of trigger signal lines.

[0093] Specifically, the first PWM1 triggers ADC1 to collect the two-phase current of the first motor, and the second PWM2 triggers ADC1 to collect the two-phase current of the second motor. Since the number of cycles of the two PWMs is not an integer multiple relationship, the occurrence moments of the overflow events and underflow events of PWM1 and PWM2 may collide. In this case, an asynchronous event acquisition arbiter can be used for arbitration.

[0094] The arbiter determines whether an event signal is generated by a certain PWM. When event signals are generated by multiple PWMs simultaneously, according to the set priority order, it is determined which PWM's event signal to process preferentially.

[0095] For example, when the priority of PWM1 is set to be greater than the priority of PWM2, since the asynchronous event acquisition arbiter polls multiple PWMs continuously, when it is found that PWM1 and PWM2 generate overflow or underflow events simultaneously, the event of PWM1 is processed preferentially according to the set priority.

[0096] It should be noted that the priority order can be set according to the actual needs of the user, and specific details are not limited here.

[0097] Send multiple event signals to a certain channel group of the ADC according to the pre - set settings to trigger the sampling of multiple consecutive channels of the ADC channels in this group.

[0098] Specifically, the trigger signal line of channel group 1 sends two event signals to ADC1 continuously, triggering the sampling of two - phase currents of the first motor by two consecutive channels of ADC1; after the processing is completed, since PWM2 also generates an overflow or underflow event, then the trigger signal line of channel group 2 sends two event signals to ADC1 continuously, triggering the sampling of two - phase currents of the second motor by two consecutive channels of ADC1.

[0099] The multi - channel sampling system of this embodiment includes: a configuration unit, which is used to receive an event acquisition instruction, configure the corresponding relationship between multiple PWMs and the ADC according to the first - group configuration data in the pre - configured connection configuration data, and start event acquisition; a sampling unit, which is used to send a sampling trigger signal with a preset number of sampling channels to the ADC corresponding to the PWM continuously when a PWM event signal is acquired, triggering the ADC corresponding to the PWM to perform channel sampling; a synchronization unit, which is used to send a synchronization signal to the ADC corresponding to the PWM if the sampling of all channels of the ADC corresponding to the PWM has been completed, so that the ADC corresponding to the PWM starts sampling from the starting sampling channel. It can automatically switch the connection of event signals between multiple PWM modules and the SAR ADC, support the asynchronous event signal triggering of ADC sampling by multiple PWMs, and is convenient to use; it avoids the continuous disorder of sampling channels due to a single mis - trigger, improving the reliability; the current sampling of the multi - motor control system can share a single high - speed SAR ADC module, greatly saving the micro - controller area.

[0100] Embodiment Three

[0101] This embodiment also provides a storage medium, in which a computer program is stored. When the computer program is executed by a processor, it can implement the method steps as in Embodiment One, and this embodiment will not be repeated here.

[0102] Among them, the storage medium may also separately include a computer program, data file, data structure, etc., or include a combination thereof. The storage medium or computer program can be specifically designed and understood by those skilled in the computer software field, or the storage medium can be known and available to those skilled in the computer software field. Examples of storage media include: magnetic media, such as hard disks, floppy disks, and magnetic tapes; optical media, such as CD-ROM disks and DVDs; magneto-optical media, such as optical disks; and hardware devices specifically configured to store and execute computer programs, such as read-only memory (ROM), random access memory (RAM), flash memory; or servers, app application stores, etc. Examples of computer programs include machine code (e.g., code generated by a compiler) and files containing high-level code that can be executed by a computer by using an interpreter. The described hardware devices can be configured to act as one or more software modules to perform the operations and methods described above, and vice versa. Additionally, the storage medium can be distributed in a networked computer system and can store and execute program code or computer programs in a decentralized manner.

[0103] Embodiment 4

[0104] Figure 5 The connection block diagram of an electronic device provided in an embodiment of this application is shown as Figure 5 shown. The electronic device 500 may include: a processor 501, a memory 502, a multimedia component 503, an input / output (I / O) interface 504, and a communication component 505.

[0105] Among them, the processor 501 is used to execute all or part of the steps in the multi-channel sampling method in Embodiment 1. The memory 502 is used to store various types of data, which may include, for example, instructions of any application program or method in the electronic device, as well as application-related data.

[0106] The processor 501 can be implemented by an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a controller, a microcontroller, a microprocessor, or other electronic components, and is used to execute the multi-channel sampling method in Embodiment 1 above.

[0107] The memory 502 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disks or optical discs.

[0108] The multimedia component 503 may include a screen and an audio component. The screen may be a touch screen. The audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in the memory or sent via the communication component. The audio component also includes at least one speaker for outputting audio signals.

[0109] The I / O interface 504 provides an interface between the processor 501 and other interface modules, and the other interface modules may be a keyboard, a mouse, buttons, etc. These buttons may be virtual buttons or physical buttons.

[0110] The communication component 505 is used for wired or wireless communication between the electronic device 500 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, near field communication (NFC), 2G, 3G or 4G, or a combination of one or more of them. Accordingly, the communication component 505 may include: a Wi-Fi module, a Bluetooth module, an NFC module.

[0111] In summary, a multi-channel sampling method, system, storage medium, and electronic device provided by the present application. The method includes: receiving an event collection instruction, configuring the corresponding relationship between multiple PWMs and ADCs according to the first set of configuration data in the pre-configured connection configuration data, and starting event collection; when a PWM event signal is collected, continuously sending a sampling trigger signal for a preset number of sampling channels to the ADC corresponding to the PWM to trigger the ADC channel corresponding to the PWM to perform sampling; if the sampling of all channels of the ADC corresponding to the PWM has been completed, sending a synchronization signal to the ADC corresponding to the PWM to make the ADC corresponding to the PWM start sampling from the starting sampling channel. It can automatically switch the event signal connection between multiple PWM modules and the SAR ADC, which is convenient to use; it avoids the continuous disorder of the sampling channels due to a single mis-trigger, improving the reliability; the current sampling of the multi-motor control system can share a high-speed SAR ADC module, greatly saving the area of the microcontroller.

[0112] In addition, it should be understood that the methods or systems disclosed in the embodiments provided by the present invention can also be implemented in other ways. The method or system embodiments described above are only illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions, and operations of the methods and devices according to multiple embodiments of the present invention. In this regard, each block in the flowchart or block diagram may represent a module, a computer program segment, or a part of a computer program. A module, a computer program segment, or a part of a computer program contains one or more computer programs for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order from that marked in the accompanying drawings. In fact, they may be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, as well as the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and a computer program.

[0113] In the present invention, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the presence of additional identical elements in the process, method, apparatus or device comprising the element; if there is a description of "first", "second", etc., it is only for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features or implicitly specifying the sequence of the indicated technical features; in the description of the present invention, unless otherwise specified, the terms "a plurality", "many" mean at least two; if there is a description of a server, it should be noted that the server can be an independent physical server or terminal, or a server cluster composed of multiple physical servers, and can be a cloud server capable of providing basic cloud computing services such as cloud servers, cloud databases, cloud storage and CDN; if there is a description of a smart terminal or mobile device, it should be noted that the smart terminal or mobile device can be a smart phone, tablet computer, smart watch, smart TV, smart speaker, laptop computer, desktop computer, etc., but is not limited thereto.

[0114] Finally, it should be noted that in the description of this specification, the descriptions with reference to the terms "one embodiment", "some embodiments", "example", "an example" or "some examples", etc. mean that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0115] Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are all exemplary, and the content described is only an implementation manner adopted for the convenience of understanding the present invention, and is not used to limit the present invention. Any person skilled in the art within the technical field to which the present invention pertains can make any modifications and changes in the form of implementation and details without departing from the spirit and scope disclosed by the present invention, but the protection scope of the present invention shall still be subject to the scope defined by the appended claims.

Claims

1. A multi-channel sampling method, characterized in that, The method includes: Receiving an event acquisition instruction, configuring the correspondence between multiple PWMs and ADCs according to the first set of configuration data in the pre-configured connection configuration data, and enabling event acquisition; When a PWM event signal is acquired, continuously sending a sampling trigger signal of a preset number of sampling channels to the ADC corresponding to the PWM, triggering the ADC channel corresponding to the PWM to perform sampling; If sampling of all channels of the ADC corresponding to the PWM has been completed, sending a synchronization signal to the ADC corresponding to the PWM, causing the ADC corresponding to the PWM to start sampling from the starting sampling channel.

2. The method according to claim 1, characterized in that, The pre-configured connection configuration data includes the event signal connection configuration between multiple PWM modules and ADCs.

3. The method according to claim 1, wherein The pre-configured connection configuration data is stored in an event acquisition buffer.

4. The method according to claim 3, wherein The pre-configured connection configuration data is stored in the event acquisition buffer in a preset order.

5. The method according to claim 1, wherein The method further includes: If sampling of all channels has not been completed, automatically configuring the correspondence between multiple PWMs and ADCs according to the next set of configuration data in the pre-configured connection configuration data, and restarting event acquisition.

6. The method according to claim 1, wherein Configuring the correspondence between multiple PWMs and ADCs includes: Connecting multiple PWMs and multiple ADCs through a cross matrix, wherein the event signal line of any one PWM is connected to the sampling trigger signal line of any one ADC through the cross matrix.

7. The method according to claim 1, wherein The method further includes: Setting the priority of the PWM through an asynchronous event acquisition arbiter; When event signals of at least two PWMs are acquired simultaneously, processing the acquired event signals in sequence according to the priority order of the PWMs.

8. A multi-channel sampling system, characterized in that, The system includes: A configuration unit, configured to receive an event acquisition instruction, configure the correspondence between multiple PWMs and ADCs according to the first set of configuration data in the pre-configured connection configuration data, and enable event acquisition; A sampling unit, configured to, when a PWM event signal is acquired, continuously send a sampling trigger signal of a preset number of sampling channels to the ADC corresponding to the PWM, triggering the ADC corresponding to the PWM to perform channel sampling; A synchronization unit, configured to, if sampling of all channels of the ADC corresponding to the PWM has been completed, send a synchronization signal to the ADC corresponding to the PWM, causing the ADC corresponding to the PWM to start sampling from the starting sampling channel.

9. A storage medium, characterized in that, The computer program stored in the storage medium can be executed by one or more processors and can be used to implement the multi-channel sampling method according to any one of claims 1 to 7.

10. An electronic device, characterized in that, It includes a memory and a processor, a computer program is stored on the memory, the memory and the processor are communicatively connected to each other, and when the computer program is executed by the processor, it executes the multi-channel sampling method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • ADC sampling fault detection method of microprocessor in motor control system

    CN103743987A

  • Multi-path motor integrated time-sharing control system and control method

    CN111262479A