資源簡介
程序經(jīng)過本人的驗證,可以正常運行,能夠通過PWM波控制步進(jìn)電機(jī)的正反轉(zhuǎn),還可以實現(xiàn)調(diào)速。

代碼片段和文件信息
//###########################################################################
//
//?FILE:????DSP2833x_CpuTimers.c
//
//?title:???CPU?32-bit?Timers?Initialization?&?Support?Functions.
//
//?NOTES:???CpuTimer2?is?reserved?for?use?with?DSP?BIOS?and
//??????????other?realtime?operating?systems.
//
//??????????Do?not?use?these?this?timer?in?your?application?if?you?ever?plan
//??????????on?integrating?DSP-BIOS?or?another?realtime?OS.
//
//###########################################################################
//?$TI?Release:?2833x/2823x?Header?Files?and?Peripheral?Examples?V133?$
//?$Release?Date:?June?8?2012?$
//###########################################################################
#include?“DSP2833x_Device.h“?????//?Headerfile?Include?File
#include?“DSP2833x_Examples.h“???//?Examples?Include?File
struct?CPUTIMER_VARS?CpuTimer0;
//?When?using?DSP?BIOS?&?other?RTOS?comment?out?CPU?Timer?2?code.
struct?CPUTIMER_VARS?CpuTimer1;
struct?CPUTIMER_VARS?CpuTimer2;
//---------------------------------------------------------------------------
//?InitCpuTimers:
//---------------------------------------------------------------------------
//?This?function?initializes?all?three?CPU?timers?to?a?known?state.
//
void?InitCpuTimers(void)
{
????//?CPU?Timer?0
????//?Initialize?address?pointers?to?respective?timer?registers:
????CpuTimer0.RegsAddr?=?&CpuTimer0Regs;
????//?Initialize?timer?period?to?maximum:
????CpuTimer0Regs.PRD.all??=?0xFFFFFFFF;
????//?Initialize?pre-scale?counter?to?divide?by?1?(SYSCLKOUT):
????CpuTimer0Regs.TPR.all??=?0;
????CpuTimer0Regs.TPRH.all?=?0;
????//?Make?sure?timer?is?stopped:
????CpuTimer0Regs.TCR.bit.TSS?=?1;
????//?Reload?all?counter?register?with?period?value:
????CpuTimer0Regs.TCR.bit.TRB?=?1;
????//?Reset?interrupt?counters:
????CpuTimer0.InterruptCount?=?0;
//?CpuTimer2?is?reserved?for?DSP?BIOS?&?other?RTOS
//?Do?not?use?this?timer?if?you?ever?plan?on?integrating
//?DSP-BIOS?or?another?realtime?OS.
????//?Initialize?address?pointers?to?respective?timer?registers:
????CpuTimer1.RegsAddr?=?&CpuTimer1Regs;
????CpuTimer2.RegsAddr?=?&CpuTimer2Regs;
????//?Initialize?timer?period?to?maximum:
????CpuTimer1Regs.PRD.all??=?0xFFFFFFFF;
????CpuTimer2Regs.PRD.all??=?0xFFFFFFFF;
????//?Make?sure?timers?are?stopped:
????CpuTimer1Regs.TCR.bit.TSS?=?1;
????CpuTimer2Regs.TCR.bit.TSS?=?1;
????//?Reload?all?counter?register?with?period?value:
????CpuTimer1Regs.TCR.bit.TRB?=?1;
????CpuTimer2Regs.TCR.bit.TRB?=?1;
????//?Reset?interrupt?counters:
????CpuTimer1.InterruptCount?=?0;
????CpuTimer2.InterruptCount?=?0;
}
//---------------------------------------------------------------------------
//?ConfigCpuTimer:
//---------------------------------------------------------------------------
//?This?function?initializes?the?selected?timer?to?the?period?specified
//?by?the?“Freq“?and?“Period“?parameters.?The?“Freq“?is?entered?as?“MHz“
//?and?the?period?in?“uSeconds“
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????168??2017-10-31?15:46??Step_Motor\.ccsproject
?????文件???????8818??2013-08-15?12:53??Step_Motor\.cdtbuild
?????文件???????8818??2014-03-11?10:04??Step_Motor\.cdtbuild_initial
?????文件????????553??2013-08-15?12:53??Step_Motor\.cdtproject
?????文件??????15466??2018-07-01?10:55??Step_Motor\.cproject
?????文件???????4239??2014-03-25?22:50??Step_Motor\.launches\Example_2833x_fulltest.launch
?????文件??????13477??2017-10-30?17:29??Step_Motor\.launches\Example_2833x_Step_Motor.launch
?????文件???????1489??2017-10-31?08:20??Step_Motor\.project
?????文件???????3001??2014-03-11?10:04??Step_Motor\.project_initial
?????文件?????????62??2015-09-26?22:09??Step_Motor\.settings\org.eclipse.cdt.codan.core.prefs
?????文件????????123??2014-03-23?21:56??Step_Motor\.settings\org.eclipse.cdt.debug.core.prefs
?????文件????????293??2015-02-26?17:51??Step_Motor\.settings\org.eclipse.core.resources.prefs
?????文件???????7254??2014-03-11?14:47??Step_Motor\28335_RAM_lnk.cmd
?????文件????????601??2018-07-01?10:50??Step_Motor\Debug\ccsObjs.opt
?????文件???????1527??2018-07-01?10:50??Step_Motor\Debug\DSP2833x_ADC_cal.obj
?????文件???????1831??2018-07-01?10:50??Step_Motor\Debug\DSP2833x_CodeStartBranch.obj
?????文件???????3915??2018-07-01?10:50??Step_Motor\Debug\DSP2833x_CpuTimers.d
?????文件???????6226??2018-07-01?10:50??Step_Motor\Debug\DSP2833x_CpuTimers.obj
?????文件???????6015??2016-04-17?10:14??Step_Motor\Debug\DSP2833x_CpuTimers.pp
?????文件???????3943??2018-07-01?10:50??Step_Motor\Debug\DSP2833x_DefaultIsr.d
?????文件??????31836??2018-07-01?10:50??Step_Motor\Debug\DSP2833x_DefaultIsr.obj
?????文件???????6043??2016-04-17?10:14??Step_Motor\Debug\DSP2833x_DefaultIsr.pp
?????文件???????3775??2018-07-01?10:50??Step_Motor\Debug\DSP2833x_EPwm.d
?????文件??????16723??2018-07-01?10:50??Step_Motor\Debug\DSP2833x_EPwm.obj
?????文件???????5875??2016-04-17?10:14??Step_Motor\Debug\DSP2833x_EPwm.pp
?????文件???????3137??2018-07-01?10:50??Step_Motor\Debug\DSP2833x_GlobalVariableDefs.d
?????文件?????128324??2018-07-01?10:50??Step_Motor\Debug\DSP2833x_GlobalVariableDefs.obj
?????文件???????4733??2016-04-17?10:14??Step_Motor\Debug\DSP2833x_GlobalVariableDefs.pp
?????文件???????3775??2018-07-01?10:50??Step_Motor\Debug\DSP2833x_Gpio.d
?????文件??????12198??2018-07-01?10:50??Step_Motor\Debug\DSP2833x_Gpio.obj
............此處省略113個文件信息
- 上一篇:直流無刷電機(jī)控制算法
- 下一篇:U8采購業(yè)務(wù)流程圖
評論
共有 條評論