This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

An introductory book to learn C for the 8051

I am reading "Patterns for time triggered embedded systems" of Michael J. Pont but I realized that I have a lack of C language knowledge. Could you please suggest me wich one among the two books listed below is the best choice?

- C and the 8051 Thomas Schultz

- Microcontroller projects in C for the
8051 family. Dogan Ibrahim

Thank you in advance

Francesco Fontana

Parents
  • If you think that "embedded C" of Mr.Pont is better of the "C and the 8051" of Thomas Shultz I would consider to buy this one too.
    The one of Thomas was reccomended by this
    web site in the book's list but actually In the amazon web site I saw only one review. I already bought the book anyway.
    I have a very good knowledge of Java, I am studing for an university degree exam about basic datastructures in Java. I studied in the past some C just for fun as I am doing with the 8051. But still I am not sure I know all what is needed to be confident with C.
    For Instance, memory allocation and pointers do not exist in java and I never understood the real purpose of the function "malloc". So you are probably right, a deeper understanding of C is useful but for that I have already a good book about ansi C to browse if needed.
    A normal C compiler by the way doesnt have a specific keyword to define which memory, internal external or the XRAM ( as I recently discovered in the p89c51) to use for the variables, or the sbit definition. For instance how can I know if the memory available on a standard 8051 is enough to calculate a sinus(). A normal high level language compiler assumes an almost endless memory so you never deal with these problems. Another concern, since as long as I understood C uses a software stack, is it necessary to use an external ram to run
    programs compiled in C ? what about recursion?. I don't want to waste your sometimes really precious time. I just wrote more to let you guess my level of knowledge of the topic.

    Thank you

    Francesco Fontana

Reply
  • If you think that "embedded C" of Mr.Pont is better of the "C and the 8051" of Thomas Shultz I would consider to buy this one too.
    The one of Thomas was reccomended by this
    web site in the book's list but actually In the amazon web site I saw only one review. I already bought the book anyway.
    I have a very good knowledge of Java, I am studing for an university degree exam about basic datastructures in Java. I studied in the past some C just for fun as I am doing with the 8051. But still I am not sure I know all what is needed to be confident with C.
    For Instance, memory allocation and pointers do not exist in java and I never understood the real purpose of the function "malloc". So you are probably right, a deeper understanding of C is useful but for that I have already a good book about ansi C to browse if needed.
    A normal C compiler by the way doesnt have a specific keyword to define which memory, internal external or the XRAM ( as I recently discovered in the p89c51) to use for the variables, or the sbit definition. For instance how can I know if the memory available on a standard 8051 is enough to calculate a sinus(). A normal high level language compiler assumes an almost endless memory so you never deal with these problems. Another concern, since as long as I understood C uses a software stack, is it necessary to use an external ram to run
    programs compiled in C ? what about recursion?. I don't want to waste your sometimes really precious time. I just wrote more to let you guess my level of knowledge of the topic.

    Thank you

    Francesco Fontana

Children
  • For Instance, memory allocation and pointers do not exist in java and I never understood the real purpose of the function "malloc".
    For the '51 you do not need to. Malloc is one of the C features you should avoid when using the '51

    For instance how can I know if the memory available on a standard 8051 is enough to calculate a sinus(). A normal high level language compiler assumes an almost endless memory so you never deal with these problems.
    if there is not enough, you will get an error message. I suggest you get a SILabs f120 devkit ($149) that gives you "everything" (128k program memory, 8k data memory)

    Another concern, since as long as I understood C uses a software stack, is it necessary to use an external ram to run
    programs compiled in C ?

    Keil C does not pass parametres on the stack. If you need more than the standatd 256 bytes of DATA storage, instead of an external RAM, use one of the chips such as SILabs f12x, Pilips P89C668... that has "external RAM inside"

    what about recursion?.
    just avoid it, if you do it by mistake, you WILL get an error message. If you absolutotally, unconditionally, unavoidably need it there is the "reentrant" keyword.

    Erik

  • the SILabs devkits gives you ICElike capabilities which I would not like to be without were I to learn a new processor.

  • "A normal C compiler by the way doesnt have a specific keyword to define which memory, internal external or the XRAM ... since as long as I understood C uses a software stack, is it necessary to use an external ram to run programs compiled in C ? what about recursion?..."

    As I said earlier, all of this is compiler-specific stuff - so you will need to read the Manual for the specific compiler.

    The manual assumes that you already understand the 'C' language - that's why we suggest that you learn the language first, then the Keil specifics.