EasyManua.ls Logo

Texas Instruments MSP430

Texas Instruments MSP430
398 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Lab 4a Program the MSP430 Clocks
6. Try building to see if there are any errors.
Hopefully you don’t have any typographic or syntax errors, but you should see this error:
fatal error #1965: cannot open source file "myClocks.h"
Since we placed the clock function into another file, we should use a header file to provide an
external interface for our code.
7. Create a new source file called myclocks.h.
File New Header File
Then click ‘Finish’.
8. Add prototype to new header file.
CCS automatically creates a set of #ifndef statements, which are good practice to use
inside of your header files. It helps to keep items from accidentally being defined more than
once which the compiler will complain about.
All we really need in the header file is the prototype of our initClocks() function:
/*
* myClocks.h
*/
#ifndef MYCLOCKS_H_
#define MYCLOCKS_H_
//***** Prototypes *************************************************
void initClocks(void);
#endif /* MYCLOCKS_H_ */
9. Add reference to myclocks.h to your main.c.
While we’re working with this header file, it’s a good time to add a #include to it at the top of
your main.c. Otherwise, you will get a warning later on.
10. Try building again. Keep fixing errors until they’re all gone.
MSP430 Workshop - MSP430 Clocks & Initialization 4 - 49

Table of Contents

Other manuals for Texas Instruments MSP430

Related product manuals