CN205644131U - STM32 control multichannel step motor synchronous operation's control system - Google Patents

STM32 control multichannel step motor synchronous operation's control system Download PDF

Info

Publication number
CN205644131U
CN205644131U CN201620190683.6U CN201620190683U CN205644131U CN 205644131 U CN205644131 U CN 205644131U CN 201620190683 U CN201620190683 U CN 201620190683U CN 205644131 U CN205644131 U CN 205644131U
Authority
CN
China
Prior art keywords
stm32
chip microcomputer
motor
stepping motor
control system
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.)
Active
Application number
CN201620190683.6U
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.)
Guangdong Oupu Mandi Technology Co.,Ltd.
Original Assignee
FOSHAN CITY NANHAI DISTRICT OPTOMEDIC SCIENCE & TECHNOLOGY Co 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 FOSHAN CITY NANHAI DISTRICT OPTOMEDIC SCIENCE & TECHNOLOGY Co Ltd filed Critical FOSHAN CITY NANHAI DISTRICT OPTOMEDIC SCIENCE & TECHNOLOGY Co Ltd
Priority to CN201620190683.6U priority Critical patent/CN205644131U/en
Application granted granted Critical
Publication of CN205644131U publication Critical patent/CN205644131U/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The utility model discloses a STM32 control multichannel step motor synchronous operation's control system, wherein, including a STM32 singlechip, step motor driver and multichannel step motor, the STM32 singlechip with step motor driver electricity is connected, step motor driver drive step motor, and single chip microcomputer control multichannel step motor synchronous operation adopts the utility model discloses CLK clock signal in the timer resource of the usable singlechip simulation FPGA breaks off when being similar to into one punctum (for low speed step motor ) of code execution time in the function to the timer, simulates FPGA's parallel execution effect, carries out synchro control to the multichannel motor, and control is nimble, and is with low costs.

Description

