This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
第一个程序:
/******************************************************************************* * MSP432 GPIO - Toggle Output High/Low * * Description: In this very simple example, the LED on P1.0 is configured as * an output using DriverLib's GPIO APIs. An infinite loop is then started * which will continuously toggle the GPIO and effectively blink the LED. * * MSP432P401 * ------------------ * /|\| | * | | | * --|RST P1.0 |---> P1.0 LED * | | * | | * | | * | | * * Author: Timothy Logan ******************************************************************************/ /* DriverLib Includes */ #include "driverlib.h" /* Standard Includes */ #include <stdint.h> #include <stdbool.h> int main(void) { volatile uint32_t ii; /* Halting the Watchdog */ MAP_WDT_A_holdTimer(); /* Configuring P1.0 as output */ MAP_GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0); while (1) { /* Delay Loop */ for(ii=0;ii<5000;ii++) { } MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0); } }
第二个程序:
//*************************************************************************************** // Blink the LED Demo - Software Toggle P1.0 // // Description; Toggle P1.0 inside of a software loop. // ACLK = n/a, MCLK = SMCLK = default DCO // // MSP432P4xx // ----------------- // /|\| XIN|- // | | | // --|RST XOUT|- // | | // | P1.0|-->LED // // E. Chen // Texas Instruments, Inc // March 2015 // Built with Code Composer Studio v6 //*************************************************************************************** #include <ti/devices/msp432p4xx/driverlib/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 ); while(1) { // Toggle P1.0 output GPIO_toggleOutputOnPin( GPIO_PORT_P1, GPIO_PIN0 ); // Delay for(i=100000; i>0; i--); } }
这里就要说说msp432的driverlib和SimpleLink MSP432P4 SDK的特性。
msp432的driverlib:
In addition to being able to control the MSP432 peripherals, DriverLib also gives the user the ability to use common ARM peripherals such as the Interrupt (NVIC) and Memory Protection Unit (MPU) as well as MSP430 peripherals such as the eUSCI Serial peripherals and Watchdog Timer (WDT).
在驱动库的手册里,对msp432的驱动库做了如上描述。也就是说msp432的driverlib使用起来和msp430的驱动库一样。msp432和msp430的驱动库有相似的api函数名和类似的使用方法。对于用惯了msp430的用户来说,使用msp432会非常方便。
SimpleLink MSP432P4 SDK:
SimpleLink是ti近几年新推出的一个平台。
提供最广泛的有线和无线 Arm® MCU(片上系统)产品系列,通过这一个环境即可为物联网和汽车应用提供灵活的硬件、软件和工具选项。
意思就是ti整个SimpleLink系列,包含蓝牙、zigbee、wifi等都统一在了一起。用官网的一个图最能说明这个问题:
SimpleLink统一了有线和无线平台,代码100%可移植性,完整物联网应用的安全性,还有终极的低功耗性能。
SimpleLink还提供了丰富的SDK plug-ins,还有可选的OS,和中间件,并包含了driverlib。driverlib是SimpleLink中的一部分。
总之:
1、如果是从msp430转到msp432的人员,和新入门的网友,可以先使用driverlib,然后慢慢熟悉SimpleLink。
2、如果有一定基础,建议尽早开始熟悉SimpleLink。SimpleLink是未来的趋势,是在不同物联网连接方式间快速切换的利器。