在直流调速中、通过改变输出方波占空比来改变等效输出电压、在交流调速中、利用spwm在pwm的基础上改变调制脉冲方式、根据正弦规律来安排脉冲宽度和时间的占空比。
通过适当的滤波控制电机的转速、使输出波形达到正弦波输出、根据pwm控制电路中参考信号的不同处理方法、将控制方法分为计算法、调制法和跟踪控制法。
计算方法是由pwm控制电路的计算电路根据参考正弦波的频率和幅度以及半个周期内的脉冲数计算spwm脉冲的宽度和间隔、然后输出相应的pwm控制信号来控制逆变电路、从而产生与参考正弦波等效的spwm波。
调制方法是利用参考正弦波作为调制信号、等腰三角形波作为载波信号、调制正弦波得到相应的pwm控制信号、然后控制逆变电路产生与参考正弦波一致的spwm波供电负载。
跟踪控制方法是将参考信号与负载反馈信号进行比较、然后根据两者的偏差形成pwm控制信号来控制逆变电路、从而产生与参考信号一致的spwm波、跟踪控制方法可分为滞后比较法和三角波比较法。
扩展资料
直流PWM直流电机控制常用控制系统、目前,在直流电机控制系统中、普遍采用以单片机或DSP作为微处理器的控制系统、由于单片机或DSP控制电机占用端口资源多、所需周边元器件也较多对整个系统的稳定性和可靠性有较大影响。
参考资料来源:百度百科—pwm
#include <intrins.h>#include <stdio.h>
#include <math.h>
#include "UPSD3200.H"
#include "upsd_pwm.h"
#define uint unsigned int
#define uchar unsigned char
PSD_REGS PSD8xx_reg _at_ csiop
#define KEYIO (~(PSD8xx_reg.DATAIN_A)) &0x07
sbit CP=P4^7
sbit U_D=P1^1
void init_system()// 系统初始化
uchar keyboard()
void uPSD_PWM4_Variable(unsigned char PWM_Period, unsigned char PWM_PulseWidth)
uchar Adjust_station=NO
unsigned char data x,flag
unsigned char keyboard() //键盘输入
{
unsigned char a=0xff,b=0x01,c=0xf8,d//有按键的位置
uint i
do{
a=KEYIO|c
}while(a==0xff)
if (a == 0xfe){d = '1'}
else if (a == 0xfd){d = '2'}
else if (a == 0xfb){d = '3'}
else {d = '0'}
return(d)
}
void uPSD_PWM4_Init(void)
unsigned int PWM_prescaler
P4SFS |= 0x80
PWM_prescaler = (unsigned int)((FREQ_OSC/2)/PWM4_INPUT_freq)//PWM4输入脉冲频率 K
PSCL1L = PWM_prescaler &0x00ff
PSCL1H = (PWM_prescaler >>8)
}
void StepMotor_GO(bit direction,uint speed) {
unsigned char PWM_Period, PWM_PulseWidth
uint temp_uint
U_D = direction//方向
temp_uint = (PWM4_INPUT_freq*1000)/speed
PWM_Period = (unsigned char)temp_uint
PWM_PulseWidth = PWM_Period/2
uPSD_PWM4_Variable(PWM_Period,PWM_PulseWidth)
}
void StepMotor_STOP(void)
{
P4SFS &= 0x7f
}
void uPSD_PWM4_Variable(unsigned char PWM_Period, unsigned char PWM_PulseWidth)
{
P4SFS |= 0x80
PWMVP = PWM_Period
PWMVPW = PWM_PulseWidth
PWMCON |= 0x20
}
void initkey(void){
PSD8xx_reg.DATAOUT_A=0xFF
PSD8xx_reg.CONTROL_A=0x00
PSD8xx_reg.DIRECTION_A=0x00
}
void init_system() // 系统初始化
{
WDKEY=0x55
P4SFS = (unsigned char) (0x08 <<3)
uPSD_PWM_Channel_8bit(3,243)
问题补充:(接着上面的序)
void uPSD_PWM_Init_8bit(unsigned char PWM_channel_no, unsigned int PWM_freq8, unsigned char PWMCON_value)
{
unsigned int PWM_prescaler
unsigned char output_polarity_mode
output_polarity_mode = PWMCON_value &0x8F
PWMCON = (PWMCON &0x70) | output_polarity_mode
P4SFS = (unsigned char) (0x08 <<PWM_channel_no)
PWM_prescaler = (unsigned int) ( (((unsigned int) FREQ_OSC) / 2) / PWM_freq8)
PSCL0L = PWM_prescaler &0x00ff
PSCL0H = (PWM_prescaler >>8)
PSCL1L = PWM_prescaler &0x00ff
PSCL1H = (PWM_prescaler >>8)
}
void uPSD_PWM_Disable(void)
{
PWMCON &= 0xDF
}
void main(void){
x=0
init_system()
flag=1
while(flag==1){
x=keyboard()
if(x=='1') {StepMotor_GO(0,100)}
else if(x=='2') {StepMotor_GO(1,500)}
else if(x=='3') { StepMotor_STOP()uPSD_PWM_Disable()}
else if(x=='0') {uPSD_PWM_Disable()}
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)