我试图在 CCS v9 项目中包含“msp.h”,以便在我正在阅读的书中运行代码。这是一个示例代码片段:
* This program toggles green LED for 0.5 second ON and 0.5 second OFF.
* The green LED is connected to P2.1.
* The LEDs are high active (a '1' turns ON the LED).
*
* Tested with Keil 5.20 and MSP432 Device Family Pack V2.2.0
* on XMS432P401R Rev C.
*/
#include "msp.h"
void delayMs(int n);
int main(void) {
P2->SEL1 &= ~2; /* configure P2.1 as simple I/O */
P2->SEL0 &= ~2;
P2->DIR |= 2; /* P2.1 set as output pin */
while (1) {
P2->OUT |= 2; /* turn on P2.1 green LED */
delayMs(500);
P2->OUT &= ~2; /* turn off P2.1 green LED */
delayMs(500);
}
}
/* delay milliseconds when system clock is at 3 MHz for Rev C MCU */
void delayMs(int n) {
int i, j;
for (j = 0; j < n; j++)
for (i = 750; i > 0; i--); /* Delay 1 ms*/
}
看来它需要 msp.h 包含文件才能运行,但是在搜索 msp432 库时,我无法在资源浏览器的任何地方找到特定的头文件。任何关于如何编译它的信息都会很棒!
谢谢!