Using 8XC196MC waveform generator to control motor

Publisher:水手谷水手Latest update time:2014-10-16 Source: 21icKeywords:8XC196MC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  O Introduction

  Stepper motors can perform high-precision control of rotation angles and rotation speeds. As a control actuator, stepper motors are one of the key products of mechatronics and are widely used in various fields such as automation control systems and precision machinery. For example, in instruments, machine tools, and computer peripherals (such as printers and plotters), it is ideal to use stepper motors whenever precise control of the rotation angle is required. With the development of microelectronics and computer technology, the demand for stepper motors is increasing day by day, and they are used in various fields of the national economy.

  The MCS-96 series 16-bit single-chip microcomputer is particularly suitable for various automatic control systems, such as industrial process control systems, servo systems, distributed control systems, variable frequency speed control motor control systems, etc. It is also suitable for general signal processing systems and advanced intelligent instruments, as well as high-performance computer external equipment controllers and office automation equipment controllers. These systems usually require real-time processing and real-time control. Due to the perfect and excellent performance of the 8XCl96MC single-chip microcomputer, it will surely show its talents in a wide range of application fields such as intelligent instruments, household appliances, computer terminal equipment, automotive electronics, artificial intelligence, robots, mechatronics, and traditional equipment transformation, and give full play to its advantages. Therefore, it has a good development prospect.

  1 Waveform Generator

  1.1 Overview of the on-chip waveform generator WFG

  The on-chip waveform generator 'WFG' (Wave Form Generator) is one of the unique features of 8XCl96MC/MD. It has three synchronous PWM modules, each of which contains a phase comparison register, a dead-time generator and a pair of programmable outputs. The WFG can generate three independent pairs of PWM waveforms, but they have a common carrier frequency, dead-time and operation mode. Once started, the WFG only requires the CP to intervene when changing the PWM duty cycle. The dedicated registers of the waveform generator are the bidirectional counter 'WG-COUNT', the reload register WG-RELOAD, the phase comparison buffer register WG-RCOMPX, the control register WG·C0N, and the output control buffer register WG-OUT. The user can write to the WG-RELOAD register, and its value is periodically (depending on the operation mode) loaded into the second register, which is compared with the WG-COUNT by this counter comparison register. The loading of the second register occurs when WG-COUNT=1 or the value of WG-COUNT is equal to the value of the counter comparison register, which is related to the operation mode of the WFG. If "0" is written to the WG_RELOAD register, when the value is loaded into the counter, it stops counting.

  1.2 Basic working principle of waveform generator

  The waveform generator is functionally divided into three parts. The time base generator, phase driver channel and control circuit. The time base generator establishes the carrier period for PWM. The period depends on the value and operation mode of the WG-RELOAD register. The core of the time base generator is a 16-bit bidirectional counter WG-COUNT, which can work in 4 different ways to generate center-aligned or edge-aligned PWM. The center-aligned PWM waveform has small harmonics and is usually center-aligned. The phase drive channel determines the duty cycle of the PWM waveform. It has 3 independent phase drive channels, their circuits are the same, and each channel has a pair of programmable outputs. Each phase channel contains a programmable signal-free time generator to prevent a pair of complementary outputs from being valid at the same time. The control part contains some registers used to determine the operating mode and other configuration information. A programmable protection circuit can monitor the EXTINT input pin. If a valid event is detected, an interrupt is generated to disable the waveform output.

  The working mode of the time base generator WG-COUNT is 0 and 1. After power-on reset, the value of all registers in WFG is 0. The counter stops working. All values ​​written into WG-REL0AD are valid after 1/2 state cycle (one crystal oscillator cycle). The value written into WG-RELOAD for the first time will be transferred to WG-COUNT. If the count enable bit EC in the WG-CON register is 1, it starts to count down by 1 to 0001H, waits for a state cycle and then counts up by 1 until the value in WG-COUNT is equal to the value of the count comparison register. At this time, a carrier cycle is completed. When the value of the count comparison register is equal to WG-COUNT, the content of WG-RELOAD is loaded into WG-COUNT and the count comparison register; the content of WG-COMPX (X=1, 2, 3) is loaded into the phase comparison register; the content of the output buffer register is loaded into WG-OUT; and the WG interrupt flag is set to 1 in the PI-PEND register. After the original (or new) value is reloaded into WG-COUNT, WG-COUNT starts counting a new switching cycle, and the cycle repeats. 'The relationship between the output data of WG-COUNT and time is a triangle. Carrier cycle Ts = 4 × WG-RELOAD / Fxtal (μs); WG-RELOAD is a 16-bit binary number; Fxta is the crystal frequency on the xtal pin, ignoring the no-signal time; the output "valid" time is ToutpuT = 4 × WG-COMP / Fxtal (μs), where the value of WC-COMP is 16 bits, equal to or less than WG-RELOAD, and the duty cycle = WG-COMP / WG-RELOAD × 100%. It can be seen that changing the value of WG-RELOAD will not only change the carrier cycle of PWM, but also change the duty cycle of PWM. Only by changing WG-RELOAD and changing WG-COMP proportionally at the same time, it is possible to change the carrier cycle without changing the duty cycle.

  Both working modes 0 and 1 generate center-aligned PWM. In mode 0, an interrupt request is generated once per carrier cycle, generated at the peak of the counter triangle wave (WG-COUT=WG-RELOAD). At this time, the values ​​of each buffer of the waveform generator will be reloaded into the associated register. Modes 2 and 3 are edge-aligned PWM, and the counter works in the up-counting mode. Its counter waveform is a sawtooth waveform.

 

  2 Principles of controlling stepper motors

  2.1 Working principle of stepper motor control

  Stepper motors, also known as pulse motors, are electromechanical actuators that convert electrical pulse signals into corresponding angular displacements or linear displacements. Whenever a pulse is input, the motor rotates an angle and moves forward one step. Therefore, the angular displacement output by the stepper motor is proportional to the number of input pulses, and the corresponding speed is proportional to the pulse frequency. By controlling the number and frequency of input pulses and the power-on sequence of each phase winding of the motor, various required operating characteristics can be obtained. The position and speed of the motor are in a one-to-one correspondence between the number of conduction times (number of pulses) and the frequency. The direction is determined by the conduction sequence. Stepper motors are composed of three major elements: step angle (involving the number of phases), static torque, and current. Once the three major elements are determined, the model of the stepper motor is determined. Stepper motors can be divided into two-phase motors, three-phase motors, four-phase motors, five-phase motors, etc. according to the number of phases. They are widely used in digital control systems.

  The four-phase stepper motor control circuit is shown in Figure 1. This scheme uses two sets of outputs of the 8XC196MC waveform generator. It consists of an input circuit, a microprocessor, an amplifier circuit, etc. The timing of controlling the driving stepper motor is a half-step timing. One modulation cycle controls eight beats. Its control timing is A-AB-B-BC-C-CD-D-DA-A (forward), DA-D-CD-C-BC-B-BA-A-DA (reverse).

