• 大小: 29.54MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-06-21
  • 语言: 其他
  • 标签: BLDC  

资源简介

无刷直流电机示例代码,供大家参考。无刷直流电机示例代码,供大家参考。

资源截图

代码片段和文件信息

//============================================================================
//============================================================================
//
// FILE: BLDC_Int-DevInit_F2803x.c
//
// title: Device initialization for F2803x series
// 
// Version: 1.0 
//
// Date:  08 Jun 2011
//
//============================================================================
//============================================================================


/***************************
Note that the CLA is not used nor initialized in this project. Please download 
the Peripheral Files and Example Projects collection (SPRC832) and look at the 
cla_adc project for information on how to use and configure the CLA.
***************************/

#include “PeripheralHeaderIncludes.h“

// Functions that will be run from RAM need to be assigned to
// a different section.  This section will then be mapped to a load and
// run address using the linker cmd file.
#pragma CODE_SECTION(InitFlash “ramfuncs“);
#define Device_cal (void   (*)(void))0x3D7C80

void DeviceInit(void);
void PieCntlInit(void);
void PieVectTableInit(void);
void WDogDisable(void);
void PLLset(Uint16);
void ISR_ILLEGAL(void);

//--------------------------------------------------------------------
//  Configure Device for target Application Here
//--------------------------------------------------------------------
void DeviceInit(void)
{
WDogDisable();  // Disable the watchdog initially
DINT; // Global Disable all Interrupts
IER = 0x0000; // Disable CPU interrupts
IFR = 0x0000; // Clear all CPU interrupt flags


// Switch to Internal Oscillator 1 and turn off all other clock
// sources to minimize power consumption
EALLOW;
SysCtrlRegs.CLKCTL.bit.INTOSC1OFF = 0;
    SysCtrlRegs.CLKCTL.bit.OSCCLKSRCSEL=0;  // Clk Src = INTOSC1
SysCtrlRegs.CLKCTL.bit.XCLKINOFF=1;     // Turn off XCLKIN
SysCtrlRegs.CLKCTL.bit.XTALOSCOFF=1;    // Turn off XTALOSC
SysCtrlRegs.CLKCTL.bit.INTOSC2OFF=1;    // Turn off INTOSC2
    EDIS;


// SYSTEM CLOCK speed based on internal oscillator = 10 MHz
// 0xC =  60 MHz (12)
// 0xB =  55 MHz (11)
// 0xA =  50 MHz (10)
// 0x9 =  45 MHz (9)
// 0x8 =  40 MHz (8)
// 0x7 =  35 MHz (7)
// 0x6 =  30 MHz (6)
// 0x5 =  25 MHz (5)
// 0x4 =  20 MHz (4)
// 0x3 =  15 MHz (3)
// 0x2 =  10 MHz (2)

PLLset(0xC); // choose from options above

// Initialise interrupt controller and Vector Table
// to defaults for now. Application ISR mapping done later.
PieCntlInit();
PieVectTableInit();

   EALLOW; // below registers are “protected“ allow access.

// LOW SPEED CLOCKS prescale register settings
   SysCtrlRegs.LOSPCP.all = 0x0002; // Sysclk / 4 (15 MHz)
   SysCtrlRegs.XCLK.bit.XCLKOUTDIV=2;
      
      
// ADC CALIBRATION 
//---------------------------------------------------
// The Device_cal function which copies the ADC & oscillator calibration values
// from TI reserved OT

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-01-07 17:12  InstaSPIN_BLDC\
     文件         350  2018-01-07 17:12  InstaSPIN_BLDC\.ccsproject
     目录           0  2018-01-12 12:18  __MACOSX\
     目录           0  2018-01-12 12:18  __MACOSX\InstaSPIN_BLDC\
     文件         176  2018-01-07 17:12  __MACOSX\InstaSPIN_BLDC\._.ccsproject
     文件       31436  2013-08-15 12:50  InstaSPIN_BLDC\.cdtbuild
     文件         176  2013-08-15 12:50  __MACOSX\InstaSPIN_BLDC\._.cdtbuild
     文件       31436  2018-01-07 17:12  InstaSPIN_BLDC\.cdtbuild_initial
     文件         677  2013-08-15 12:50  InstaSPIN_BLDC\.cdtproject
     文件         176  2013-08-15 12:50  __MACOSX\InstaSPIN_BLDC\._.cdtproject
     文件       45588  2018-01-07 17:12  InstaSPIN_BLDC\.cproject
     文件        8196  2018-01-08 10:25  InstaSPIN_BLDC\.DS_Store
     文件         120  2018-01-08 10:25  __MACOSX\InstaSPIN_BLDC\._.DS_Store
     文件        2732  2018-01-07 17:12  InstaSPIN_BLDC\.project
     文件         176  2018-01-07 17:12  __MACOSX\InstaSPIN_BLDC\._.project
     文件        1541  2018-01-07 17:12  InstaSPIN_BLDC\.project_initial
     目录           0  2018-01-09 20:37  InstaSPIN_BLDC\.settings\
     文件          59  2018-01-07 17:12  InstaSPIN_BLDC\.settings\org.eclipse.cdt.codan.core.prefs
     文件          76  2018-01-09 20:37  InstaSPIN_BLDC\.settings\org.eclipse.core.resources.prefs
     文件         510  2013-08-15 12:50  InstaSPIN_BLDC\AddWatchWindowVars_F2803x.js
     文件         176  2013-08-15 12:50  __MACOSX\InstaSPIN_BLDC\._AddWatchWindowVars_F2803x.js
     文件       39757  2013-08-15 12:50  InstaSPIN_BLDC\BLDC_Int-DevInit_F2803x.c
     文件         176  2013-08-15 12:50  __MACOSX\InstaSPIN_BLDC\._BLDC_Int-DevInit_F2803x.c
     文件        5799  2013-08-15 12:50  InstaSPIN_BLDC\BLDC_Int-Settings.h
     文件         176  2013-08-15 12:50  __MACOSX\InstaSPIN_BLDC\._BLDC_Int-Settings.h
     文件       54798  2013-08-15 12:50  InstaSPIN_BLDC\BLDC_Int.c
     文件         176  2013-08-15 12:50  __MACOSX\InstaSPIN_BLDC\._BLDC_Int.c
     文件        2372  2013-08-15 12:50  InstaSPIN_BLDC\BLDC_Int.h
     文件         176  2013-08-15 12:50  __MACOSX\InstaSPIN_BLDC\._BLDC_Int.h
     文件        3010  2013-08-15 12:50  InstaSPIN_BLDC\dlog4ch-BLDC_Int.h
     文件         176  2013-08-15 12:50  __MACOSX\InstaSPIN_BLDC\._dlog4ch-BLDC_Int.h
............此处省略14772个文件信息

评论

共有 条评论