A kind of STM32 controls the control system of multi-path stepping motor synchronous operation
Technical field
This utility model relates to single-chip computer control system field, in particular a kind of STM32 monolithic Machine controls the control system of multi-path stepping motor synchronous operation.
Background technology
In embedded-type control field, motor is that the one in Industry Control commonly uses execution unit, There is the advantages such as control is flexible, price is low, thus be often used in many equipment and device.And it is right Multiple motors carry out Synchronization Control, and traditional embedded solution is to use FPGA or CPLD Deng chip.Although use fpga chip accurately multi-path stepping motor to be controlled simultaneously, but It is with high costs.Owing to the program in single-chip microcomputer is that a rule order performs, to multiple motors Control also can only be the most sequentially to carry out.To use chip microcontroller to N number of The Synchronization Control of motor, N+1 block single-chip microcomputer to be used;N block single-chip microcomputer therein is responsible for N is operated alone Individual motor, a piece additionally is responsible for entirety and is controlled, carried out other N number of motor by serial port command Control, so can also reach the purpose of Synchronization Control, but waste very much mcu resource.
Therefore, prior art has yet to be improved and developed.
Utility model content
The purpose of this utility model is to provide a kind of STM32 to control multi-path stepping motor synchronous operation Control system and control method, to solve Synchronization Control motor in prior art, there are the following problems:
1. although use the chips such as FPGA or CPLD accurately multichannel motor to be controlled simultaneously, but It is with high costs.
2. to use chip microcontroller Synchronization Control N+1 the to be used block single-chip microcomputer to N number of motor,
Waste very much mcu resource.
The technical solution of the utility model is as follows:
A kind of STM32 controls the control system of multi-path stepping motor synchronous operation, wherein, including a STM32 Single-chip microcomputer, stepper motor driver and multi-path stepping motor, described STM32 single-chip microcomputer and described stepping Motor driver connects, stepper motor driver drive stepping motor, Single-chip Controlling multichannel stepping electricity Machine runs simultaneously.
Described STM32 controls the control system of multi-path stepping motor synchronous operation, wherein, described often One tunnel stepper motor arrangement has one for the position sensor resetted.
Described STM32 controls the control system of multi-path stepping motor synchronous operation, wherein, described STM32 Single-chip microcomputer include least one set for recommending the GPIO of output, GPIO connects described stepper motor driver, Drive level signal exports on multi-path stepping motor after comparing amplification.
Described STM32 controls the control system of multi-path stepping motor synchronous operation, wherein, described STM32 Single-chip microcomputer also includes that external interrupt, described external interrupt are configured to pull-up input and described position sensing Device connects, and is used for receiving reset motor signal.
Described STM32 controls the control system of multi-path stepping motor synchronous operation, wherein, described STM32 Single-chip microcomputer also includes intervalometer, and described intervalometer, for producing the clock signal of a certain frequency, controls electricity The step number of machine operation and the speed of operation.
Described STM32 controls the control system of multi-path stepping motor synchronous operation, wherein, described STM32 Single-chip microcomputer also includes the RS232 serial ports of one and extraneous communication.
The beneficial effects of the utility model: this utility model utilizes the timer resource of single-chip microcomputer to simulate CLK clock signal in FPGA, is approximated to one the code execution time in timer interruption function Moment point (relative to the motor of low speed), simulates the executed in parallel effect of FPGA, to multichannel Motor carries out Synchronization Control, controls flexibly, low cost.
Accompanying drawing explanation
Fig. 1 is the control system electricity that in this utility model, STM32 controls multi-path stepping motor synchronous operation Lu Tu.
Fig. 2 is the main program flow chart of single-chip microcomputer in this utility model.
Fig. 3 is that in this utility model, in single-chip microcomputer, serial ports interrupts flow chart.
Fig. 4 is the interrupt function flow chart of intervalometer in this utility model.
Detailed description of the invention
For making the purpose of this utility model, technical scheme and advantage clearer, clear and definite, referring to Accompanying drawing develops simultaneously embodiment to this utility model further description.
Refering to Fig. 1, this utility model provides a kind of STM32 to control the control of multi-path stepping motor synchronous operation System processed, wherein, including a STM32 single-chip microcomputer 1, stepper motor driver 2 and multi-path stepping motor 3, described STM32 single-chip microcomputer 1 and described stepper motor driver 2 connect, and stepper motor driver drives Dynamic motor 3, Single-chip Controlling multi-path stepping motor 3 runs simultaneously.
Further, described each road motor 3 is configured with one for the position sensor resetted 31.In this utility model, motor is used for photographing unit or the camera lens of other imaging devices, fuselage Auto-focusing, electronic zoom, position sensor 31 is for accurately detecting the accurate position of motor 3 Put so that motor 3 accurately resets.
Further, described STM32 single-chip microcomputer 1 includes some GPIO 11, GPIO for recommending output 11 connect described stepper motor driver 2, and drive level signal exports multichannel after comparing amplification and walks Enter on motor 3.
Further, described STM32 single-chip microcomputer also includes that external interrupt 12, described external interrupt 12 are joined It is set to pull-up input and connects with described position sensor 31, for receiving the reset letter of motor 3 Number.
Further, described STM32 single-chip microcomputer 1 also includes that intervalometer 13, described intervalometer 13 are used for Control the step number that motor runs.Motor 3 receives a pulse, needs time delay about 250 Microsecond could be run, if the pulse frequency that motor 3 receives is too fast, can cause motor 3 Can not start.In the present embodiment, intervalometer 13 frequency setting is 40K, and timer interruption function is every Will be called once every 25 microseconds.
Further, described STM32 single-chip microcomputer 1 also includes the RS232 serial ports of and extraneous communication 14。
Singlechip main program flow chart refering to Fig. 2, Fig. 2, single-chip microcomputer start after powering on to serial ports, GPIO, Intervalometer and external interrupt initialize.Initialization complete after reset motor 3, if stepping Motor 3 is not detected by position sensor 31 program and will halt and point out error message, otherwise journey Sequence enters into a major cycle.In this circulation, program disappearing in 5 milliseconds of acquisition message queues Breath, if message queue is empty, there is no order, then continues after waiting 5 milliseconds to obtain;If obtained The message got is not for sky, the then corresponding order of execution.If order runs succeeded, wait 5 milliseconds After continue to repeat to operate as above;If order performs failure, again attempt to perform, if the attempt to 3 times After all failed, abandon this order and point out error message.
Fig. 3 is serial ports interrupt function flow chart, and serial ports 14 has initialized rear serial ports interrupt function and just may be used Response external event.After serial ports 14 receives order, first order is resolved by interrupt function, resolves After order be stored in message queue notice principal function read, then branch in principal function.
Refering to Fig. 4, the control work of this utility model STM32 Single-chip Controlling multichannel motor synchronous operation Flow process is as follows:
Step a: single-chip microcomputer principal function actuating motor initialization function, initializes motor, According to specifically being used for setting the frequency of intervalometer, in the present embodiment, due to motor operation Altofrequency is 4K, and therefore arranging timer frequency is 40K, leaves regulation remaining of power supply machine acceleration and deceleration Ground;
Step b: according to user's request, the motor calling user's request runs function, will corresponding electricity The operational factor of machine is delivered in timer interruption function by global variable, arranges in interrupt function The parameters such as the corresponding switch of motor, motor speed;
Step c: be called if there being motor to run function, then trigger timer interruption function, perform step D operates, and otherwise performs the operation of step m.
Step d: if first via motor function calls, performs the operation of step e, otherwise performs I operates.
Step e: in intervalometer, opens the switch of corresponding motor, further according to the speed ginseng of corresponding motor Numerical value arranges the timer clock number needing to wait;
Step f: in the case of not being triggered to level sensor, performs the operation of step g;Otherwise redirect Operation is performed to step h.
Step g: motor elder generation Accelerating running, starts to travel at the uniform speed after reaching the speed specified, last pre- Do retarded motion in the step number of meter, finally stop on predetermined position, then jump to step i and hold Row operation.
Step h: after decelerating through motor to user preset value, the more certain step number of inverted running.
Step i: program enters the execution function entrance of next motor.
Step j: if No. second motor function calls, performs the operation of step e-h;Otherwise perform step Rapid i operation.
Step k: if No. threeth motor function calls, performs the operation of step e-h;Otherwise perform step Rapid i operation.
Step l: until last N road motor function is called, process repeats steps e-h operates;No Then perform the operation of step m.
Step m: exit timer interruption function, returns mastery routine and performs.
Although substantially single-chip microcomputer is the most proper sends the pulse to multi-path stepping motor 3 simultaneously, But according to sequencing, each road motor 3 sent pulse, but owing to single-chip microcomputer performs a finger Making a few to tens of nanoseconds of time about ten, relative to the motor of low cruise, (interpulse time delay is extremely Need 250 microseconds less) for, all codes in whole interrupt function are it is believed that at synchronization Complete, add interrupt function and perform once every 25 microseconds, it is possible to equivalence becomes FPGA's Parallel effect.When this utility model utilizes the CLK in the timer resource simulation FPGA of single-chip microcomputer to synchronize Clock signal, in timer interruption function code perform the time be approximated to a moment point (relative to The motor of low speed), simulate the executed in parallel effect of FPGA, carry out multichannel motor synchronizing control System, controls flexibly, low cost.
Certainly, the control system of this utility model control multi-path stepping motor synchronous operation is not only applied In STM32 single-chip microcomputer, this utility model can be applied equally to the single-chip microcomputer of other models.
It should be appreciated that application of the present utility model is not limited to above-mentioned citing, common to this area For technical staff, can be improved according to the above description or be converted, all these modifications and variations All should belong to the protection domain of this utility model claims.

