CN114489562A - Pulse transmission method and storage medium - Google Patents

Pulse transmission method and storage medium Download PDF

Info

Publication number
CN114489562A
CN114489562A CN202210048447.0A CN202210048447A CN114489562A CN 114489562 A CN114489562 A CN 114489562A CN 202210048447 A CN202210048447 A CN 202210048447A CN 114489562 A CN114489562 A CN 114489562A
Authority
CN
China
Prior art keywords
buffer area
buffer
pulse
filled
filling
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210048447.0A
Other languages
Chinese (zh)
Inventor
宋斌
李鑫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Samkoon Technology Corp ltd
Original Assignee
Shenzhen Samkoon Technology Corp ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Samkoon Technology Corp ltd filed Critical Shenzhen Samkoon Technology Corp ltd
Priority to CN202210048447.0A priority Critical patent/CN114489562A/en
Publication of CN114489562A publication Critical patent/CN114489562A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F5/00Methods or arrangements for data conversion without changing the order or content of the data handled
    • G06F5/06Methods or arrangements for data conversion without changing the order or content of the data handled for changing the speed of data flow, i.e. speed regularising or timing, e.g. delay lines, FIFO buffers; over- or underrun control therefor
    • G06F5/065Partitioned buffers, e.g. allowing multiple independent queues, bidirectional FIFO's

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a pulse sending method and a storage medium, wherein the pulse sending method comprises the following steps: setting a plurality of buffer areas according to a preset requirement, wherein the buffer areas are used for storing pulse signals; acquiring a pulse output instruction and pulse parameters; obtaining a buffer parameter of a buffer area according to the pulse output instruction, and filling a pulse signal in the buffer area according to the pulse parameter and the buffer parameter; and if the number of the filled buffer areas reaches a preset number, starting pulse transmission, wherein the preset number is smaller than the number of the buffer areas needing to be used. By arranging the buffer areas, the single-path pulse can be sent only by using single timer resources and a small amount of storage space; meanwhile, the time consumption of interrupt processing is reduced by caching and sending at the same time, and the scanning speed and the sending speed are improved.

Description

