三相spwm波形发生器实验
三相spwm波形发生器实验由微处理器来实现spwm控制,根据软件化方法的不同,有表格法(又称rom法)、随时计算法(又称ram法)和实时计算法,但上两种无实时处理能力。实时计算要有数学模型,采样型spwm法是其中一种模型,它分自然采样法,规则采样法。而规则采样法中又有对称规则采样法与不对称规则采样法。
分析表明,不对称规则采样所形成的阶梯波比对称规则采样时更接近于正弦波。分析表明,用不对称规则采样法在载波比n=3或3的倍数时,逆变器输出电压中不存在偶次谐波分量,其他高次谐波分量的幅值也较小。
图3-5 不对称规则采样法
不对称规则采样法是既在三角波的顶点位置又在底点位置对正弦波进行采样,由采样值形成阶梯波,如图3-5所示。由图可看出阶梯波与三角波的交点所确定的脉宽,在一个三角波的周期内的位置是不对称的。要注意的是,这里的采样周期ts是三角波周期的1/2,即ts=tt/2。
spwm波生成基本设计思想
图 3-6 对称pwm波生成机理
+ compare matches
t1cnt
dead time
pwmx(active low)
pwmx_(active high)
t1pr
利用tms320f2407生成spwm波的基本设计思想是利用dsp的事件管理器(eva)中的三个全比较单元、通用定时器1、死区发生单元以及输出逻辑来生成三相六路spwm波,经六个复用的i/o引脚输出。tms320f2407的定时器有四种工作方式,当以如图3-6所示的持续向上/下计数方式工作时,将产生对称的pwm 波输出。在这种计数方式下,计数器的值由初值开始向上跳增,当到达t1pr值时,开始递减跳变,直至计数器的值为零时又重新向上跳增,如此循环往复。在计数器跳变的过程中,计数器的值都与比较寄存器cmprx (x=1,2,3)的值作比较,当计数器的值与任一比较寄存器的值相等,则对应的该相方波输出发生电平翻转。如右图所示,在一个周期内,输出的方波将发生两次电平翻转。从图3-6还可以看出插入死区时间后波形的变化情况,只要在每个脉冲周期根据在线计算改写比较寄存器cmpr的值,就可实时地改变脉冲的占空比。
程序设定
首先要确定采样周期,即中断周期。设频率指令值为f,载波比为n,则中断周期为:ts=1/2nf。这里ts的单位是秒,在程序中转化为相应的时钟周期数(单字节指令周期为50ns)。可以把某一频率指令值对应的中断周期预先计算好,制成表格,便于在线查找。本系统运行的频率指令值范围为20~50hz,载波比n为90。
其次再根据n值,预先计算好采样点的单位正弦值,按顺序制成表格,正弦值表示成(1,15)格式,并扩展符号。同样地根据负载的v/f曲线,确定频率f与调幅比m之间的关系,也预先将m值按f递增的顺序制成表。由于0
7
lacl pivr
xor #0020h
bcnd pdpint, eq
ret
gisr2: ldp #pivr>>7
lacl pivr
xor #0027h
bcnd tpint1, eq
ret
pdpint: ldp #00e8h
splk #0h,comcona ;pwm out are in high-impedence state
splk #0h,actra ;all pwm out forced low
ret
tpint1: banz go_on ;check if the last one
lar ar1,#(num-1) ;reload ar1
go_on: call duty
nop
return: ldp #00e8h
splk #0080h,evifra ;clear ev individual flag
clrc intm
ret
;=============================================
; subroutine duty
; description:calculate next cmpr value for three phases
;========================================
duty: ldp #0
lacl na
sub #num
bcnd next_a,lt ;if ncount>=num, then ncount reset
rst_a: splk #0,na
next_a: lacl na
add stab
tblr sina ;get the sin value
lacc na
add #n0
sacl nc
sub #num
bcnd next_c,lt
rst_c: sacl nc
next_c: lacl nc
add stab
tblr sinc
lacc nc
add #n0
sacl nb
sub #num
bcnd next_b,lt
rst_b: sacl nb
next_b: lacl nb
add stab
tblr sinb
************************************************
* calculate swiching on time
**********************************************
spm 1
lt sina
mpy mag
pac
sach gpr0
lt period
mpy gpr0
pac
sach gpr0
lacl period
sub gpr0
ldp #00e8h
sacl cmpr1
ldp #0
lt sinb
mpy mag
pac
sach gpr0
lt period
mpy gpr0
pac
sach gpr0
lacl period
sub gpr0
ldp #00e8h
sacl cmpr2
ldp #0
lt sinc
mpy mag
pac
sach gpr0
lt period
mpy gpr0
pac
sach gpr0
lacl period
sub gpr0
ldp #00e8h
sacl cmpr3
ldp #0
lacl na ;na increase by 1 for next time use
add #1
sacl na
ret
;===============================
; stable, sin table used to produce pwm
;=======================================
; sine look-up table、no. entries : 60、angle range : 360deg
.data
; sinval ; index angle(deg)
stable: .word 0h ; 0 0 0
.word 0d61h ; 1 6 0.10453
.word 1a9dh ; 2 12 0.20791
.word 278eh ; 3 18 0.30902
.word 3411h ; 4 24 0.40674
.word 4000h ; 5 30 0.5
.word 4b3dh ; 6 36 0.58779
.word 55a6h ; 7 42 0.66913
.word 5f1fh ; 8 48 0.74314
.word 678eh ; 9 54 0.80902
.word 6edah ; 10 60 0.86603
.word 74efh ; 11 66 0.91355
.word 79bch ; 12 72 0.95106
.word 7d34h ; 13 78 0.97815
.word 7f4ch ; 14 84 0.99452
.word 7fffh ; 15 90 1
.word 7f4ch ; 16 96 0.99452
.word 7d34h ; 17 102 0.97815
.word 79bch ; 18 108 0.95106
.word 74efh ; 19 114 0.91355
.word 6edah ; 20 120 0.86603
.word 678eh ; 21 126 0.80902
.word 5f1fh ; 22 132 0.74314
.word 55a6h ; 23 138 0.66913
.word 4b3dh ; 24 144 0.58779
.word 4000h ; 25 150 0.5
.word 3411h ; 26 156 0.40674
.word 278eh ; 27 162 0.30902
.word 1a9dh ; 28 168 0.20791
.word 0d61h ; 29 174 0.10453
.word 0h ; 30 180 0
.word 0f29fh ; 31 186 -0.10453
.word 0e563h ; 32 192 -0.20791
.word 0d872h ; 33 198 -0.30902
.word 0cbefh ; 34 204 -0.40674
.word 0c000h ; 35 210 -0.5
.word 0b4c3h ; 36 216 -0.58779
.word 0aa5ah ; 37 222 -0.66913
.word 0a0e1h ; 38 228 -0.74314
.word 9872h ; 39 234 -0.80902
.word 9126h ; 40 240 -0.86603
.word 8b11h ; 41 246 -0.91355
.word 8644h ; 42 252 -0.95106
.word 82cch ; 43 258 -0.97815
.word 80b4h ; 44 264 -0.99452
.word 8000h ; 45 270 -1
.word 80b4h ; 46 276 -0.99452
.word 82cch ; 47 282 -0.97815
.word 8644h ; 48 288 -0.95106
.word 8b11h ; 49 294 -0.91355
.word 9126h ; 50 300 -0.86603
.word 9872h ; 51 306 -0.80902
.word 0a0e1h ; 52 312 -0.74314
.word 0aa5ah ; 53 318 -0.66913
.word 0b4c3h ; 54 324 -0.58779
.word 0c000h ; 55 330 -0.5
.word 0cbefh ; 56 336 -0.40674
.word 0d872h ; 57 342 -0.30902
.word 0e563h ; 58 348 -0.20791
.word 0f29fh ; 59 354 -0.10453
;=================================
; mtable, mag table for every f, from 25hz to 45hz
;=========================================
mtable: word 3b1eh ;
.word 3d5ch ;
.word 3f9ah ;
.word 41d9h ;
.word 4417h ;
.word 4655h ;
.word 4893h ;
.word 4ad2h ;
.word 4d10h ;
.word 4f4eh ;
.word 518dh ;
.word 53cbh ;
.word 5609h ;
.word 5847h ;
.word 5a86h ;
.word 5cc4h ;
.word 5f02h ;
.word 6141h ;
.word 637fh ;
.word 65bdh ;
.word 67fch ;
;====================================================
; ptable, period table for every f, from 25hz to 45hz
;=============================================
ptable: .word 1a0bh ;25hz
.word 190ah ;
.word 181dh ;
.word 1740h ;
.word 1673h ;
.word 15b4h ;
.word 1500h ;
.word 1458h ;
.word 13bbh ;
.word 1326h ;
.word 129ah ;
.word 1216h ;
.word 1199h ;
.word 1122h ;
.word 10b2h ;
.word 1047h ;
.word 0fe1h ;
.word 0f80h ;
.word 0f24h ;
.word 0ecch ;
.word 0e78h ;45hz
;=========================================
; i s r - phantom
;=========================================
.text
phantom kick_dog ;resets wd counter
b phantom
虹软计算摄影加持高通骁龙888,带来智能手机顶级影像体验
全新Qualcomm Networking Pro系列平台
贸泽电子喜获Yageo Corporation颁发的2018年度客户增长大奖
可安装在玻璃或陶瓷上的触摸式指纹传感器
2027年SiC器件市场将在达到63亿美元
三相SPWM波形发生器实验
可视电话的最高传输速率/图像分辨率
芯原股份将进一步推进Chiplet技术和产品的发展
dfrobot单路15A大功率直流电机驱动器简介
物联网和智能设备工程师在市场转变过程中必须克服的六大挑战
信雅达入选《2023高质量数字化转型产品及服务全景图》
Spotify推出了新的流媒体音乐订阅选项
中国移动组织了G.654.E光缆现网试点测试,完成光纤参数标准化
2017年VR与AR的11项预测:Niantic新作更火爆
应广原装PMS164单片机MCU触控型OTP系列芯片方案开发烧录编带
惠威AW-73真无线立体声耳机评测 均衡三频和泛用性极高的人声让其成为日常通勤的利器
新型全项目土壤肥料养分检测仪的特点
电容器基础知识
两家公司与瑞萨电子RX MCU的故事
LED开关电源的接线方法和主要作用