Electronics Forums

Electronics Forums > Newsgroups > Electronics Newsgroups > Electronic Basics > C or Assembly

Reply
Thread Tools Display Modes

C or Assembly

 
 
Abstract Dissonance
Guest
Posts: n/a
 
      03-02-2006, 10:50 PM
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


 
Reply With Quote
 
 
 
 
Stef Mientki
Guest
Posts: n/a
 
      03-02-2006, 11:14 PM
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
>
>

take a look at JAL,
and beware there will be a new version within short time,
with many more great features.

Stef Mientki
 
Reply With Quote
 
 
 
 
John Fields
Guest
Posts: n/a
 
      03-02-2006, 11:21 PM
On Thu, 2 Mar 2006 16:50:51 -0600, "Abstract Dissonance"
<Abstract.Dissonance.hotmail.com> 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).


---
_Real_ men program in assembler!


--
John Fields
Professional Circuit Designer
 
Reply With Quote
 
Stef Mientki
Guest
Posts: n/a
 
      03-02-2006, 11:30 PM
John Fields wrote:
> On Thu, 2 Mar 2006 16:50:51 -0600, "Abstract Dissonance"
> <Abstract.Dissonance.hotmail.com> 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).

>
>
> ---
> _Real_ men program in assembler!

then I'm probably be a woman,
but at least I get results (fast) !!
Stef
 
Reply With Quote
 
Abstract Dissonance
Guest
Posts: n/a
 
      03-02-2006, 11:46 PM

"John Fields" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Thu, 2 Mar 2006 16:50:51 -0600, "Abstract Dissonance"
> <Abstract.Dissonance.hotmail.com> 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).

>
> ---
> _Real_ men program in assembler!
>
>


Are these the same men with no GF's/Wifes?

> --
> John Fields
> Professional Circuit Designer



 
Reply With Quote
 
Abstract Dissonance
Guest
Posts: n/a
 
      03-02-2006, 11:47 PM

"Stef Mientki" <S.Mientki-(E-Mail Removed)> wrote in message
news:72eda$44077c3e$83aef479$(E-Mail Removed) ...
> 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

> take a look at JAL,
> and beware there will be a new version within short time,
> with many more great features.
>


Ok, I'll check it out. What would be nice is a masm like port!!! Then I'd
be in heaven.

> Stef Mientki


Thanks,
Jon


 
Reply With Quote
 
John Fields
Guest
Posts: n/a
 
      03-03-2006, 12:08 AM
On Thu, 2 Mar 2006 17:46:20 -0600, "Abstract Dissonance"
<Abstract.Dissonance.hotmail.com> wrote:

>
>"John Fields" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed).. .


>> _Real_ men program in assembler!
>>
>>

>
>Are these the same men with no GF's/Wifes?


---
Nope, I've got one...

--
John Fields
Professional Circuit Designer
 
Reply With Quote
 
John Jardine.
Guest
Posts: n/a
 
      03-03-2006, 12:41 AM

"Abstract Dissonance" <Abstract.Dissonance.hotmail.com> wrote in message
news:(E-Mail Removed)...
> 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
>

Although loathing C, I will shyly admit the (very) occasional use of a
primitive language called 'Basic'. In general though, would say they're all
much of a muchness and pretty marginal as to whether -any- of 'em can offer
a decided benefit over assembler when used in Pics.
Sure, it's nice to type a=sqrt(2*pi) and see some prewritten 32 bit maths
routines pulled in. Or magic up a block of code for an I2C link from just a
couple of lines of text, or even on command, load in a complete FAT32 setup.
But we lose track of what the micro"controller" is there for in the first
place. It's supposed to be a dirt cheap, fast, one stop shop, that can be
programmed to handle all the messy real-world stuff, like ADCs, DACs, logic,
transducers, etc, etc. Y'know ... stuff that the compiler writers have never
even heard of and certainly haven't written any predigested routines to
suit.
Maybe some serious PIC work will come along, then despite all the compiler
fluff on offer, you'll find that virtually all your hardware still needs
tedious hand coding in assembler, added disadvantage then of having to also
keep an eye out for what the compiler might be up to.
It's a toss up as to benefit. But it's for sure, that without machine code
familiarity, you'll be forever a cash cow for the compiler writers.
john






 
Reply With Quote
 
Bob Myers
Guest
Posts: n/a
 
      03-03-2006, 12:52 AM

"John Fields" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> _Real_ men program in assembler!


Hell, no! REAL men program directly in machine code, and
compile C++ on sight. By Gawd, when *I* started programming,
all we HAD were 1s and 0s, and half the time they were late
getting us the 1s....one long cold winter, when young Abe Lincoln,
Tom Edison, Tom Swift and I were programming by firelight, we
ran out of 0s and had to use the capital letter "O." Why, once,
while on vacation in Bora Bora (from my job in the Department
of Redundancy Department), I emulated a PDP-11 using pebbles
collected from sea and placed into depressions in the sand to
take the place of the registers...and then got burns on my hands
from the friction, while trying to up the clock rate...

I tell ya....kids today...no idea how good they've got it....

Bob M.


 
Reply With Quote
 
David L. Jones
Guest
Posts: n/a
 
      03-03-2006, 04:33 AM
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
-Low Cost High quality pcb prototype and Assembly manufacturer(CHINA) rtt55t_y@126.com Electronic Basics 3 05-05-2006 02:39 PM
--Low Cost High quality pcb prototype and Assembly manufacturer(CHINA) rtt55t_y@126.com Electronic Basics 1 05-02-2006 06:55 PM
PCB assembly advice pokchi General Electronics 1 02-09-2004 06:00 PM
Uses for CD-ROM laser/optical assembly David Electronic Basics 2 02-06-2004 02:42 PM
Surface Mount Assembly Training courses - worth taking? Newbie@nomail.com Electronic Basics 12 10-19-2003 10:56 PM