-
大小: 122KB文件類型: .zip金幣: 2下載: 2 次發布日期: 2021-05-07
- 語言: 其他
- 標簽: MSP430F5529??
資源簡介
用與430F5529的程序測試,例程改編,已測試,可放心使用

代碼片段和文件信息
++/****************************************************************************************
?* @brief: 直流電機驅動Demo
?* @files:?main.c
?* @date: 2015-04-24
?* @athour:zhangkai
?* @pin:
?* ???????LCD:P3.2???<--->??SCK
?* ???????????P3.0???<--->??SDA
?* ???????????P2.6???<--->??CS
?* ???????????P3.7???<--->??CD
?* ???????????P8.2???<--->??RES
?* ???????????????????直流電機: P1.2???<--->??PWM
?* ??????????? P6.1???<--->??HIGH
?*
?* ??????????????????使能: P6.1???<--->??HIGH
?****************************************************************************************/
#include??
#include?
#include?
#include?“sysclk.h“
#include?“grlib.h“
#include?“Template_Driver.h“
#include?“wheel.h“
#include?“graph_extend.h“
#include?“button.h“
#define?CCR_TIMER? 10000
extern?uint16_t?count?=?0;
/****************************************************************************
?*?@brief: 初始化PWM
?*?@param: none
?*?@return: none
?***************************************************************************/
void?Init_PWM(){
//?PWM波生成
TA0CCR0?=?CCR_TIMER?-?1;?????????????????????????? //?PWM?Period
TA0CCTL1?=?OUTMOD_7;?????????????????????? //?CCR1?reset/set
TA0CCR1?=?CCR_TIMER?/?2;??????????????????????????? //?CCR1?PWM?duty?cycle
TA0CTL?=?TASSEL_2?+?MC_1?+?TACLR;?????????//?SMCLK?up?mode?clear?TAR
}
/****************************************************************************
?*?@brief: 初始化P2.0?中斷捕獲
?*?@param: none
?*?@return: none
?***************************************************************************/
void?Init_Cap_Int(){
// TimerA?1.1?捕獲模式
//IO初始化
P2DIR?&=?~BIT0;
P2SEL?|=?BIT0; ? //P2.0設置為捕獲輸入CCI0A
P2IES?|=?BIT0;
P2IE?|=?BIT0;
TA1CCTL1?&=?~(CCIS1?+?CCIS0);?????????//捕獲源為P2.0,即CCI0A(也是CCI0B)
TA1CCTL1?|=?CM_2?+?SCS?+?CAP;?????????//下降沿捕獲,同步捕獲,工作在捕獲模式
TA1CCTL1?|=?CCIE;?????????????????????//允許捕獲比較模塊提出中斷請求
TA1CTL?|=?ID_3;? /*?Timer?A?input?divider:?3?-?/8?*/
TA1CTL?|=?TASSEL_2;???????????????????//選擇時鐘MCLK
TA1CTL?|=?TACLR;??????????????????????//定時器清零,
//定時器開始計數(連續計數模式0~0xFFFF)
TA1CTL?|=?MC_2;
_EINT(); // ?允許P1.3中斷
}
/****************************************************************************
?*?@brief: 初始化端口
?*?@param: none
?*?@return: none
?***************************************************************************/
void?Init_Port()
{
P6DIR?|=?BIT1; //P6.1
P6OUT?|=?BIT1;
P4DIR?|=?BIT0; //P4.0
P4OUT?|=?BIT0;
P1DIR?|=?BIT2;??????????????????????//?P1.2?PWM輸出
P1SEL?|=?BIT2;??????????????????????//?P1.2?options?select
}
/****************************************************************************************
?*?main.c
?***************************************************************************************/
int?main(void)
{
????WDTCTL?=?WDTPW?|?WDTHOLD; //?Stop?watchdog?timer
SysClk_Init(); //設置時鐘為25Mhz
LCD_WheelInit();
LCD_ButtonInit();
Init_Port();
Init_PWM();
Init_Cap_Int();
//-----顯示庫函數初始化-----
tContext?g_sContext;
Template_DriverInit();
GrContextInit(&g_sContext?&g_sT
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-04-26?16:19??CH6_DC_Motor\
?????文件?????????545??2015-07-04?14:58??CH6_DC_Motor\.ccsproject
?????文件???????31040??2015-07-04?14:58??CH6_DC_Motor\.cproject
?????目錄???????????0??2016-04-26?16:19??CH6_DC_Motor\.launches\
?????文件????????4237??2015-07-04?14:58??CH6_DC_Motor\.launches\CH3_LCD.launch
?????文件????????4318??2015-07-07?10:07??CH6_DC_Motor\.launches\CH6_DC_Motor.launch
?????文件????????4314??2015-07-04?14:58??CH6_DC_Motor\.launches\DC_Motor_MSEK_5529.launch
?????文件?????????842??2015-07-04?14:58??CH6_DC_Motor\.project
?????目錄???????????0??2016-04-26?16:19??CH6_DC_Motor\.settings\
?????文件??????????62??2015-07-04?14:58??CH6_DC_Motor\.settings\org.eclipse.cdt.codan.core.prefs
?????文件?????????123??2015-07-04?14:58??CH6_DC_Motor\.settings\org.eclipse.cdt.debug.core.prefs
?????文件?????????907??2015-07-04?14:58??CH6_DC_Motor\.settings\org.eclipse.core.resources.prefs
?????目錄???????????0??2016-04-26?16:24??CH6_DC_Motor\Debug\
?????文件???????52693??2015-08-05?09:42??CH6_DC_Motor\Debug\CH6_DC_Motor.map
?????文件??????326909??2015-08-05?09:42??CH6_DC_Motor\Debug\CH6_DC_Motor_li
?????目錄???????????0??2016-04-26?16:19??CH6_DC_Motor\Debug\Graph\
?????目錄???????????0??2016-04-26?16:24??CH6_DC_Motor\Debug\Graph\Fonts\
?????文件?????????551??2015-08-05?09:42??CH6_DC_Motor\Debug\Graph\Fonts\fontcm16.pp
?????文件?????????557??2015-08-05?09:42??CH6_DC_Motor\Debug\Graph\Fonts\fontcm16b.pp
?????文件?????????575??2015-08-05?09:42??CH6_DC_Motor\Debug\Graph\Fonts\fontfixed6x8.pp
?????文件????????4714??2016-04-26?16:24??CH6_DC_Motor\Debug\Graph\Fonts\subdir_rules.mk
?????文件?????????942??2016-04-26?16:24??CH6_DC_Motor\Debug\Graph\Fonts\subdir_vars.mk
?????目錄???????????0??2016-04-26?16:24??CH6_DC_Motor\Debug\Graph\LCD_Driver\
?????文件????????2251??2015-08-05?09:42??CH6_DC_Motor\Debug\Graph\LCD_Driver\Template_Driver.pp
?????文件????????1800??2016-04-26?16:24??CH6_DC_Motor\Debug\Graph\LCD_Driver\subdir_rules.mk
?????文件?????????640??2016-04-26?16:24??CH6_DC_Motor\Debug\Graph\LCD_Driver\subdir_vars.mk
?????目錄???????????0??2016-04-26?16:24??CH6_DC_Motor\Debug\Graph\graph_extend\
?????文件????????1525??2015-08-05?09:42??CH6_DC_Motor\Debug\Graph\graph_extend\graph_extend.pp
?????文件????????1799??2016-04-26?16:24??CH6_DC_Motor\Debug\Graph\graph_extend\subdir_rules.mk
?????文件?????????634??2016-04-26?16:24??CH6_DC_Motor\Debug\Graph\graph_extend\subdir_vars.mk
?????目錄???????????0??2016-04-26?16:24??CH6_DC_Motor\Debug\Graph\grlib\
............此處省略61個文件信息
- 上一篇:Dexpress gridcontrol控件分頁
- 下一篇:白盒測試 實驗報告
評論
共有 條評論