Pulse transmission method and storage medium
Technical Field
The present application relates to the field of pulse control technologies, and in particular, to a pulse transmission method and a storage medium.
Background
The pulse is widely applied to industrial production, different requirements are required for the frequency, duty ratio and number of the pulse in different application occasions, and related parameters need to be calculated before the pulse is sent, so that the rapid and continuous sending of the pulse is ensured. In the related art, the pulse transmission method is to calculate all register data before transmission, count and fill segment values in an interrupt, count in the interrupt, calculate the next segment parameters, and the like.
However, the pulse transmission method in which all register data are calculated before transmission has a problem of large memory space occupation and poor flexibility, and the pulse method in which counting is performed during interruption and the next parameter calculation is performed has a problem of long scan period.
Disclosure of Invention
The present application is directed to solving at least one of the problems in the prior art. Therefore, the application provides a pulse sending method which can reduce the occupation of storage space and improve the scanning speed.
The pulse sending method according to the embodiment of the first aspect of the application comprises the following steps: setting a plurality of buffer areas according to a preset requirement, wherein the buffer areas are used for storing pulse signals; acquiring a pulse output instruction and pulse parameters; obtaining a buffer parameter of a buffer area according to the pulse output instruction, and filling a pulse signal in the buffer area according to the pulse parameter and the buffer parameter; and if the number of the filled buffer areas reaches a preset number, starting pulse transmission, wherein the preset number is smaller than the number of the buffer areas needing to be used.
According to the pulse sending method of the embodiment of the application, the following beneficial effects are at least achieved: by arranging the buffer areas, the single-path pulse can be transmitted by only using single timer resources and a small amount of storage space; meanwhile, the time consumption of interrupt processing is reduced by caching and sending, and the scanning speed and the sending speed are improved.
According to some embodiments of the present application, the pulse parameter includes a data amount to be filled, the buffer parameter includes a cache depth and a storage state, the buffer parameter of the buffer area is obtained according to the pulse output instruction, and the pulse signal filling is performed on the buffer area according to the pulse parameter and the buffer parameter, including: acquiring the cache depth and the storage state of the buffer area according to the pulse output instruction; and filling pulse signals in the buffer area according to the cache depth, the storage state and the data amount to be filled.
According to some embodiments of the present application, defining a first buffer as a first buffer, and performing pulse signal filling on the buffer according to the buffer depth, the storage state, and the amount of data to be filled includes: if the cache depth of the first buffer area is smaller than the data amount to be filled, acquiring the storage state of the next buffer area after the first buffer area is filled; filling a pulse signal or waiting for a trigger instruction according to the storage state of the next buffer area; and if the cache depth of the first buffer area is greater than or equal to the data volume to be filled, setting a completion flag of the first buffer area.
According to some embodiments of the application, said pulse signal fill or wait for trigger instruction according to said storage state of said next buffer comprises: if the storage state of the next buffer area is empty, filling pulse signals into the next buffer area; and if the storage state of the next buffer area is not empty, waiting for the trigger instruction.
According to some embodiments of the present application, when the next buffer is filled with a pulse signal, the next buffer is defined as a current buffer, and the pulse transmitting method further includes: obtaining the sequencing information of the current buffer area; and defining the first buffer area as the next buffer area or defining the next buffer area for obtaining the current buffer area as the next buffer area according to the sorting information of the current buffer area.
According to some embodiments of the present application, the defining the first buffer as the next buffer or the defining the next buffer after obtaining the current buffer as the next buffer according to the sorting information of the current buffer includes: if the sorting information of the current buffer area is the last buffer area, defining the first buffer area as the next buffer area; and if the sorting information of the current buffer area is not the last buffer area, acquiring a next buffer area of the current buffer area and defining the next buffer area as a next buffer area.
According to some embodiments of the present application, in the process of turning on pulse transmission, the pulse transmission method further includes: obtaining the buffer depth and the sent data volume of the buffer area corresponding to the sent pulse; and continuing the transmission of the buffer or carrying out pulse transmission on the next buffer according to the transmitted data volume and the buffer depth.
According to some embodiments of the present application, the pulse transmitting method further comprises: obtaining the sequencing information of the buffer area corresponding to the current sending pulse; defining a first buffer area as the next buffer area or defining a buffer area after the current buffer area is obtained as the next buffer area according to the sorting information; acquiring the storage state of the next buffer area; and acquiring a setting state of a completion mark according to the storage state, executing cache supplement operation for unsetting according to the setting state, or carrying out pulse transmission on the next buffer area according to the storage state.
According to some embodiments of the present application, after completing the initial filling and sending of the plurality of buffers, the pulse sending method further includes: receiving an operation instruction at a preset time interval period; and acquiring a setting state of a completion mark of the buffer area according to the running instruction, and entering an operation cycle or exiting operation according to the setting state.
According to a second aspect of the present application, there is provided a computer-readable storage medium storing computer-executable instructions for performing a pulse transmission method as in the first aspect of the present application.
Additional aspects and advantages of the present application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the present application.
Drawings
The present application is further described with reference to the following figures and examples, in which:
fig. 1 is a schematic flowchart of a pulse transmission method according to an embodiment of the present application;
FIG. 2 is a schematic flowchart of step S300 in FIG. 1;
FIG. 3 is a flowchart illustrating the step S320 in FIG. 2;
FIG. 4 is a schematic diagram of the detailed process of step S322 in FIG. 3;
fig. 5 is a schematic flowchart of a pulse transmitting method according to an embodiment of the present application;
FIG. 6 is a flowchart illustrating the step S600 in FIG. 5;
fig. 7 is a schematic flowchart of a pulse transmitting method according to an embodiment of the present application;
fig. 8 is a schematic flowchart of a pulse transmission method according to another embodiment of the present application;
fig. 9 is a schematic flowchart of a pulse transmitting method according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present application.
In the description of the present application, it is to be understood that the positional descriptions, such as the directions of up, down, front, rear, left, right, etc., referred to herein are based on the directions or positional relationships shown in the drawings, and are only for convenience of description and simplification of description, and do not indicate or imply that the referred device or element must have a specific direction, be constructed and operated in a specific direction, and thus, should not be construed as limiting the present application.
In the description of the present application, the meaning of a plurality is one or more, the meaning of a plurality is two or more, and the above, below, exceeding, etc. are understood as excluding the present number, and the above, below, within, etc. are understood as including the present number. If the first and second are described for the purpose of distinguishing technical features, they are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated or implicitly indicating the precedence of the technical features indicated.
In the description of the present application, unless otherwise expressly limited, terms such as set, mounted, connected and the like should be construed broadly, and those skilled in the art can reasonably determine the specific meaning of the terms in the present application by combining the detailed contents of the technical solutions.
In the description of the present application, reference to the description of the terms "one embodiment," "some embodiments," "an illustrative embodiment," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present application. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The technical solution of the present application will be described below with reference to specific examples.
In a first aspect, the present application provides a method for pulse transmission.
As shown in fig. 1, a pulse transmitting method according to an embodiment of the present application includes, but is not limited to, the following steps:
step S100: setting a plurality of buffer areas according to a preset requirement, wherein the buffer areas are used for storing pulse signals;
step S200: acquiring a pulse output instruction and pulse parameters;
step S300: obtaining the buffer parameters of the buffer area according to the pulse output instruction, and filling pulse signals in the buffer area according to the pulse parameters and the buffer parameters;
step S400: and if the number of the filled buffer areas reaches a preset number, starting pulse transmission, wherein the preset number is smaller than the number of the buffer areas needing to be used.
According to the pulse sending method provided by the embodiment of the application, the plurality of buffer areas are arranged, so that the sending of the one-way pulse can be realized only by using single timer resources and a small amount of storage space; meanwhile, the time consumption of interrupt processing is reduced by caching and sending at the same time, and the scanning speed and the sending speed are improved.
Specifically, a plurality of FIFO buffer areas used for storing pulse signals are constructed according to preset requirements, pulse output instructions and pulse parameters are obtained, and the buffer parameters of the FIFO buffer areas are obtained according to the pulse output instructions, wherein the buffer parameters comprise buffer depth, storage states and the like, and the pulse parameters comprise data volume to be filled, target frequency and the like. And filling pulse signals into the FIFO buffer area according to the pulse parameters and the buffer parameters, and starting pulse transmission when the number of the filled buffer areas reaches a preset number. For example, there are five buffers, the preset number is two, when the number of the filled buffers reaches two (that is, the preset number is reached), the burst transmission is started, and at this time, the transmission is started while buffering. The preset number is smaller than the set number of the pulse areas, so that the storage space occupied by pulse transmission can be reduced, and the efficiency of pulse transmission is improved.
In some embodiments of the present application, as described in fig. 2, step S300: obtaining the buffer parameters of the buffer area according to the pulse output instruction, and filling the pulse signal into the buffer area according to the pulse parameters and the buffer parameters, including but not limited to the following steps:
step S310: obtaining the cache depth and the storage state of the buffer area according to the pulse output instruction;
step S320: and filling the pulse signals in the buffer area according to the cache depth, the storage state and the data amount to be filled.
Specifically, the pulse parameter includes a data amount to be filled, the buffer parameter includes a buffer depth and a storage state, the buffer depth is a number of pulse signals that can be stored in the buffer, and the storage state is whether the buffer is filled completely. And after the cache depth and the storage state of the buffer area are obtained according to the pulse output instruction, pulse signal filling is carried out on the buffer area according to the cache depth, the storage state and the data amount to be filled of the buffer area.
In some embodiments of the present application, as shown in fig. 3, step S320: the pulse signal filling is performed on the buffer area according to the buffer depth, the storage state and the data amount to be filled, and the method comprises the following steps of:
step S321: if the cache depth of the first buffer area is smaller than the data amount to be filled, acquiring the storage state of the next buffer area after the first buffer area is filled;
step S322: filling a pulse signal or waiting for a trigger instruction according to the storage state of the next buffer area;
step S323: and if the cache depth of the first buffer area is greater than or equal to the data volume to be filled, setting a completion mark of the first buffer area.
Specifically, after a plurality of buffer areas are set according to preset requirements, a first buffer area is defined as a first buffer area. When the cache depth of the first buffer area is smaller than the amount of the data to be filled, namely the first buffer area cannot cache all the data to be filled, after the first buffer area is filled, the storage state of the next buffer area is obtained, and pulse signal filling is continued according to the storage state of the next buffer area or a trigger instruction is waited for carrying out next round of filling. When the cache depth of the first buffer area is greater than or equal to the amount of the data to be filled, namely the first buffer area can cache all the data to be filled, setting a completion flag of the first buffer area after the pulse signal is filled so as to indicate that the pulse signal cache is completed.
In some embodiments of the present application, as shown in fig. 4, step S322: performing a pulse signal fill or wait for a trigger instruction according to the storage status of the next buffer, including but not limited to the following steps:
step S3221: if the storage state of the next buffer area is empty, filling the next buffer area with pulse signals;
step S3222: and if the storage state of the next buffer area is not empty, waiting for a trigger instruction.
Specifically, when the first buffer cannot buffer the whole amount of data to be filled, the storage state of the next buffer is acquired after the first buffer is filled. When the storage state of the next buffer area is empty, filling pulse signals in the next buffer area until the data volume to be filled is completely filled in the buffer area; and when the storage state of the next buffer area is not empty, jumping out of the buffer circulation, stopping filling the pulse signal in the period, and waiting for a trigger instruction to start filling the pulse signal in the next period.
In some embodiments of the present application, as shown in fig. 5, the pulse transmission method further includes, but is not limited to, the following steps:
step S500: obtaining the sequencing information of the current buffer area;
step S600: and defining the first buffer area as the next buffer area or defining the next buffer area after the current buffer area is obtained as the next buffer area according to the sorting information of the current buffer area.
For example, when the next buffer is filled with the pulse signal, the next buffer is defined as the current buffer, that is, the buffer being filled with the pulse data is the current buffer. When filling the current buffer area, the ordering information of the current buffer area needs to be acquired, that is, the current buffer area is located at the position of all the buffer areas, and the first buffer area is defined as the next buffer area or the next buffer area after acquiring the current buffer area is defined as the next buffer area according to the acquired ordering information.
In some embodiments of the present application, as shown in fig. 6, step S600: defining the first buffer area as the next buffer area or defining the next buffer area after acquiring the current buffer area as the next buffer area according to the sorting information of the current buffer area, including but not limited to the following steps:
step S610: if the sorting information of the current buffer area is the last buffer area, defining the first buffer area as the next buffer area;
step S620: and if the sorting information of the current buffer area is not the last buffer area, the next buffer area of the current buffer area is acquired and defined as the next buffer area.
Specifically, when filling the current buffer, it is necessary to determine whether the current buffer is the last buffer according to the sorting information of the current buffer, and obtain the next buffer according to the determination result. When the current buffer area is judged to be the last buffer area according to the sequencing information of the current buffer area, defining the first buffer area as the next buffer area; and when the current buffer area is judged to be not the last buffer area according to the sequencing information of the current buffer area, defining the next buffer area of the current buffer area as the next buffer area. And after the pulse signal of the current buffer area is cached, acquiring the next buffer area and caching the pulse signal of the next buffer area.
In some embodiments of the present application, as shown in fig. 7, in the process of starting pulse transmission, the pulse transmission method further includes, but is not limited to, the following steps:
step S700: obtaining the buffer depth and the sent data volume of a buffer zone corresponding to the sent pulse;
step S800: and continuing the transmission of the buffer or performing pulse transmission on the next buffer according to the transmitted data quantity and the buffer depth.
Specifically, after the pulse transmission is started, the buffer depth and the transmitted data amount of the buffer corresponding to the transmitted pulse are acquired. And comparing the sent data quantity with the buffer depth, and continuously sending the pulse signal of the buffer area according to the comparison result or starting to send the pulse signal of the next buffer area. If the sent data volume is equal to the buffer depth of the buffer zone corresponding to the sent pulse, which indicates that the pulse signals in the buffer zone corresponding to the sent pulse are all sent, then the pulse signals of the next buffer zone are sent; and if the sent data volume is smaller than the buffer depth of the buffer corresponding to the sent pulse, which indicates that the pulse signals in the buffer corresponding to the sent pulse are not completely sent, continuing to send the pulse signals to the buffer until the pulse signals of the buffer are completely sent.
In some embodiments of the present application, as shown in fig. 8, the pulse transmission method further includes, but is not limited to, the following steps:
step S900: obtaining the sequencing information of a buffer area corresponding to the current transmission pulse;
step S1000: defining the first buffer area as a next buffer area or defining the next buffer area after the current buffer area is obtained as the next buffer area according to the sorting information;
step S1100: acquiring the storage state of the next buffer area;
step S1200: and acquiring the setting state of the completion flag according to the storage state, executing cache supplement operation for unsetting according to the setting state, or carrying out pulse transmission on the next buffer area according to the storage state.
Specifically, when the pulse is sent, the sorting information of the buffer area currently carrying out the pulse sending is acquired, and the next buffer area is defined according to the sorting information. If the sequencing information of the currently sent buffer area is the last buffer area, defining the first buffer area as the next buffer area; and if the sequencing information of the currently sent buffer is not the last buffer, defining the buffer behind the current buffer as the next buffer.
And acquiring the storage state of the next buffer area, and acquiring the setting state of the completion flag according to the storage state. And when the storage state of the next buffer area is not empty, the next buffer area is subjected to pulse transmission until the storage state of the next buffer area is empty. And when the storage state of the next buffer area is empty, acquiring the setting state of the completion flag. If the completion flag is set, indicating that all the pulse signals are sent completely, ending the pulse sending and outputting a signal for finishing the instruction execution; if the completion flag is not set, which indicates that the sending speed is faster than the buffering speed, the buffer supplementing operation is executed, namely the sending is suspended, and the pulse sending is continued after the pulse signal of one buffer area is supplemented. The condition that the transmission is faster than the buffering can be avoided by adjusting the buffering depth of the buffer area and the number of the pulse signals buffered in the period.
In some embodiments of the present application, as shown in fig. 9, after completing the initial filling and sending of the buffers, the pulse sending method further includes:
step S1300: receiving an operation instruction at a preset time interval period;
step S1400: and acquiring the setting state of the completion flag of the buffer area according to the running instruction, and entering an operation cycle or exiting the operation according to the setting state.
Specifically, after the initial filling and sending of the plurality of buffers are completed, the running instruction is received in a preset time interval period, and the setting state of the buffer completion flag is obtained according to the running instruction. If the completion mark is set, exiting the pulse transmission and waiting for the pulse transmission instruction of the next period; and if the completion flag is not set, performing an operation cycle to continue buffering and sending the pulse signal.
The pulse transmission method according to an embodiment of the present application is described in detail below in a specific embodiment with reference to fig. 1 to 9. It is to be understood that the following description is illustrative only and is not intended to be in any way limiting.
For example, five buffer areas are set according to a preset requirement, the cache depth of the buffer areas is 100, two buffer areas are filled each time, and the preset number is one. The pulses are divided from 1Hz into 10000 steps and accelerated to 9999Hz pulse by pulse, the phase comprises 9999 groups of parameter values with the frequency increment number of 1, then the frequency is unchanged, 100000 pulses are continuously sent, and finally the pulse by pulse is decelerated to stop.
Initializing all buffer areas before pulse transmission, filling the first buffer area after acquiring a pulse output instruction, and starting pulse transmission after filling 100 groups of pulse signals. And meanwhile, continuously filling the second buffer area, performing other work backwards in a scanning period after the second buffer area is filled, and filling the third buffer area and the fourth buffer area when the next cyclic scanning reaches the position and if the storage states of the first two buffer areas are not empty. And when the fifth buffer area is filled, filling the first buffer area as the next buffer area until the data volume to be filled is filled, and setting the completion flag bit of the corresponding buffer area when the filling is finished.
After the pulse transmission is started, reading parameters from a first group of numerical values of a first buffer area and filling the parameters into a timer or transmitting the parameters to an FPGA (field programmable gate array), counting once when the timer finishes interruption every time a pulse is transmitted, comparing the count with the buffer depth of the current buffer area, and when the transmitted data amount is equal to the buffer depth, transmitting the pulse to the next buffer area. For example, after the transmission of 100 groups of pulse signals included in the first buffer is completed, the transmission of the pulse signals of the second buffer is started, and the storage state of the first buffer is changed to be empty. Before the next buffer area is subjected to pulse transmission, whether the completion flag of the buffer area is set or not is checked, if the completion flag of the buffer area is set, the pulse transmission is finished, and if the completion flag of the buffer area is not set, the next buffer area is subjected to pulse transmission. And when all the pulse signals are sent completely and the completion flag bit is set after being checked, ending the pulse sending.
The following describes the embodiments of the present application with four specific application examples.
Application example 1: and based on the pulse inching instruction of the MCU timer peripheral.
When the inching pulse sends a request enable instruction, the pulse frequency is gradually accelerated to a set value from 0 and then is sent to the incapability all the time, and the pulse frequency is gradually decelerated to stop from the current speed when the incapability is realized.
Starting the process of accelerating to the target frequency, wherein the process is the same as the specific embodiment, when the target frequency is reached by operation, a group of values with the frequency as the target frequency and the quantity as 1 are filled, and then the deceleration stage is continuously calculated backwards; when the sending operation reaches the target frequency, the buffer data used by the sending-all-time mark control given in the initialization is not switched back after the group is sent, but the group data is repeatedly used until the sending-all-time mark is reset after the failure is detected, and the data is continuously switched back to enter the deceleration stop stage.
Application example 2: multi-segment pulse instruction based on the above embodiment
The multi-segment pulse transmission requires that several segments of pulses with different acceleration and deceleration processes, respective target frequencies and total numbers, can be continuously transmitted.
On the basis of the above specific embodiment, the setting timing of the completion flag is modified. After the single-segment pulse data is cached, switching to the next segment to continue caching to the current buffer area, in the process, there may be a linking calculation process between the segments, given by the parameter during initialization, setting a calculation completion flag when all data of the last segment is calculated, and the sending process is completely consistent with the above-mentioned specific embodiment.
Application example 3: external signal control mechanical zero returning instruction based on application example 1
In the automatic control, a zero-returning operation is often required to reset or calibrate the position, and the zero point is generally marked by an external signal provided by a sensor, wherein the zero point triggering means that the machine enters a zero-returning area and needs to be decelerated from a high speed to a low speed, and then the zero-returning operation needs to be stopped when the signal disappears.
In this example, there are two frequencies, the faster return to zero frequency is called the return speed, and the slower frequency after the zero signal is detected is called the creep speed.
When a zero return instruction is started, if the zero point signal is in an un-triggered state, the acceleration is firstly accelerated to a return speed, and the acceleration process is the same as that of the specific embodiment; after the regression speed corresponding data is sent all the time, the filled data in the buffer area is continuously calculated to be the data in the process of decelerating from the regression speed to the crawling speed, then a group of values with the crawling speed corresponding to the frequency number being 1 is refilled, and the data is not filled any more. Moving to the zero point at the return speed all the time, and when the zero point signal is triggered, resetting the sending mark all the time and stopping sending; and the buffer area is switched to a deceleration stage backwards, the sending-all-time mark is set again until the buffer area is started to be switched to the crawling frequency, the buffer area slowly moves at the crawling speed again, and the sending is stopped immediately when the return-to-zero signal disappears. If the zero point signal is already in a trigger state when the zero return instruction is started, the operation and the transmission are directly accelerated from 0 to the crawling speed and then are transmitted all the time, and the pulse transmission is stopped as long as the zero point signal disappears in the whole process.
Application example 4: multi-axis linkage pulse instruction based on MCU timer peripheral
The multi-axis linkage pulse transmission requires that a plurality of linkage shafts are started and stopped as simultaneously as possible, and the number of pulses transmitted by each shaft keeps a certain mathematical relationship, so that the multi-axis linkage pulse transmission system is commonly used in the fields of plane and 3D position control, industrial robots and the like.
And setting a mathematical relation among the pulse numbers sent by each axis according to specific requirements, and filling the mathematical relation into a buffer area when pulse data are cached.
In a multi-axis linkage application, a single set of data in the buffer will include parameters such as the number of frequencies of multiple axes in the transmission interval, and the filling process is consistent with the above embodiments.
The pulse sending process is composed of reading and switching of buffer area data of each axis, and is different from a single axis in that register configuration of all axes needs to be filled when starting sending and then started, only data switching is carried out when the number reaches the data switching time in interruption of each axis, and after the last axis completes sending of the group data and data switching, all axes are opened to send the next group of pulses.
In a second aspect, an embodiment of the present application further provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and the computer-executable instructions are configured to enable a computer to execute the pulse sending method according to the foregoing first aspect of the present application.
One of ordinary skill in the art will appreciate that all or some of the steps, systems, and methods disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). The term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, as is well known to those of ordinary skill in the art. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, Digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by a computer. In addition, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media as known to those skilled in the art.
The embodiments of the present application have been described in detail with reference to the drawings, but the present application is not limited to the embodiments, and various changes can be made within the knowledge of those skilled in the art without departing from the gist of the present application. Furthermore, the embodiments and features of the embodiments of the present application may be combined with each other without conflict.

