標(biāo)題:
MSP430F6638單片機(jī)Demo源碼下載
[打印本頁(yè)]
作者:
1545bb
時(shí)間:
2018-5-15 20:45
標(biāo)題:
MSP430F6638單片機(jī)Demo源碼下載
msp4306638系列代碼
0.png
(49.98 KB, 下載次數(shù): 63)
下載附件
2018-5-16 00:21 上傳
所有資料51hei提供下載:
MSP430F6638_DemoV3.0.rar
(13.2 MB, 下載次數(shù): 35)
2018-5-15 20:44 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
源碼列表:
1.LED
10.PortMap
11.Timer_PWM
12.Timer_source
13.Timer_compare
14.Timer_capture
15.LCD_segment
16.MatrixKeyboard_DigitalTube
17.LCD_TFT_String
18.RTC
19.UART_RS232
2.Key_interrupt
20.UART_RS485
21.UART_IrDA
22.IIC_IrfraredThermopile&DigitalTemperature
23.TouchPad_CAP
25.UsbMessStorage
26.UsbMouse
27.SD_WriteRead
28.SD_FAT
29.LowPower
3.Key_debounce
30.ADC_Potentiometer
31.ADC_Record
32.DAC_Wave&Speaker
33.StepperMotor_DCMotor
單片機(jī)源程序如下:
/**
******************************************************************************
* @文件名 main.c
* @作者 DY
* @版本 V3.0
* @摘要 步進(jìn)電機(jī)測(cè)試程序
******************************************************************************
* @All right reserved.
*/
/* Includes ------------------------------------------------------------------*/
#include <msp430f6638.h>
#include "cd4052.h"
#include "DRV8833.H"
#include "ADC.h"
#include "step_motor.h"
#include "Timer.h"
#include "Segment_LCD.h"
#include "HAL_PMM.H"
#include "HAL_UCS.H"
extern uint16_t results[4];
uint8_t ADC_FLAG = 0;
uint8_t Update = 0; //數(shù)碼管更新標(biāo)志位
uint16_t Pot_ADC_Result = 0 ;
/* Private function prototypes -----------------------------------------------*/
void Up_ClockFor_20MHZ(void);
/* Private functions ---------------------------------------------------------*/
/*!
*函數(shù)功能:主函數(shù)
*輸入?yún)?shù):無(wú)
*輸出參數(shù):無(wú)
*返回值: 無(wú)
*/
int main(void)
{
uint8_t m = 0;
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
Up_ClockFor_20MHZ(); // 時(shí)鐘倍頻到20MHz
ADC_Init(); // 初始化電位器
//LED初始化
P4DIR |= BIT4+BIT5+BIT6;
//段式LCD初始化
Init_TS3A5017DR(); // Configure TS3A5017DR IN1 and IN2
Init_lcd(); // LCD初始化
Backlight_Enable(); // 打開背光
LcdGo(1); // 打開液晶模塊
LCD_Clear(); // 清屏
CD4052_Configure();
Chanel_Configure(STEP_MOTOR);// 通道切換--->Step Motor
DRV8833_Init();
Step_nSleep_Enable(); // 步進(jìn)電機(jī)使能
Step_Timer_Init(); // 配置控制步進(jìn)電機(jī)的定時(shí)器
TIM_Capture_Config(); // 配置輸入捕獲通道
TIM_Update_Config(); // 配置定時(shí)器,定時(shí)更新捕獲的數(shù)據(jù)
__bis_SR_register(GIE); // 使能中斷
while(1)
{
if(ADC_FLAG == 1)
{
for(m = 0 ; m < 4 ; m++)
{
Pot_ADC_Result += results[m];
}
Pot_ADC_Result = Pot_ADC_Result >> 2;//0~~4096
//Set_TA0CCR0(Pot_ADC_Result);
//TA1CCR0 = Pot_ADC_Result;
ADC_FLAG = 0;
}
}//end while(1)
}
void Up_ClockFor_20MHZ(void)
{
SetVCore(PMMCOREV_3); // Set Vcore to accomodate for max. allowed system speed
UCSCTL3 |= SELREF_2; // Set DCO FLL reference = REFO
UCSCTL4 |= SELA_2; // Set ACLK = REFO
Init_FLL_Settle(20000, 630); // Set system clock to max (20MHz)
}
復(fù)制代碼
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1