在好例子网,分享、交流、成长!
您当前所在位置:首页Others 开发实例一般编程问题 → 直流电机双闭环控制

直流电机双闭环控制

一般编程问题

下载此实例
  • 开发语言:Others
  • 实例大小:1.44M
  • 下载次数:20
  • 浏览次数:126
  • 发布时间:2020-09-09
  • 实例类别:一般编程问题
  • 发 布 人:robot666
  • 文件格式:.pdf
  • 所需积分:2
 

实例介绍

【实例简介】
内部介绍了 直流电机双闭环控制 ,速度环控制,及电流环控制。 内部有代码库详解及实现
Cold Fire MCF523x and eTPu Advantages and Features eTPU with 16 or 32 channels, 6 Kbytes of code memory, and 1. 5 Kbytes of data memory with etPU debug support 64 Kbytes of internal SRAM External bus speed of half the CPU operating frequency(75 MHz bus ( 150 MHz core) 10/100 Mbps bus-mastering ethernet controller 8 Kbytes of configurable instruction/data cache Three universal asynchronous receiver/transmitters qUARTS)with DMA support Controller area network 2.0B( Flexcan module) Optional second flex can module multiplexed with the third uart Intcr-intcgrated circuit(2C) bus controller Queued serial peripheral interface(QSPI)module Hardware cryptography accelerator(optional) Random number generator DES/3DES/AES block cipher engine MDS/SHA-1/HMAC accelerator 4-channel, 32-bit direct memory access (Ma)controller 4-channel, 32-bit input capture/output compare timers with optional dMa support 4-channel, 16-bit periodic interrupt timers(PIts) Programmable software watchdog timer Interrupt controller capable of handling up to 126 interrupt sources Clock module with phasc locked loop ( plly External bus interface module including a 2-bank synchronous dram controller 32-bit, non-multiplexed bus with up to 8 chip select signals that support page-mode FLash memories For more in formation refer to reference 1 1.2 eTPU Module The eTPu is an intelligent, semi-autonomous co-processor designed for timing control, I/O handling, and accesses shared data without the host CPu's intervention Consequently, the host CPu setup alr op serial communications, motor control, and engine control applications. It operates in parallel with the host CPU. The eTPU processes instructions and real-time input events, performs output waveform generati service times for each timer event are minimized or eliminated The eTPu has up to 32 timer channels, in addition to having 6 kbytes of code memory and 1. 5 Kbytes of data memory that store software modules downloaded at boot time. and can be mixed and matched as needed for any application The eTPU provides more specialized timer processing than the host CPU can achieve. This is partially due to the ctPu implementation which includes spccific instructions for handling and processing timc events DC Motor with Speed and Current Closed Loops, Driven by eTPU on MCF523x, Rev. O Freescale semiconductor 3 Target Motor Theory In addition, channel conditions are available for use by the eTPU processor, thus eliminating many branches. The eTPU creates no host CPU overhead for servicing timing events For more information refer to reference 5 2 Target Motor Theory A DC motor is a rotating electric machine where the stator of a permanent magnet dc motor is composed of two or more permanent magnet pole pieces. The rotor is composed of windings which are connected to a mechanical commutator. The opposite polarities of the energized winding and the stator magnet attract and the rotor will rotate until it is aligned with the stator. Just as the rotor reaches alignment, the brushes move across the commutator contacts and energize the next winding(see Figure 2) Notice that the commutator is staggered from the rotor poles. If the connections of a DC motor are reversed the motor will change directions Stator Rotor winding (in slots Shaft Rotor Air gap Permanent magnets Figure 2. DC Motor-Cross Section 2.1 Digital Control of a DC Motor power transistors that operate in either an independent or complementary mode owner stage utilizes four For the common DC motor, a 2-phase power stage is used(see Figure 3). The In both modes, the power stage energizes two motor phases concurrently. The voltage is applied to the dC motor using a pulse width modulation(PWm technique There are two basic types of power transistor switching schemes: independent and complementary. Both switching modes are able to work in bipolar or unipolar mode. The presented application utilizes the complementary bipolar PWM mode For more information about PWm techniques, refer to Reference 14 DC Motor with Speed and current Closed Loops, Driven by eTPU on MCF523x, Rev. 0 4 Freescale Semiconductor Target Motor Theol Y Figure 3. 2-Phase DC Motor Power Stage(H-bridge) 2.1.1 Speed And Current Control The motor speed depends on the amplitude of the applied voltage The amplitude of the applied voltage is adjusted using the Pwm technique. The required speed is controlled by a speed controller, which is implemented as a conventional proportional-integral(Pi)controller The difference between the actual and required speeds is input to the PI controller which then, based on this difference controllers the required DC-bus current The required dc-bus current is controlled by a current controller, which is also implemented as a conventional proportional-integral(PD)controller. The difference between the actual and cycle of the PWM pulses, which correspond to the voltage amplitude required to maintain the desired Ay required dC-bus current is input to the Pi controller which then, based on this difference, controls the du speea The current controller, which is the inner- loop controller, is updated more frequently, for example every PWM period, compared to the speed controller, which is the outer-loop controller The speed controller, as well as the current controller, calculates the Pi algorithm given in the equation elow (t)=Ke(1) After transforming the equation into a discrete time domain using an integral approximation with the Backward Euler method, we get the following equations for the numerical Pi controller calculation t up(k)Kc.e(k) 1(k)=1(k-1)+k DC Motor with Speed and Current Closed Loops, Driven by eTPU on MCF523x, Rev. O Freescale semiconductor 5 System Concept where e(k) Input error in step k W Desired value in step k Measured value in step k u(k) Controller output in step k uo(k) Proportional output portion in step k 4(K) Integral output portion in step k (K<-1) Integral output portion in step k-1 Integral time constant Sampling time Kc Controller gain System Concept 3.1 System Outline The system is designed to drive a dC motor. The application meets the following performance specifications Voltage control of a dc motor Targeted at ColdFire MCF523x evaluation board (M523xEVB), 33395 evaluation motor board, and 24V. 320oRPM. dc motor Control technique incorporates Voltage DC motor control with spccd and current closed loop Both directions of rotation 4-quadrant operation Start from any motor position without rotor alignment Minimum speed of 200 RPM Maximum speed of 1200 RPM(limited by power supply) Manual interface(start/stop switch, up/down push button control, LED indication) FreeMASTER control interface(speed set-up) FreeMASTER monitor FreeMASTER graphical control page(required speed, actual motor speed, start/stop status. fault status) FreeMASTER Speed control scope(observes required, ramp, and actual speeds, required DC-bus current) FreeMASTER current control scope (observes required and actual DC-bus currents, applied voltage) Detail description of all eTPU functions used in the application (monitoring of channel registers and all function parameters in real time dC bus over-current fault protection DC Motor with Speed and current Closed Loops, Driven by eTPU on MCF523x, Rev. 0 6 Freescale Semiconductor System Concept 3.2 Application Description A standard system concept is chosen for the motor control function(see Figure 4). The system incorporates the following hardware Evaluation board m523xeVB 33395 evaluation motor board DC motor with optical, Hall-like sensors Power supply 9V dC, 2.7Amps The eTPU module runs the main control algorithm. The 2-phase PWm output signals for a 2-phase inverter are generated according to feedback signals from optical sensors and the input variable values, provided by the microprocessor CPU Status LED Fault lED CPU eTPU Hardware over-current interrupt Fault 9÷12VDc GPIO ignal ON/OFF ON/OFF switch enable/disable ADC status Application PWM signals AD Converter Trigger UP State Machine DOWN DC PWM Power Stage Signals Motor FreeMASTER Drive required speed Remote Control Hall sensor BLDC data monitoring Rs232 Signals motor Figure 4. System Concept The systcm proccssing is distributcd betwccn thc CPu and the ctPU, which both run in paralle The CPu performs the following tasks Periodically scans the user interface(ON/OFF switch, up and down buttons, FreeMASTER) Based on the user input, it handles the application state machine and calculates the required speeds, which is passed to the eTPU Periodically reads application data from etpu data ram in order to monitor application variables In the event of an overcurrent fault, the pwm outputs are immediately temporarily disabled by the eTPU hardware. Then, after an interrupt latency, the cpu disables the pWm outputs permanently and displays the fault state The eTPU performs the following tasks Four eTPU channels(PWMf) are used to generate PWM output signals DC Motor with Speed and Current Closed Loops, Driven by eTPU on MCF523x, Rev. O Freescale semiconductor stem Concept Three eTPU channels(hd) are used to process optical sensor signals. On each incoming edge, a revolution period is calculated One eTPU channel(GPIO)is used to generate an interrupt to the CPu when the over-current fault signal activates TPU controls a speed closed loop. The actual motor speed is calculated based on the revolution period and compared with the required speed, provided by the CPu and passed through a ramp The speed pi control algorithm processes the error between the required and actual speed The pi controller output is passed to the current controller as a newly corrected value of the required DC-bus current value eTPU controls a current closed loop. The actual dC-bus current is sampled by an external ad converter, and the converted value is transferred by dma to the eTPU. The actual value is compared with the required speed, provided by the speed controller. The current PI contro algorithm processes the error between the required and actual current. The Pi controller output is passed to the pwm generator as a newly corrected value of the applied motor voltage frcaseala eTpU Mo or Controd Apptleat'er CELL Figure 5. The Application and FreeMASTER Screen DC Motor with Speed and current Closed Loops, Driven by eTPU on MCF523x, Rev. 0 8 Freescale Semiconductor System Concept 3. 2. 1 User Interface The application is interfaced by the following ON/OFF SWitch on m523XeVB Up/down buttons on M523xeVB, or FreeMASTER running on a PC connected to the M523xEVB via an RS232 serial cable The ON/OFF switch affects the application state and enables and disables the PWM phases. When the switch is in the off-position, no voltage is applied to the motor windings. When the on ofF switch is in the on-position, the motor speed can be controlled either by the up and down buttons on the M523xeVB or by the FreeMASTER on the PC. The FreeMASTeR also displays a control page, real-time values or application variables, and their time behavior using scopes FreeMASTER Software was designed to provide an application-debugging, diagnostic, and demonstration tool for the development of algorithms and applications. It runs on a pc connected to the m523xevb via an rS232 serial cable. A small program resident in the microprocessor communicates with the FreeMASTER Software to return status information to the Pc and process control information from the PC. FrccMASTER Software, cxccuting on a PC, uscs part of Microsoft Intcrnct explorer as the uscr interface Note, that FreeMASTER version 1.2. 31.1 or higher is required. The FreeMASTER application can be downloadedfromhttpwww.freescalecom.FormoreinformationaboutFreemaster,referto Reference 4 3. 3 Hardware Implementation and Application Setup As previously stated, the application runs on the MCF523x family of Cold Fire microprocessors using the following M523XEVB 33395 evaluation motor board DC motor with optical, Hall-like sensors Power supply 9V DC, 2. 7Amps Figure 6 shows the connection of these parts 3.3.1 Cold Fire MCF523X Evaluation Board(M523XEVB) The evb is intended to provide a mechanism for customers to easily evaluate the mcF523x family of ColdFire microprocessors. The heart of the evaluation board is the MCF5235; all other m523x family members have a subset of the mcf5235 features and can therefore be fully emulated using the MCf5235 device he M523xEVB is fitted with a single 512K x 16 pagc-modc Flash memory(u19), giving a total memory space of 2 Mbytes. Alternatively, a footprint is available for upgrading flash to a 512K X 32 page-mode Flash memory(U35), doubling the memory size to 4 Mbytes For more information . refer to reference 2 DC Motor with Speed and Current Closed Loops, Driven by eTPU on MCF523x, Rev. O Freescale semiconductor 9 System Concept Table 1 lists all M523XEVB jumper settings used in the application Optical Hall-like Sensor Signals Power Stage 33395 Evaluation B3 otor Board Motor Phases DC Motor Evaluation board C Cold Fire MCF5235 with eTPU UN|-3 Motor Control FreeMASTER Interface RS232 Interface DC 9V BDM Debug Interface Figure 6. Connection of Application Parts Table 1. M523xEVB Jumper Settings Jumper Setting Jumper Setting Jumper Setting Jumper Setting JP1 JP20 123 JP40 1-2 JP60 1-2 JP21 123 JP41 1-2 JP61 2 JP3 2 JP22 JP42 JP62 JP4 JP23 123 JP43 12 JP63 JP5 123 JP24 2-3 JP44 JP64 12-3 1-23 JP25 1-23 JP45 1-2 JP7 123 P26 1-23 JP46 DIP1 ON JP8 1-23 JP27 1-2 JP47 1-2 DIP2 ON JPg 12-3 JP28 JP48 DIP3 ON JP29 1-2 JP49 1-2 DIP4 ON DIP5 ON JP10 123 JP30 1-2 JP50 1-23 DIP6 ON JP1 12-3 12-3 JP51 123 DIPT OFF JP12 12-3 JP32 1-23 JP52 1-23 DIP8 ON 123 JP53 ON JP14 123 JP34 JP54 D|P10 ON JP15 12-3 JP35 1-23 JP55 D|P11 OFF JP16 123 JP36 123 P56 123 D|P12 ON JP17 12-3 JP37 1-2 JP57 JP18 12-3 P38 1-2 JP58 1-2 JP19 123 JP39 1-2 JP59 1-2 DC Motor with Speed and Current Closed Loops, Driven by eTPU on MCF523x, Rev. 0 10 Freescale Semiconductor 【实例截图】
【核心代码】

标签:

实例下载地址

直流电机双闭环控制

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警