Claims (10)

1. A pulse transmission method is characterized by comprising the following steps:
setting a plurality of buffer areas according to a preset requirement, wherein the buffer areas are used for storing pulse signals;
acquiring a pulse output instruction and pulse parameters;
obtaining a buffer parameter of a buffer area according to the pulse output instruction, and filling a pulse signal in the buffer area according to the pulse parameter and the buffer parameter;
and if the number of the filled buffer areas reaches a preset number, starting pulse transmission, wherein the preset number is smaller than the number of the buffer areas needing to be used.
2. The pulse sending method according to claim 1, wherein the pulse parameters include data amount to be filled, the buffer parameters include a buffer depth and a storage state, the obtaining of the buffer parameters of the buffer area according to the pulse output instruction, and the filling of the pulse signal in the buffer area according to the pulse parameters and the buffer parameters include:
acquiring the cache depth and the storage state of the buffer area according to the pulse output instruction;
and filling pulse signals in the buffer area according to the cache depth, the storage state and the data amount to be filled.
3. The method according to claim 2, wherein defining a first buffer as a first buffer, and the pulse signal filling the buffer according to the buffer depth, the storage status, and the amount of data to be filled comprises:
if the cache depth of the first buffer area is smaller than the data amount to be filled, acquiring the storage state of the next buffer area after the first buffer area is filled;
filling a pulse signal or waiting for a trigger instruction according to the storage state of the next buffer area;
and if the cache depth of the first buffer area is greater than or equal to the data volume to be filled, setting a completion flag of the first buffer area.
4. The method according to claim 3, wherein the performing a pulse signal filling or waiting for a trigger command according to the storage status of the next buffer comprises:
if the storage state of the next buffer area is empty, filling pulse signals into the next buffer area;
and if the storage state of the next buffer area is not empty, waiting for the trigger instruction.
5. The pulse transmission method according to claim 4, wherein the next buffer is defined as a current buffer when the next buffer is filled with the pulse signal, and the pulse transmission method further comprises:
obtaining the sequencing information of the current buffer area;
and defining the first buffer area as the next buffer area or defining the next buffer area after the current buffer area is obtained as the next buffer area according to the sorting information of the current buffer area.
6. The burst transmission method according to claim 5, wherein the defining the first buffer as the next buffer or defining a subsequent buffer from which the current buffer is obtained as the next buffer according to the sorting information of the current buffer comprises:
if the sorting information of the current buffer area is the last buffer area, defining the first buffer area as the next buffer area;
and if the sorting information of the current buffer area is not the last buffer area, acquiring the next buffer area of the current buffer area and defining the next buffer area as the next buffer area.
7. The method according to claim 1, wherein in the process of starting pulse transmission, the method further comprises:
obtaining the buffer depth and the sent data volume of the buffer area corresponding to the sent pulse;
and continuing the transmission of the buffer or carrying out pulse transmission on the next buffer according to the transmitted data volume and the buffer depth.
8. The pulse transmission method according to claim 7, further comprising:
obtaining the sequencing information of the buffer area corresponding to the current sending pulse;
defining a first buffer area as the next buffer area or defining a buffer area after the current buffer area is obtained as the next buffer area according to the sorting information;
acquiring the storage state of the next buffer area;
and acquiring a setting state of a completion mark according to the storage state, executing cache supplement operation for unsetting according to the setting state, or carrying out pulse transmission on the next buffer area according to the storage state.
9. The pulse transmission method according to claim 1, wherein after the initial filling and transmission of the plurality of buffers is completed, the pulse transmission method further comprises:
receiving an operation instruction at a preset time interval period;
and acquiring a setting state of a completion mark of the buffer area according to the running instruction, and entering an operation cycle or exiting operation according to the setting state.
10. A computer-readable storage medium having stored thereon computer-executable instructions for performing the method of pulse transmission according to any one of claims 1 to 9.
CN202210048447.0A 2022-01-17 2022-01-17 Pulse transmission method and storage medium Pending CN114489562A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210048447.0A CN114489562A (en) 2022-01-17 2022-01-17 Pulse transmission method and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210048447.0A CN114489562A (en) 2022-01-17 2022-01-17 Pulse transmission method and storage medium

