Find a description of the C microcontroller language header file

Updated on technology 2024-04-21
7 answers
  1. Anonymous users2024-02-08

    In my experience with keil, header files are best used to describe some functions, not to define variables or anything, and variables are better defined above or inside the main function.

    For example, if you call the delay() function in the main() function, then you better define it in the header file, and of course, if you write the delay() function body above the main() function, you can not define this header file. The purpose of the header file is to tell you that this function exists.

    Different compilers are different, such as keil, Ya's functions are all written on a piece of paper, which is more troublesome to consult, so it is more convenient to consult the header file, if you are using CW to compile the freescale chip, the header file is not very important, because the CW functions can be written separately, and then compiled centrally.

    It's a bit verbose, hehe. Hope it helps.

    Forget to mention that the header file of the system (for example, defines the name of your MCU port and register, which is required, and the bytes are assigned according to the name in it when writing.

  2. Anonymous users2024-02-07

    I have a book on the principles and control techniques of microcontrollers. I'm too lazy to type, though!

  3. Anonymous users2024-02-06

    It is to declare calls to functions in other files.

  4. Anonymous users2024-02-05

    1. In fact, writing a C language program can completely eliminate the need for header files. For the include directive, the compilation process simply replaces the included file in text form with the line where include is located during the preprocessing phase. It can be seen that the content of the header file is also compiled by the compiler (after preprocessing), and if you write the content of the header file in the source file, you can use it without include.

    If you learn C, you should be able to write header files (whether it is necessary or not is another matter).

    The contents of header files are generally function declarations, macros, inline functions, and so on. If you only have one source file, you can do without headers at all (although it may be more convenient to use an existing header file). However, when you need to use the same declaration more than once in multiple files, etc., copying will obviously increase the maintenance cost (once you change one source file, you need to copy and paste it into another source file), so it is obvious that you should use header files to reduce the burden.

    The header file will be included in multiple source files to generate multiple objects, so you should not put the definition of functions and global static objects in the header file (but only declarations) to avoid duplicate definition errors from the linker (and generally should not contain another source file in one source file). Therefore, it is generally customary to use a header file to correspond to a source file, and the main file name is the same to facilitate viewing the correspondence. In addition, function and object declarations can correspond not to source files but to external static library files that have already been compiled (e.g.

    lib), there is no need to compile again, and the C standard library is an example.

  5. Anonymous users2024-02-04

    C of course, yes.

  6. Anonymous users2024-02-03

    C headers are of course written in C, and headers are usually written with include""Contain.

    Header files exist only for convenience, not necessarily for them.

    You don't have to do anything with headers, for example, if you use a mathematical function sin() to find the sinusoid, then you have to use include, because the sin() function is defined in the header file, and some of the header files have not only the definition of the function, but also the implementation, and some of the header files only have declarations, but the implementation is in the library file (lib file or dll file).

    If you are fully capable of implementing a new sin() to find the sinusoidal value yourself, then there is no need to use systematic, or someone else's, and there is no need to use someone else's header file.

  7. Anonymous users2024-02-02

    C headers can be used with any text input software, as well as Notepad, as long as the extension is set to. h

    Of course, it would be nice to write in a professional programming environment such as Visual Studio or Visual C++.

    If you know C, you will be able to make header files, and you also need a source file corresponding to the header file, because headers are generally only responsible for declarations, and source files are responsible for definitions.

Related questions
4 answers2024-04-21

The introductory course of MCU C language programming is not difficult, it is not easy to say, and the first thing to understand is to understand what these two things are when learning MCU C language? The introductory programming of single-chip microcomputer is mainly to learn C language, followed by circuit and programming language. >>>More

7 answers2024-04-21

It's actually just a written function;

Each chip comes with one or several simple functions that are written; It is convenient for us to develop. >>>More

7 answers2024-04-21

lz understands the same thing, and it is true that it is to avoid repetition, but not to avoid repeating declarations, but to avoid repeating definitions. In general, all declarations of C are repeatable, as long as the duplicate declarations are identical. However, definitions should not be repeated, even if they are identical, and repeating them will lead to compilation errors. >>>More

4 answers2024-04-21

You use a P1 port to control the dynamic scanning of 8 digital tubes, and the dynamic scanning display of digital tubes needs to be blanked. >>>More

6 answers2024-04-21

With c, I think about it:

1. It has something to do with hardware, do you know this? >>>More