第一范文网 - 专业文章范例文档资料分享平台

无刷直流电机控制器的设计[毕业论文]2012-04-21 - 图文

来源:用户分享 时间:2025/12/7 6:35:01 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

浙江万里学院本科毕业论文 27

进入中断屏蔽中断总开关GIE外部中断标志INF=1 NY清TMR2IF中断标志位清INF中断标志位中断保护YAD通道选择AD采样并开始转换过流保护程序处理外部中断标志INF=1检测位置传感器的相位信息三次YNTMR2定时器中断初始化相位有变化?N输出相位驱动信号NAD中断标志位=1?Y保存AD转换结果,输出标志位=1开启总中断开关GIE退出中断计数器=40?Y刹车信号采集标志,计数器+1N计数器=80Y手柄信号采集标志;计数器+1N计数器>=120Y电压信号采集标志;计数器清零计数器+1N开启总中断开关GIE退出中断 图4-2 无刷直流控制器中断流程图

中断处理程序

void interrupt ISR(void) { uchar j;

浙江万里学院本科毕业论文 28 if(INTF==1)//外部INT0 { PEIE=0;

INTF=0; //清除中断标志位 if(counter_temp<1024) {;} else {

int0_flag=1;

counter=counter_temp/256; //counter=counter_temp; counter_temp=0; counter_temp1=0; count_num=0; }

// LED9=!LED9; PEIE=1; }

else if(TMR1IF==1) //定时器中断 TIMER1 {

//time1_flag=1;

TMR1IF=0;//清除中断标志位 TMR1L=T1L;

TMR1H=T1H; //重新设置定时器时间 counter_temp++; counter_temp1++; // LED10=!LED10; } else {;}

浙江万里学院本科毕业论文 29 }

显示程序

void plot1bar(char value, char max_value) {

unsigned int plot_value; int i;

char hibyte_value, lobyte_value; lobyte_value = 0; hibyte_value = 0;

plot_value = (int)(value*15/max_value);

// Computes how many points to plot. Since

// Initial values.

we are using 2 vertical

// 8 bit blocks, we can have 1-16

points for a bar graph.

if((plot_value>0)&&(plot_value<=7)) { }

else if((plot_value>7)&&(plot_value<=15)) // Plots bar graph which are above 8 points up to

for(i=plot_value;i>=0;i--) { }

lobyte_value=0x00;

hibyte_value=hibyte_value>>1; hibyte_value=hibyte_value+0x80;

// Plots bar graph which are below 8 points.

15 points.

{

plot_value = plot_value - 7; for(i=plot_value;i>=0;i--) {

lobyte_value=lobyte_value>>1; lobyte_value=lobyte_value+0x80;

浙江万里学院本科毕业论文 30 }

hibyte_value = 0xFF;

}

else if(plot_value>15) {

lobyte_value = 0xFF;

the maximum of 15. hibyte_value = 0xFF;

} else {

lobyte_value = 0x00;

of pixel on the bargraph). hibyte_value = 0x80;

}

writedata(lobyte_value);

higher 8 bits (which is the low byte)

writedata(hibyte_value);

(which is the high byte) of the graph. }

PWM波控制电机程序

aa++;if(aa>60000){aa=0;cc++;if(cc>2000)cc=0;} bb++;

if(bb>2000)bb=0; if(bb

// If beyond 15 points than cap the points at

// If below 0 then cap it to 0(which is a unit

// A 16 point plotting. Plots the

// and then the lower 8 bits

无刷直流电机控制器的设计[毕业论文]2012-04-21 - 图文.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c2nh948c3714i6jp0x0hl_9.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top