本帖最后由 xyz549040622 于 2023-2-23 22:16 编辑
1、打开CCS新建工程
2、选择开发板的芯片型号,工程名称,新建空白工程。
3.添加驱动库文件。
4、找到MSP430FR5xx_6xx的库文件,复制到刚建立的driverlib文件夹下,会自动添加到ccs的文件夹目录下
5、将库文件的路径添加到头文件调用;
6、将库文件路径添加到MSP430 Linker路径下;
7、增加一段led翻转的代码;
- #include <driverlib.h>
- int main(void) {
- volatile uint32_t i;
- // Stop watchdog timer
- WDT_A_hold(WDT_A_BASE);
- // Set P1.0 to output direction
- GPIO_setAsOutputPin(
- GPIO_PORT_P1,
- GPIO_PIN0
- );
- // Disable the GPIO power-on default high-impedance mode
- // to activate previously configured port settings
- PMM_unlockLPM5();
- while(1)
- {
- // Toggle P1.0 output
- GPIO_toggleOutputOnPin(
- GPIO_PORT_P1,
- GPIO_PIN0
- );
- // Delay
- for(i=10000; i>0; i--);
- }
- }
8、编译一下,还好,没有报错,但是警告一堆,暂且忽略他;
9、点击瓢虫进入debug模式,点击运行,led闪烁OK。
|