Abstract Dissonance wrote:
> Which is better to program in, in general, for Microchip's pics; C or
> Assembly? I am personally more fond of assembly but after trying a little
> using microchips "31 instructions" its a bit daunting. I really don't want
> to waste my time extending the instruction set just cause they want to hype
> it up with making it small as possible. Not sure why the stopped at 31...
> "Only 5 easy instructions to learn!!!".
>
> Are there any drawbacks to using C(besides bloating?)?
>
> While I don't mind using assembly I know that I will just end up making many
> macros to do what I want and it will basicaly end up as more of a HLL
> anyways so I probably should just go with C from the start. I'm mainly used
> to Masm syntax and semantics anyways and Microchip's synatic can be strange
> at times(and annoying when you only have one register to work with(I mean
> "W").
>
> From glancing at some C code it seems much easier to do things like setting
> "File Registers" and such(I definately hate the INDR method for working with
> "pointers") but I should be able to accomplish that with a macro(assuming
> they have good macro functionality which I haven't checked out yet).
>
>
>
> Thanks,
> Jon
C is
- *much* easier and quicker to write
- easier to debug
- easier to port to another micro entirely
- and damn near essential for anything moderately complex (like
floating point math) or when you get above a few hundred lines of code
for instance.
I use the HiTech C compiler, they have a free version available for
several PICs. I've also heard the Microchip 18 series C compiler is now
essentially free.
You'll no doubt get assembler freaks trying to tell you why C is crap
and assembler is king, but the facts are that hgih level languages like
C win hands down these days.
Yes, C adds a bit of overhead, but not much. In fact, poorly written
assmbler can actually use more code and/or be slower than it's C
equivalent. If you need every last byte in a micro then you probably
should be using a bigger one anyway. (e.g what if you want to add
features in the future)
If you want speed, almost all C compilers will support in-line
assembler as well for those bits that need it.
Most real commercial work these days is done in C because it's much
easier to maintain, review, and get someone else to debug later when
the original programmer is not around any more.
Dave