Publications (1)

Publication Number Publication Date
CN114489562A true CN114489562A (en) 2022-05-13

Family

ID=81511387

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210048447.0A Pending CN114489562A (en) 2022-01-17 2022-01-17 Pulse transmission method and storage medium

Country Status (1)

Country Link
CN (1) CN114489562A (en)

Similar Documents

Publication Publication Date Title
US8938609B2 (en) Methods and apparatus for priority initialization of a second processor
US6088701A (en) Command data transport to a graphics processing device from a CPU performing write reordering operations
US6725457B1 (en) Semaphore enhancement to improve system performance
CN111444123B (en) Automatic reading control system and method of SPI (Serial peripheral interface) based on hardware acceleration
KR970016979A (en) Queuing system and method of tasks in a multiprocessing system
AU2020249861B2 (en) Apparatus and method for data transmission and readable storage medium
CN107479898B (en) Three-dimensional virtual earth system architecture based on mobile platform
EP3789874A1 (en) Vehicle control device, vehicle control method, and recording medium storing vehicle control program
EP1700212A2 (en) Visual and graphical data processing using a multi-threaded architecture
CN112889218A (en) Automated speed ramp control for stepper motors
CN114489562A (en) Pulse transmission method and storage medium
CN114880259A (en) Data processing method, device, system, electronic equipment and storage medium
US6081090A (en) Servo system controller
US20180342967A1 (en) Rotating motion control apparatus, image forming apparatus and method for rotating motion control
US10162647B2 (en) Information apparatus
JP2005301812A (en) Digital controller, and engine controller using the same
CN114911581B (en) Data communication method and related product
EP4148571A1 (en) Overlapped geometry processing in a multicore gpu
CN114839927A (en) S-shaped curve acceleration and deceleration planning method and system and storage medium
US20220179656A1 (en) Control system of autonomous vehicle and control method of autonomous vehicle
US20140380327A1 (en) Device and method for synchronizing tasks executed in parallel on a platform comprising several calculation units
CN115220922A (en) Vehicle application program running method and device and vehicle
CN112101508A (en) Pulse transmission method, pulse transmission device, electronic device, and storage medium
US11189003B2 (en) Graphics processing method and related apparatus, and device for unidirectionally transmitting calling information of a graphics API to a client
US10037169B2 (en) Image processing semiconductor device and image processing device

Legal Events

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