您现在所在的是:

变频器论坛

回帖:0个,阅读:825 [上一页] [1] [下一页]
906
hxy2000y
文章数:1
年度积分:50
历史总积分:906
注册时间:2007/5/7
发站内信
发表于:2007/5/8 0:13:00
#0楼
我这几天在调速马达瞬间提速,但是都不得要领,那个朋友可以帮帮我?
//-----------------------------------------------
#include <at89x52.h>
#include <string.h>
#include <intrins.h>
//-----------------------------------------------
/////////////////////////////////////////////////////////////////////////
//马达:东方57马达
//驱动器:自制TA8435H,用2细分.
//电源:DC24V
//脉冲产生:MCU 或 NE555
//
// 已用过NE555调速,提速效果非常好,说明,马达,电源,驱动器都是OK的
//但是用8051以下程序则不行,这些数是晓奇大侠软件所生产
//
//
/////////////////////////////////////////////////////////////////////////
// 晶振频率=12MHz; 预分频率=12
// 参数设定值: V0 = 20; 折点1= 100; 折点2 = 750 极限转速 = 1000 rpm
//         Point0= 0;第一折点= 12;第二折点= 120; 终点步数= 140
// 电机转动一周对应脉冲数=400; 编程响应(CTn rewrite)补偿步数 = 8
/////////////////////////////////////////////////////////////////////////
xdata unsigned int waitTbl[]={
   0xEA0F,0xEE74,0xF162,0xF379,0xF50B,0xF644,0xF73E,0xF80A,0xF8B5,0xF945, // 10
   0xF9C0,0xFA22,0xFA78,0xFAC5,0xFB0A,0xFB48,0xFB81,0xFBB4,0xFBE3,0xFC0F, // 20
   0xFC36,0xFC5B,0xFC7D,0xFC9D,0xFCBB,0xFCD7,0xFCF0,0xFD09,0xFD20,0xFD35, // 30
   0xFD4A,0xFD5D,0xFD6F,0xFD80,0xFD91,0xFDA0,0xFDAF,0xFDBD,0xFDCB,0xFDD8, // 40
   0xFDE4,0xFDF0,0xFDFB,0xFE06,0xFE10,0xFE1A,0xFE24,0xFE2D,0xFE36,0xFE3E, // 50
   0xFE46,0xFE4E,0xFE56,0xFE5E,0xFE65,0xFE6C,0xFE72,0xFE79,0xFE7F,0xFE85, // 60
   0xFE8B,0xFE91,0xFE96,0xFE9C,0xFEA1,0xFEA6,0xFEAB,0xFEB0,0xFEB4,0xFEB9, // 70
   0xFEBD,0xFEC2,0xFEC6,0xFECA,0xFECE,0xFED2,0xFED6,0xFED9,0xFEDD,0xFEE1, // 80
   0xFEE4,0xFEE7,0xFEEB,0xFEEE,0xFEF1,0xFEF4,0xFEF7,0xFEFA,0xFEFD,0xFF00, // 90
   0xFF03,0xFF05,0xFF08,0xFF0A,0xFF0D,0xFF10,0xFF12,0xFF14,0xFF17,0xFF19, // 100
   0xFF1B,0xFF1D,0xFF20,0xFF22,0xFF24,0xFF26,0xFF28,0xFF2A,0xFF2C,0xFF2E, // 110
   0xFF30,0xFF32,0xFF33,0xFF35,0xFF37,0xFF39,0xFF3A,0xFF3C,0xFF3E,0xFF41, // 120
   0xFF44,0xFF47,0xFF4A,0xFF4D,0xFF4F,0xFF52,0xFF55,0xFF57,0xFF5A,0xFF5C, // 130
   0xFF5E,0xFF61,0xFF63,0xFF65,0xFF67,0xFF69,0xFF6B,0xFF6D,0xFF6F,0xFF71
};


unsigned char   Tb_count;
unsigned char count;
unsigned char timer_count;
unsigned int Tab;

void Timer(void);



void main (void)
{

P0 = 0xff;
P1 = 0xff;
P2 = 0xff;
P3 = 0xff;
timer_count = 0;
count = 0;
Tb_count= 0;

IE= 0; //disable all interrupt
IP =0x0b;//hi priority:into,count0,timer1
TMOD =0x15;//set timer1:model 16 bit timer, timer0:count0



Tab = waitTbl[Tb_count];
TL1 = Tab & 0xff;
TH1 = (Tab>>8) & 0xff;


ET1 = 1; //enable timer1 interrupt
EA = 1; //enable all interrupt
TR1 = 1; //start timer1


while(1)
{
;         //no using.
}

}

void timer (void) interrupt 3 using 2

{




Tab = waitTbl[Tb_count];
TL1 = Tab & 0xff;
TH1 = (Tab>>8) & 0xff;
TF1 = 0;

P1_0 = !P1_0 ; //Step Motor pulse


if (!TF1)
{
timer_count++; //test
}

if (count<139)
{
count++;
Tb_count++;
}
else
{
Tb_count=139; //:此时马达转的圈数(1/2细分的驱动器):(140/400)圈,一直按照最后一步的速度走下去.
// TR1=0; //如果把执行TR1=0; EA=0; 马达应该走一圈,但是只走了半圈??
// EA=0;
}


}

关于我们 | 联系我们 | 广告服务 | 本站动态 | 友情链接 | 法律声明 | 非法和不良信息举报

工控网客服热线:0755-86369299
版权所有 工控网 Copyright©2024 Gkong.com, All Rights Reserved

31.2002