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

Understand The 8051's Capabilities and C51 Assembly Output.

One of THE worst things you can do in C51 code is to haphazardly use integers where unsigned chars (bytes) will suffice. Particularly when indexing arrays.

While this may seem obvious to some, in my years of changing diapers (i.e. working on code written by other's who are now off destroying some other company's software department) I have run across this mistake countless times, where the non-obvious result is at least over-bloated code and/or, at worst randomly dysfunctional code.

Does ANYONE in this industry bother taking the time to inspect the assembly code resulting from a compile? Does anyone even care? ...or is 95% of the industry filled with hacks who verify their code by functional "appearance" alone? My experience suggest the latter.

The Moral:
Keil C51 is without question top notch, but its not magic. Thus, do your career and your company a favor an make an effort to understand the 8051 indepth and understand what is and what isn't good C51 programming techniques.

[end rant]

Parents Reply Children
  • Robert, I am sure you have seen from my posts that I wholehardedly support your opinion.

    More and more often we see posts "I wrote in C, why does it not work" from individuals that code the '51 as a "mini PC".

    C can be written as "who cares where it is to run" or "architecture friendly". No one can write "architecture friendly" if they refuse to get even an inkling how the processor works.

    The '51 is (I love it) MEAN to those that will not take the time to familiarize themselves with the architecture.

    As to "checking the generated assembly" I hope you refer to doing so when problems arise, not on a total basis. It is amazing how easy it is to find a C error when looking at the generated assy whereas checking a whole program seems busywork.

    Have fun,

    Erik