Re: Microcontroller Project



Keith wrote:
In article <1143494228.117311.162780@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
altzone@xxxxxxxxx says...
Keith wrote:
In article <1143447041.276029.172680@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
altzone@xxxxxxxxx says...
Keith wrote:
On Sun, 26 Mar 2006 17:28:03 -0800, David L. Jones wrote:

akshaychander@xxxxxxxxx wrote:
Sorry for the late reply.

Yes, I have to do the project in 8051. I have studied the theory of
8051, but have very little practical experience.

As far as languages are concerned, there is no restriction. I am
planning on using C.

In that case a good C compiler will take care of most of the low level
8051 stuff for you.

I disagree! A C compiler will just mask the nonsense underneath. It
*will* come back to bite you (think "stack").

Ok, I'm not an 8051 guy, so I'll take your word there is a potential
issue here.

I looked into various compilers when I did a major (~25kloc) 8051
project a decade ago. The only one that didn't mask the
limitations (and even advantages) of of the 8051 was PL/M51.

I'd then suggst you take a look at some more modern compilers perhaps.
Countless people use C on the 8051, I'm sure it's not that bad.

The point is that one is *necessarily* doing bit-banging on the
hardware (the whole point of a uC). C doesn't give much advantage
and a _lot_ of headaches.

*snip*

I see no advantage in using C. Portability isn't an issue since
hardware is the name of the game with uCs. Any abstraction will
lead to resource conflicts. No, actually, I haven't been bitten by
stack issues because I've used assembler. I don't let the compiler
assign *anything*; not even what byte the bits go in.

*snip*

I disagree. C has no advantage over a half-decent macro assembler
and a MAKE utility. Abstraction has a *lot* of disadvantages when
you're severely hardware constrained. Sure, people use C on 8051s,
but I suspect for many C is the only tool in their shed.

Ok, it looks like this one could never end.
You are pro-assmebler, I'm pro-C.
I used to do all my work in assembler unless I started using C and then
never looked back. I still do some inline assembler where it's called
for, but that's it.

There are *massive* advanatges to using C (or another high level
language) on a micro - speed of development, platform portability
(which is a BIG requirement for some people), ease of peer review, ease
of maintenance, easier code-reuse, easier model migration, better code
visibility to name a few. This is why C compilers are immensely popular
these days.

Yes, there are advantages to assembler as well (and disadvantages to
C), that's why I like many others use the best of both worlds. Making a
blanket statement like there are *no* advantages to using C is just
plain rubbish.

Dave :)

.



Relevant Pages

  • Re: What micros do you actually hate to work with?
    ... with less than tiny asm ... hassle to work with 32 bit longs in assembler for an 8 bit uP, ... Microchip's C compiler tools and their assembly under MPLAB. ... is that other programmers for C are easier to find. ...
    (comp.arch.embedded)
  • Re: The Promise of Forth
    ... Declare variables, declare locals, let the compiler do the work ... Forth could be considered the assembler for a simplified virtual ... If you use locals then you have to initialise them each time. ... there are likely to be libraries that could be profitably used within ...
    (comp.lang.forth)
  • The never ending assembly vs. HLL war
    ... > branch instruction excluded is not particularly effective optimization. ... > CPU, chances are pretty good it *won't* be optimal on a different CPU. ... > discussing the futility of optimizing it in *assembler* when the ... careful and consider the code the compiler is emitting (and adjust your ...
    (comp.lang.asm.x86)
  • Re: the quality of assembly language code
    ... Intel's compiler is supposed to ... I have found that I prefer 'C' and assembler roughly in inverse ... >> code than human beings writing raw assembly language. ... > assembly programmers and compilers. ...
    (comp.lang.asm.x86)
  • Re: Microcontroller Project
    ... A C compiler will just mask the nonsense underneath. ... A heck of a lot of poeple will use C on micros because it provides many ... I still do some inline assembler where it's called ... Thousands of embedded engineers who use C almost exclusively will tell ...
    (sci.electronics.design)