Claims (6)

1. a STM32 controls the control system that multi-path stepping motor runs simultaneously, it is characterised in that Including a STM32 single-chip microcomputer, stepper motor driver and multi-path stepping motor, described STM32 monolithic Machine and described stepper motor driver connect, stepper motor driver drive stepping motor, single-chip microcomputer control Multi-path stepping motor processed runs simultaneously.
STM32 the most according to claim 1 controls the control system of multi-path stepping motor synchronous operation System, it is characterised in that described each road stepper motor arrangement has one for the position sensor resetted.
STM32 the most according to claim 2 controls the control system of multi-path stepping motor synchronous operation System, it is characterised in that described STM32 single-chip microcomputer include least one set for recommending the GPIO of output, GPIO connects described stepper motor driver, and drive level signal exports multichannel after comparing amplification and walks Enter on motor.
STM32 the most according to claim 3 controls the control system of multi-path stepping motor synchronous operation System, it is characterised in that described STM32 single-chip microcomputer also includes external interrupt, described external interrupt configures For pull-up input and connect with described position sensor, be used for receiving reset motor signal.
STM32 the most according to claim 1 controls the control system of multi-path stepping motor synchronous operation System, it is characterised in that described STM32 single-chip microcomputer also includes that intervalometer, described intervalometer are used for producing The clock signal of a certain frequency, controls step number and the speed of operation that motor runs.
STM32 the most according to claim 1 controls the control system of multi-path stepping motor synchronous operation System, it is characterised in that described STM32 single-chip microcomputer also includes the RS232 serial ports of one and extraneous communication.
CN201620190683.6U 2016-03-11 2016-03-11 STM32 control multichannel step motor synchronous operation's control system Active CN205644131U (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201620190683.6U CN205644131U (en) 2016-03-11 2016-03-11 STM32 control multichannel step motor synchronous operation's control system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201620190683.6U CN205644131U (en) 2016-03-11 2016-03-11 STM32 control multichannel step motor synchronous operation's control system

