CN108107777A - A kind of pulse sending method and system - Google Patents
A kind of pulse sending method and system Download PDFInfo
- Publication number
- CN108107777A CN108107777A CN201711316855.5A CN201711316855A CN108107777A CN 108107777 A CN108107777 A CN 108107777A CN 201711316855 A CN201711316855 A CN 201711316855A CN 108107777 A CN108107777 A CN 108107777A
- Authority
- CN
- China
- Prior art keywords
- pulse
- timer
- sending
- module
- sending module
- 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
Links
Classifications
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05B—CONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
- G05B19/00—Programme-control systems
- G05B19/02—Programme-control systems electric
- G05B19/04—Programme control other than numerical control, i.e. in sequence controllers or logic controllers
- G05B19/042—Programme control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors
- G05B19/0423—Input/output
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05B—CONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
- G05B2219/00—Program-control systems
- G05B2219/20—Pc systems
- G05B2219/25—Pc structure of the system
- G05B2219/25257—Microcontroller
Abstract
The invention discloses a kind of pulse sending method and systems, a kind of pulse sending method of the present invention and system, pulse sending module has been separately provided for sending pulse, and pulse counter module has been separately provided for counting the output pulse number of pulse sending module, when the pulse number of statistics reaches predetermined pulse number, pulse counter module control on-off circuit sends a control signal to pulse sending module, pulse sending module terminates pulse transmission after receiving control signal, not only increase the stability that pulse sends system, ensure the accuracy of the pulse number of output, to be suitable for high-frequency impulse transmission, and cost of implementation is cheap.
Description
Technical field
The present invention relates to Pulse Width Control field, especially a kind of pulse sending method and system.
Background technology
Usually, pulse is used primarily for pulse mode and accurate speed, position control is carried out to servomotor, stepper motor
The industry control occasion of system, sets available for industrial foundations such as industrial robot, numerical control machining center, gear-hobbing machine, packing machine, weaving looms
It is standby.The FREQUENCY CONTROL motor speed sent by pulse, the number that pulse is sent controls corner, amount of movement, so as to reach in work
It controls and carries out correct velocity and displacement control in occasion to executing agency.Part occasion needs to realize the high speed and super precision control of motor
System, the accuracy of frequency and pulse number to pulse have higher requirements, and pulse frequency 100KHz belongs to normal in commercial Application
Level can meet the requirement of engineering of the overwhelming majority, and 200KHz belongs to higher level, and to try out scope wider.High frequency arteries and veins can be generated at present
Punching may specify that the pulse sending method of pulse number has single timer interruption mode, CPLD/FPGA modes.
However, single timer interruption mode sends pulse, i.e., single timer sends pwm pulse, and individual pulse is set to send out
Completion is sent to interrupt, a pulse is often sent and enters interruption, recording impulse sends number, stops after reaching specified number.It though can be accurate
Really control pulse number, but influenced by interrupt mechanism, a large amount of CPU, system stability reliability meeting will be occupied by frequently entering interruption
It is a greater impact, it is impossible to send upper frequency pulse, for example, when pulse frequency reaches 1MHz, SCM system receives
The interruption of 1MHz frequently enters interruption, microcontroller cisco unity malfunction;
Although in addition, CPLD/FPGA modes can solve frequency it is high when pulse accuracy problem, also can multiplex pulse simultaneously
High frequency is sent, but needs additional CPLD/FPGA chips, so as to add the hardware cost and development cost that pulse sends system.
The content of the invention
In order to solve the above-mentioned technical problem, the object of the present invention is to provide a kind of pulse sending method and system, for carrying
High impulse sends the stability of system, and to be suitable for high-frequency impulse transmission, and cost of implementation is low.
The technical solution adopted in the present invention is:A kind of pulse sends system, including
Pulse sending module for sending pulse, stops sending pulse until receiving control signal;
Pulse counter module, for counting the output pulse number of pulse sending module, the output pulse number is equal to
During predetermined pulse number, control on-off circuit sends the control signal;
On-off circuit, for sending the control signal to pulse sending module;
The output terminal of the pulse sending module and the input terminal of pulse counter module connect, the pulse counter module
The input terminal of output terminal and on-off circuit connects, and the output terminal of the on-off circuit is connected with the input terminal of pulse sending module.
Further, the pulse sending module is first timer.
Further, the pulse counter module is second timer, and the second timer is pulse output mode.
Further, the on-off circuit is the second timer for being configured with gating patterns.
Further, the first timer and second timer are the timer in microcontroller.
Another technical solution of the present invention is:A kind of pulse sending method, comprises the following steps:
S1, pulse sending module send pulse;
The output pulse number of S2, pulse counter module statistics pulse sending module;
When S3, the output pulse number are equal to predetermined pulse number, the pulse counter module control on-off circuit hair
Send control signal;
S4, pulse sending module, which receive the control signal, then to be stopped sending pulse.
Further, step is further included before the step S1:
S0, the pulse frequency and predetermined pulse number that the pulse is set.
Further, step is further included after the step S4:
S5, the change pulse frequency and predetermined pulse number, return to step S1.
Further, the pulse sending module is first timer.
Further, the pulse counter module is second timer, and the second timer is configured with pulse output
Pattern and gating patterns.
The beneficial effects of the invention are as follows:
A kind of pulse sending method of the present invention and system have been separately provided pulse sending module for sending pulse, and single
Solely it is used to count the output pulse number of pulse sending module there is provided pulse counter module, when the pulse number of statistics reaches pre-
If during pulse number, pulse counter module control on-off circuit sends a control signal to pulse sending module, pulse sending module
Terminate pulse transmission after receiving control signal, not only increase the stability that pulse sends system, ensure the pulse number of output
Accuracy, to be suitable for high-frequency impulse transmission, and cost of implementation is cheap.
Description of the drawings
The specific embodiment of the present invention is described further below in conjunction with the accompanying drawings:
Fig. 1 is the Controlling model figure that a kind of pulse of the present invention sends system;
Fig. 2 is the specific embodiment schematic diagram that a kind of pulse of the present invention sends system;
Fig. 3 is an a kind of specific embodiment flow chart of pulse sending method of the present invention.
Specific embodiment
It should be noted that in the case where there is no conflict, the feature in embodiment and embodiment in the application can phase
Mutually combination.
A kind of pulse sends system, including
Pulse sending module for sending pulse, stops sending pulse until receiving control signal;
Pulse counter module, for counting the output pulse number of pulse sending module, output pulse number is equal to default
During pulse number, control on-off circuit sends control signal;
On-off circuit, for sending a control signal to pulse sending module;
The input terminal of the output terminal of pulse sending module and pulse counter module connects, the output terminal of pulse counter module with
The input terminal connection of on-off circuit, the output terminal of on-off circuit are connected with the input terminal of pulse sending module.
With reference to figure 1, Fig. 1 is the Controlling model figure that a kind of pulse of the present invention sends system, and pulse sending module is to perform hair
Segment pulse is sent, pulse counter module is the part of detection and feedback pulse.Two modules start simultaneously, when pulse technique module
Step-by-step counting reach when having predetermined pulse number, pulse sending module is controlled to stop sending pulse immediately, specifically, the present invention
There is provided an on-off circuits, when pulse number reaches predetermined pulse number, send a control signal to pulse sending module, arteries and veins
It rushes after sending module receives control signal and stops sending pulse.The pulse of the present invention sends system by pulse transmission and step-by-step counting
It separates, not only increases the stability that pulse sends system, ensure the accuracy of the pulse number of output, to be suitable for high frequency
Pulse is sent, and cost of implementation is cheap.
As being further improved for technical solution, with reference to figure 2, Fig. 2 is that a kind of pulse of the present invention sends the one specific of system
Embodiment schematic diagram, in the present embodiment, pulse sending module is first timer TIM1, furthermore it is also possible to be customized using FPGA
Pulse sending module;Pulse counter module is second timer TIM2, and second timer TIM2 is pulse output mode;And it opens
Powered-down road is the second timer for being configured with gating patterns.Further, first timer TIM1 and second timer TIM2
For the timer in microcontroller.
In the present invention, inputted using the clock of pulse output as another timer of a timer, realize pulsimeter
Number function;Too many cpu resource need not be occupied, when not interfering with systematic entirety energy, and sending high-frequency impulse, the pulse of transmission
Number is very accurate;The pulse function for sending and specifying number is realized in a manner of the mating reaction of single pulse mode and gating patterns;Often
The microcontroller of a timer for possessing pulse output mode and gating patterns can all realize the program, of low cost.
With reference to figure 2, system is sent based on above-mentioned pulse, the present invention also provides a kind of pulse sending method, including following step
Suddenly:
S1, pulse sending module send pulse;
The output pulse number of S2, pulse counter module statistics pulse sending module;
When S3, output pulse number are equal to predetermined pulse number, pulse counter module control on-off circuit sends control letter
Number;
S4, pulse sending module, which receive control signal, then to be stopped sending pulse.
The pulse sending method of the present invention has been separately provided pulse sending module for sending pulse, and has been separately provided
Pulse counter module is used to count the output pulse number of pulse sending module, and pulse transmission and step-by-step counting are separated, when
When the pulse number of statistics reaches predetermined pulse number, pulse counter module control on-off circuit sends a control signal to pulse hair
Module, pulse sending module is sent to terminate pulse transmission after receiving control signal, not only increases the stability that pulse sends system,
Ensure the accuracy of the pulse number of output, to be suitable for high-frequency impulse transmission, and cost of implementation is cheap.
As being further improved for technical solution, step is further included before step S1:
S0, the pulse frequency of pulse and predetermined pulse number are set.
As being further improved for technical solution, referring to figs. 2 and 3, Fig. 3 is the one of a kind of pulse sending method of the present invention
Specific embodiment flow chart, pulse sending module are first timer TIM1;Pulse counter module is second timer TIM2.It is first
The corresponding registers of timer are first configured, it is made to meet original frequency and pulse number.Second timer TIM2 is configured with simple venation
Rush output mode and gating patterns.First timer TIM1 is configured to PWM mode, be respectively configured automatic reloading value ARR and
Pre- frequency division value PSC specifies the pulse frequency of output pulse.The duty cycle of comparand register value CCR1 specific pulses is set.To be
Clock unite as TIM1 clocks, pulse transmission frequency can be accurately controlled according to system clock and relevant parameter.First timing
Device TIM1 connects to enable can send pulse always.Second timer TIM2 is arranged to count mode, and with first timer
The pulse of TIM1 exports the purpose for as clock, realizing step-by-step counting, and number is stored in Counter Value CNT, can move in real time
State is read, and the automatic of second timer TIM2 is set to reload register ARR and pre- frequency division value PSC, configures predetermined pulse number,
The reloading value ARR of predetermined pulse number, that is, second timer TIM2, and enable interruption.In addition, first timer TIM1's makes
It can turn on and cannot be operated with disconnecting in interruption, event and the enabled first timer of processing because microcontroller breaks in the response
In the coding process of TIM1 after a while, when pulse frequency reaches 1MHz, if this time multiple may be sent
Dry pulse can not accurately control pulse and send number.The connection of first timer TIM1 is needed with closing by second timer
The gate of TIM2 controls, and second timer TIM2 is needed to configure as single pulse mode, and the mechanism of action is to be configured with list
The timer of pulse mode will not reload automatically, be automatically closed when Counter Value CNT reaches reloading value ARR enabled.Match somebody with somebody
Another timer can be directly controlled by the enabled of itself, disabled state by having put the second timer TIM2 of gating patterns
Enabled, disabled state.Specifically, when system starts, first timer TIM1 and second timer can be enabled by software
TIM2 starts to work, and first timer TIM1 often sends one, and first timer TIM1 reloads parameter automatically, and under preparation
The transmission of one pulse;The corresponding of the counter of second timer TIM2 adds certainly.Since second timer TIM2 is configured with pulse
Pattern and gating patterns, then when the pulse of first timer TIM1, which sends number, reaches the ARR values of second timer TIM2,
The single pulse mode of second timer TIM2 disables itself automatically, and falls first timer TIM1, pulse by gating patterns disability
Stop sending, the next pulse of TIM1 is prevented to send, so as to which pulse transmission is accurate.The process is done directly by hardware,
Response time can be neglected, and will not cause multiple.So as to fulfill the high-frequency impulse sending function of specified number.Due to stopping arteries and veins
The process that punching is sent is completed completely by hardware, from influences such as program runtime, interruptions, so when multiplex pulse is sent simultaneously
When, it will not influence each other.
Using dual timer control model, form a pulse with feedback and send system, a timer is used for high frequency
Pwm pulse is sent, and a timer is used for step-by-step counting.For step-by-step counting timer configuration into single pulse mode, not from
It is dynamic to reload, and configure the timer that gate shut-off sends for pulse.When reaching specific pulse number, simple venation punch die is configured
The timer for step-by-step counting of formula is stopped, and passes through gate and stop the timer being sent for pulse, from interruption
Mechanism influences, and is directly completed by hardware, is sent so as to fulfill the accurate pulse of up to 1MHz.Generally there is timer function
Substantially this method can be used to realize the transmission of high-frequency impulse in microcontroller, pulse way is determined by timer number, all the way
Pulse is generated by two timers.
As being further improved for technical solution, step is further included after step S4:
S5, change pulse frequency and predetermined pulse number, return to step S1.
With reference to figure 3, when the value of pulse number, that is, CNT reaches the i.e. ARR values of predetermined pulse number, second timer is generated
Predetermined pulse number and pulse frequency, then enabled first timer may be updated in TIM2 parameter interrupt events in interrupt routine
TIM1, second timer TIM2 are into Xun Huan next time, it can be achieved that the acceleration and deceleration purpose of frequency.
In the explanation of above-mentioned pulse sending method, predetermined pulse number is using the situation less than ARR maximums, monolithic
The ARR maximums of the timer of machine are 65536, and when predetermined pulse number is more than 65536, second timer is used into multiple
The mode of interruption counts pulse number, interruption times N, then when predetermined pulse number M is more than 65536, by formula:M=
65536*N+b come determine into interrupt number and last time record pulse number value b.
The above are implementing to be illustrated to the preferable of the present invention, but the invention is not limited to the implementation
Example, those skilled in the art can also make a variety of equivalent variations on the premise of without prejudice to spirit of the invention or replace
It changes, these equivalent deformations or replacement are all contained in the application claim limited range.
Claims (10)
1. a kind of pulse sends system, which is characterized in that including
Pulse sending module for sending pulse, stops sending pulse until receiving control signal;
Pulse counter module, for counting the output pulse number of pulse sending module, the output pulse number is equal to default
During pulse number, control on-off circuit sends the control signal;
On-off circuit, for sending the control signal to pulse sending module;
The output terminal of the pulse sending module and the input terminal of pulse counter module connect, the output of the pulse counter module
End is connected with the input terminal of on-off circuit, and the output terminal of the on-off circuit is connected with the input terminal of pulse sending module.
2. pulse according to claim 1 sends system, which is characterized in that the pulse sending module is the first timing
Device.
3. pulse according to claim 2 sends system, which is characterized in that the pulse counter module is the second timing
Device, the second timer are pulse output mode.
4. pulse according to claim 3 sends system, which is characterized in that the on-off circuit is to be configured with gating patterns
Second timer.
5. the pulse according to claim 3 or 4 sends system, which is characterized in that the first timer and the second timing
Device is the timer in microcontroller.
6. a kind of pulse sending method, which is characterized in that comprise the following steps:
S1, pulse sending module send pulse;
The output pulse number of S2, pulse counter module statistics pulse sending module;
When S3, the output pulse number are equal to predetermined pulse number, the pulse counter module control on-off circuit sends control
Signal processed;
S4, pulse sending module, which receive the control signal, then to be stopped sending pulse.
7. pulse sending method according to claim 6, which is characterized in that further include step before the step S1:
S0, the pulse frequency and predetermined pulse number that the pulse is set.
8. pulse sending method according to claim 7, which is characterized in that further include step after the step S4:
S5, the change pulse frequency and predetermined pulse number, return to step S1.
9. according to claim 6 to 8 any one of them pulse sending method, which is characterized in that the pulse sending module is
First timer.
10. according to claim 6 to 8 any one of them pulse sending method, which is characterized in that the pulse counter module is
Second timer, the second timer are configured with pulse output mode and gating patterns.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711316855.5A CN108107777A (en) | 2017-12-11 | 2017-12-11 | A kind of pulse sending method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711316855.5A CN108107777A (en) | 2017-12-11 | 2017-12-11 | A kind of pulse sending method and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108107777A true CN108107777A (en) | 2018-06-01 |
Family
ID=62215571
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711316855.5A Pending CN108107777A (en) | 2017-12-11 | 2017-12-11 | A kind of pulse sending method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108107777A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112564820A (en) * | 2019-09-26 | 2021-03-26 | 浙江绍兴苏泊尔生活电器有限公司 | Signal receiving and transmitting method and device and electric kettle |
CN115657567A (en) * | 2022-11-14 | 2023-01-31 | 上海海栎创科技股份有限公司 | Method and control system for transmitting control signal by single pin |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105375904A (en) * | 2015-11-26 | 2016-03-02 | 深圳市思榕科技有限公司 | Method for generating rapid exponential pulse output by using ARM single-chip microcontroller |
CN206149241U (en) * | 2016-11-08 | 2017-05-03 | 华大半导体有限公司 | Pulse count device |
-
2017
- 2017-12-11 CN CN201711316855.5A patent/CN108107777A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105375904A (en) * | 2015-11-26 | 2016-03-02 | 深圳市思榕科技有限公司 | Method for generating rapid exponential pulse output by using ARM single-chip microcontroller |
CN206149241U (en) * | 2016-11-08 | 2017-05-03 | 华大半导体有限公司 | Pulse count device |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112564820A (en) * | 2019-09-26 | 2021-03-26 | 浙江绍兴苏泊尔生活电器有限公司 | Signal receiving and transmitting method and device and electric kettle |
CN112564820B (en) * | 2019-09-26 | 2024-04-12 | 浙江绍兴苏泊尔生活电器有限公司 | Signal receiving and transmitting method and device and electric kettle |
CN115657567A (en) * | 2022-11-14 | 2023-01-31 | 上海海栎创科技股份有限公司 | Method and control system for transmitting control signal by single pin |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102130640B (en) | Multishaft synchronous servo driving system and synchronous control method thereof | |
US5777870A (en) | Drive control commanding unit, a synchronous contol system for a plurality of drive control commanding units, and a synchronous control method for the units | |
EP2711798A1 (en) | Cpu unit for plc, plc-use system program, recording medium in which plc-use system program is stored, plc system, plc support device, plc support program, and recording medium in which plc support program is stored | |
CN202094830U (en) | Multiaxial synchronizing servo drive system | |
CN101510165B (en) | Watchdog circuit dog feeding method, apparatus and veneer | |
CN107037795B (en) | Industrial process control process guidance system | |
CN108107777A (en) | A kind of pulse sending method and system | |
CN107305526B (en) | Debugger for microcontroller | |
CN104518716A (en) | Closed loop control system for miniature direct current motor and control method for system | |
CN111988417B (en) | Communication control method of terminal of Internet of things | |
US3651477A (en) | Process control system | |
CN205179016U (en) | DLL output circuit | |
CN107809193A (en) | A kind of progress control method of motor, device and motor driver | |
Pritschow et al. | Open system architecture for drives | |
CN101786203A (en) | Variable-power working device for laser, punching equipment and method thereof | |
CN112615609B (en) | Reset circuit with automatic watchdog switching period | |
CN103838701A (en) | Data processing apparatus and method in PLC system | |
JPS5890226A (en) | Synchronous data processor | |
CN103473154B (en) | A kind of three machine Hot Spare computing machines when airliner certainty annuity | |
EP1221639B1 (en) | Programming of cyclic running machines | |
CN102591200A (en) | Field programmable gate array (FPGA) control system development platform | |
CN105281754A (en) | DLL output circuit and method for guaranteeing that DRAM power saving mode normally exits | |
JPH06244739A (en) | Multiplexer circuit | |
CN203800849U (en) | Stepping motor control device | |
CN102385414A (en) | Timing module |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180601 |
|
RJ01 | Rejection of invention patent application after publication |