How can I use an older version's CCS header file?

163 Views Asked by At

I am trying to include "msp.h" in a CCS v9 project in order to run code in a book I am reading. Here's an example code snippet:

 * 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*/
}

It appears that it needs the msp.h include file to run, but I haven't been able to find the specific header file anywhere in the resource explorer when searching through the msp432 libraries. Any info on how to get this to compile would be great!

Thank you!

1

There are 1 best solutions below

0
On

You could throw it into the CCS cloud editor likely. Make a new project for your device and copy and paste the code there. It's generally pretty proficient at finding headers.

The basic cycle for stuff like this on the local editor is:

  • Make sure the development files for the device is installed
  • Figure out where those files are hiding
  • Dig through files until you find the header
  • Go into properties of your project and under compiler options add the folder

What may also help is to make sure you have the MSP432 stuff installed, import it's blinky led example project and see what it's include options are. Or even just modify that newly imported project with this code.

Sorry this isn't a step by step. I'm not on my computer with CCS right now.