Publications (1)

Publication Number Publication Date
CN205644131U true CN205644131U (en) 2016-10-12

Family

ID=57076010

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201620190683.6U Active CN205644131U (en) 2016-03-11 2016-03-11 STM32 control multichannel step motor synchronous operation's control system

Country Status (1)

Country Link
CN (1) CN205644131U (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105824271A (en) * 2016-03-11 2016-08-03 佛山市南海区欧谱曼迪科技有限责任公司 Control system and control method for controlling multi-path stepping motors to realize synchronous operation by STM32 unit

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105824271A (en) * 2016-03-11 2016-08-03 佛山市南海区欧谱曼迪科技有限责任公司 Control system and control method for controlling multi-path stepping motors to realize synchronous operation by STM32 unit
CN105824271B (en) * 2016-03-11 2018-07-27 广东欧谱曼迪科技有限公司 A kind of control system and control method of STM32 controls multi-path stepping motor synchronous operation

Similar Documents

Publication Publication Date Title
CN101833336B (en) Dual-redundancy attitude control system and debug method of coaxial unmanned helicopter
CN105137887A (en) Materialized programming method based on programming plate and application thereof in robot field
EP2222003A2 (en) Field control system
MY134825A (en) Test emulator, test module emulator, and record medium storing program therein
CN108923706A (en) A kind of multi-path stepping motor control method and system based on embeded processor
CN107565861A (en) Multi-Axis Stepper Motor Control System based on STM32 control L6470H drivers
CN205644131U (en) STM32 control multichannel step motor synchronous operation's control system
CN101719177B (en) Method and device for on-chip system modeling and simulation
CN104730983B (en) A kind of split-second precision programmed control method
CN102096376A (en) Mixed time sequence synchronous control method in physical simulation
CN105824271B (en) A kind of control system and control method of STM32 controls multi-path stepping motor synchronous operation
CN104536340B (en) Dynamic motion decoding trigger based on FPGA
CN104518716A (en) Closed loop control system for miniature direct current motor and control method for system
CN105577052B (en) A kind of stepper motor non-jitter driving control system based on FPGA and the control method based on the system
CN112417678A (en) Hard real-time aircraft test system
WO2013116451A2 (en) Timebase peripheral
CN1924607B (en) Method for controlling multiple working conditions high frequency radar receiver
CN105425662A (en) Main processor in DCS (distributed control system) based on FPGA, and control method of main processor
CN203689064U (en) Multi-channel precise timing sequence control device
CN103744373A (en) Synchronous trigger controller
Rida et al. Design Mini-PLC based on ATxmega256A3U-AU microcontroller
CN111431651B (en) Multicomputer synchronous operation and time alignment method suitable for Mars detection
CN103401495A (en) Stepping motor system controlled by utilizing single-chip microcomputer and control method
JPS5663606A (en) Sequence control unit
CN216596007U (en) Laser reticle control panel card

Legal Events

Date Code Title Description
C14 Grant of patent or utility model
GR01 Patent grant
CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: 528251 Guangdong Province Nanhai District of Foshan City, Guicheng Guicheng Ping Chau Street No. 1 Yongan Road, A block 504 Jingu Photoelectric Industrial community

Patentee after: GUANGDONG OPTOMEDIC TECHNOLOGY CO.,LTD.

Address before: 528251 Guangdong Province Nanhai District of Foshan City, Guicheng Guicheng Ping Chau Street No. 1 Yongan Road, A block 504 Jingu Photoelectric Industrial community

Patentee before: FOSHAN CITY NANHAI DISTRICT OPTOMEDIC TECHNOLOGY CO.,LTD.

CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: 528253 Room 503, Floor 5, Building A, Jingu Zhichuang Industrial Community, No. 2, Yong'an North Road, Dawu Community, Guicheng Street, Nanhai District, Foshan City, Guangdong Province (residence declaration)

Patentee after: Guangdong Oupu Mandi Technology Co.,Ltd.

Address before: 504, Building A, Jingu Optoelectronics Industry Community, No.1 Yong'an North Road, Guicheng Pingzhou, Guicheng Street, Nanhai District, Foshan, Guangdong 528251

Patentee before: GUANGDONG OPTOMEDIC TECHNOLOGY CO.,LTD.