找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 3199|回復(fù): 0
收起左側(cè)

基于TMS320F2812的電機(jī)控制程序

[復(fù)制鏈接]
ID:888117 發(fā)表于 2021-3-3 22:23 | 顯示全部樓層 |閱讀模式
使用TMS320F2812做控制器使用霍爾傳感器實(shí)現(xiàn)PSMS電機(jī)的運(yùn)行。
IMG_20201110_151703.jpg IMG_20201208_135428.jpg

  1. #include "IQmathLib.h"         // Include header for IQmath library
  2. // Don't forget to set a proper GLOBAL_Q in "IQmathLib.h" file
  3. #include "dmctype.h"
  4. #include "rmp_cntl.h"


  5. void rmp_cntl_calc(RMPCNTL *v)
  6. {       
  7.      _iq tmp;
  8.       
  9.      tmp = v->TargetValue - v->SetpointValue;
  10.      
  11.       if (_IQabs(tmp) > _IQ(0.0000305))
  12.       {
  13.          v->RampDelayCount += 1;
  14.          if (v->RampDelayCount >= v->RampDelayMax)
  15.          {
  16.            if (v->TargetValue >= v->SetpointValue)
  17.            {
  18.             v->SetpointValue += _IQ(0.0000305);        // 0.0000305 is resolution of Q15
  19.             if (v->SetpointValue > v->RampHighLimit)
  20.               v->SetpointValue = v->RampHighLimit;           
  21.             v->RampDelayCount = 0;
  22.            }
  23.            else
  24.            {
  25.             v->SetpointValue -= _IQ(0.0000305);        // 0.0000305 is resolution of Q15
  26.             if (v->SetpointValue < v->RampLowLimit)
  27.               v->SetpointValue = v->RampLowLimit;           
  28.             v->RampDelayCount = 0;
  29.            }
  30.          }        
  31.       }
  32.       else  v->EqualFlag = 0x7FFFFFFF;
  33. }

復(fù)制代碼


51hei.png

3970984contorl_2812.rar

960.54 KB, 下載次數(shù): 29, 下載積分: 黑幣 -5

評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表