Four-phase stepper motor control circuit

  Step angle: Qn=360°/8*number of rotor teeth=360°/8*50=0.9°(number of rotor teeth=50), then the number of steps required for the stepper motor to make one revolution is: 360°/0.9°=400. The rotation of the motor is determined according to the input information.

  2.2 Power-frequency control characteristics

  The establishment of the power supply frequency control characteristic (AMP) data table. Since the applied signal is a DC signal, it can be considered that the current is proportional to the voltage, and controlling the current is also controlling the voltage. When the modulation frequency is 0, the current amplitude is the largest, and the table data is normalized to 65535 (0FFFFH). When the modulation frequency is 400 Hz, the current amplitude data is 0, and a data is taken every 0.25 Hz. The highest modulation frequency is 200 Hz, so the table contains 801 data items, occupying a total of 1,602 bytes. So WG_COMP=AMP×WB_RELOAD/216. Among them: WG_COMP is the value loaded into the comparison register; AMP is the current amplitude found in the table; WG-RELOAD is the carrier period. [page]

formula

Power-frequency control characteristics

  2.3 Flowchart

  The main program initialization must set to allow CAPCOMP0 (INT02) interrupt, allow EXTINT (INT14) interrupt, set the minimum and maximum modulation frequency, set the initial current amplitude, set the PWM carrier cycle, set the initial PWM duty cycle, open interrupts, etc. The modulation frequency is loaded by the input circuit, the modulation frequency is compared, and the limit of the modulation frequency is controlled within the initial maximum to minimum range. The data in the AMP table is retrieved and the next beat time is calculated. The CAPCOMP0 interrupt subroutine controls the output of the eight-beat rotation characteristics of the motor, and modifies the duty cycle and the next interrupt time at the end of the interrupt program.

