I need help in initializing DAC. I'm using the CCS (Code Composer Studio v.4) i tried putting #include "DAC_init.h" but there was an error saying that the source file "DAC_init.h" cannot be opened.
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.
I need help in initializing DAC. I'm using the CCS (Code Composer Studio v.4) i tried putting #include "DAC_init.h" but there was an error saying that the source file "DAC_init.h" cannot be opened.
DAC_init.h is no part of the compiler distribution, so it isn't in the default include path. If you want to use a file of that name, you need to add it to the project (in case of a coude source file) or at least put it into the project folder (in case of an included header file).Shermaine Tan said:source file "DAC_init.h" cannot be opened.
The compiler-provided header files only contain the definitions to access the DAC registers, but no code to do something with the DAC. These header files, more precisely the versions you need for your actual MSP, are auto-included when you include the msp430.h or msp430xyyyy.h file into your code.
Jens-Michael Gross said:These header files, more precisely the versions you need for your actual MSP, are auto-included when you include the msp430.h or msp430xyyyy.h file into your code.
Hi, I've written #include <msp430g2553.h> but source file <DAC_init.h> still cannot be opened. I also tried getting the codes for DAC_init.h in the internet but it seems wrong.
It's not part of the compiler provided includes and not in the default include path. It's just a source file like any you wrote on your own. You have to put it into your project to use it (and use "" instead of <> to include it, brackets indicate default include file from default include path, while double quotes indicate a project include file from project include path)Shermaine Tan said:but source file <DAC_init.h> still cannot be opened.
It's not sufficient to say 'I know there is somewhere int he world a file with this name, and I want it included'.
Either it is a default (compiler provided) include (which it isn't) or you must copy it into your project.
Also, an include (.h) file alone only announces that there are functions or variables available to the project. It declares them. It doesn't define them. So you still have to add a proper .c file or a library, containing the announced code, to your project too.
But that's all not MSP specific, that's basic C coding knowledge.
**Attention** This is a public forum