??? 01/10/05 15:27 Read: times |
#84670 - Headers Responding to: ???'s previous message |
Christopher Seeley said:
I am not failure with C I presume you that you are not familiar with 'C'?! ;-) I have now read a couple of books on C for the 8051 Excellent! Always a good start. one thing I notice, is that all the code examples have a header file associated with the processor. (#include 8051.h or somethin like that) It seems that these books assume that the reader already has this header file. There is no mention of creating it. Is there a collection of these somewhere? As Erik says, this will come with your compiler, or your compiler Documentation will tell you what to do. The content will necessarily be specific to the particular compiler that you're using - which is why general books won't give much detail. From what I gather so far, the header file is just a way to define all the registers. Yes - just like the standard 'C' include files like stdlib.h, stdio.h declare the standard Library functions The 'C' programming language makes no provision for dealing with the 8051's CPU registers, SFRs, DATA, IDATA, etc, etc, so 8051 Compiler writers have to make up their own extensions to the language to cope with them - that's why I said above that these header contents will be Compiler-Specific. Note that there is nothing special nor magic about a header file: anything in a header file could just be put directly into a C file - using #include and headers just makes it easier to share the contents without having to maintain it all in many different places! For my next project, I'll be using a TI MSC1213, or MSC1214. I was considering this as my first project in C. The stumbling block at this point is the header file that that defines the registers, and printf. printf is declared in the standard header stdio.h - this is the samm for all 'C' compilers, irrespective of their target. There will be (or you will need to find/create) a variant-specific header file that that defines the MSC1213/4 SFRs Would you folks care to explain the actual purpose of a header file, See above? The general principles of header files will be covered in any 'C' textbook and then point me to some text that would explain its creation. See above, and: http://www.8052.com/forum/read.phtml?id=84434 |
Topic | Author | Date |
C header file | 01/01/70 00:00 | |
find or make | 01/01/70 00:00 | |
Headers | 01/01/70 00:00 | |
What Compiler are you using | 01/01/70 00:00 | |
C header file for SDCC | 01/01/70 00:00 | |
Great!![]() | 01/01/70 00:00 |