Block Diagram

  3 Conclusion

  This article uses single-chip microcomputer technology to control the rotation of the motor, making programming simpler from complex. INTEL's 8XC196MC series is a 16-bit microcontroller designed specifically for high-speed motor control. Its suffix MC is the abbreviation of the English "Motor Controller" and has been widely used in motor control. It has the characteristics of high performance, full functions, and user-friendly, especially high-speed processing capabilities and special applications for alternating current. Therefore, it will be widely used in my country's intelligent control field and will also bring considerable economic benefits.

Keywords:8XC196MC Reference address:Using 8XC196MC waveform generator to control motor

Previous article:Design of smart home system based on smart phone and PC
Next article:Implementation scheme of high frequency switching rectifier monitoring system based on communication

Recommended ReadingLatest update time:2024-11-16 19:35

How to implement PWM output and ADC sampling within a cycle in stm32
1. Set TIM1 channel 1 to PWM mode, channel 3 to Timing mode, and allow TIM_IT_Update and TIM_IT_CC3 to update interrupts; 2. There are three methods for STM32 ADC: (Sampling method three TIM8+ADC1+DMA2)     A. Use timer interrupts to perform ADC conversion at regular intervals, so that the ADC data register must be
[Microcontroller]
How to implement PWM output and ADC sampling within a cycle in stm32
Simple PWM modulator circuit capable of driving LEDs with DC signals
Dimming of LED driver circuits is accomplished by using a variable duty cycle (pulse width modulation or PWM) approach. The PWM approach takes full advantage of the capabilities of the LED because the higher the current, the greater the LED light output for a given power dissipation (temperature). Therefore, with PWM
[Power Management]
Simple PWM modulator circuit capable of driving LEDs with DC signals
A preliminary study on 51 single chip microcomputer PWM subdivision control of stepper motor
Why do we need PWM subdivision? Because it can make the stepper motor run smoothly, reduce noise, increase speed (MAX), increase torque... Why do we emphasize that it is a 51 single-chip microcomputer? Because the 51 single-chip microcomputer does not have a hardware PWM module, it can only be simulated by software...
[Microcontroller]
A preliminary study on 51 single chip microcomputer PWM subdivision control of stepper motor
Use PWM wave to control the flashing of LED lights
Use PWM to control the LED light to turn on for 3ms and off for 5ms, which means that the period of the PWM wave is 8ms. 1s/8ms=1000ms/8ms=125 times. There are 125 waves in 1s. htm1.Init.Period = 1000; This code means that every 1000 small waves make up a large wave, so 1ms requires 125000 small waves, 125kHZ. 4800000
[Microcontroller]
Fixed frequency PWM micropower DC/DC converter design
    DC/DC converters are important components in battery-powered computers, consumer products, and industrial equipment. There are two types of converters: linear converters and switching converters. There are three main topologies of switching converters: buck converter (switching regulator converts an input voltage
[Power Management]
Key-controlled adjustable PWM output
  #include reg51.h #define uint unsigned int #define uchar unsigned char sbit k1=P3^2; sbit k2=P3^3; sbit bee=P1^2; volatile PWM,num; void delay(float z) {    flying i; while(z--)   {   for(i=120;i 0;i--);   } } void spk()       { bee=0; delay(100); bee=1;     delay(100
[Microcontroller]
Key-controlled adjustable PWM output
MSP430F149 TimerA outputs pwm signal C program code
MSP430F149 TimerA outputs pwm signal  Note the corresponding relationship between the register settings and the PWM signal output pins: P1.2-TA1, TACCR1, TACCTL1; P1.3-TA2, TACCR2, TACCTL2.   #include msp430x14x.h   #define uint unsigned int #define uchar unsigned char     void int_clk() {   uch
[Microcontroller]
【PIC32MZ】PWM breathing light
PWM is similar to a switching power supply, inserting a ground pulse in the middle of a high voltage to reduce the effective voltage. In some voltage-insensitive devices, the voltage reduction effect can be achieved, such as the brightness change of an LED. As mentioned before, Harmony's Dynamic is not perfect yet,
[Microcontroller]
【PIC32MZ】PWM breathing light
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号