Fundamental C question about "if" statements

Back when I wrote software for boards that other people designed, I was absolutely positively anti-PIC.

Then, a few projects came up where I needed to design the whole board, and I started looking at things like flexibility of peripherals, current drive capability, and delivery history.

Then, I became moderately PIC-tolerant.

But I still like Cortex-M0 parts better.

--
www.wescottdesign.com
Reply to
Tim Wescott
Loading thread data ...

Yes.

The PIC24 is a completely new-from-scratch core that has nothing whatsoever do with the PIC18.

Microchip has free compilers for all of their parts. The PIC24 compiler is based on gcc.

Reply to
John Temples

I've seen a lot of monumentally stupid design decisions embodied in various products -- so just because something gets used someplace, that doesn't mean it's the best. And just because it was the best yesterday, that doesn't mean it's the best today.

Having said that, the PIC18 isn't _bad_ -- it's just not the best for lots of applications, and now that the Cortex M0 parts are getting cheap, it's best for less and less as time goes on.

--
www.wescottdesign.com
Reply to
Tim Wescott

There are some Cortex-M0 parts showing up in PDIP, and there are Cortex-M0 parts with USB. I don't know if the two sets intersect, however.

With the exception of packages that have pads underneath (damn, what's the name?), hand-soldering surface-mount assemblies just takes a steady hand and a decent microscope. And, I suspect one could make a good- enough microscope with the right web-cam and a 'puter. So I don't see why surface-mount and hobbyist should be mutually exclusive.

--
www.wescottdesign.com
Reply to
Tim Wescott

dp/0131103628

But it is a point -- who IS the Egyptian god of computing?

--
www.wescottdesign.com
Reply to
Tim Wescott

On 20/09/2015 7:29 PM, Tim Wescott wrote: > >>> This is spelled out very well in "C, A Reference Manual" by >>> Harbison and Steele. There are other books out there (K & R >>> comes to mind), and Harbison and Steele may not even be the best >>> -- but I find that Harbison and Steele is a very good book for my >>> purposes. >> >> I am looking at the C standards here (C11, document N1570). >>

A few posts ago you mentioned "C, A Reference Manual" by Harbison and Steele. This is a very good "readable" reference on C that has been periodically updated. The authors are remarkably approachable and the book is high on my short list of essential references.

w..

Reply to
Walter Banks

Interesting; thanks.

Yes, it has a new instruction set, etc, but it was advertised by Microchip as effectively an extension of the PIC18.

The PIC24 gcc port is not part of mainline gcc/binutils; you are stuck with the one-off port done by Microchip. With the PIC32 however, I am using the generic MIPS gcc/binutils toolchain which I obtained from the MIPS website and which works just fine with the PIC32MX.

You still have to create the PIC32 headers, linker scripts and startup code but that's not a major exercise if you know what you are doing.

BTW, Microchip have traditionally been very hostile to open source in that they are willing to take from the community but are willing to only give back the bare minimum that they are required to by the GPL so the above was true for the PIC24 as well the last time I checked.

It's an attitude I don't understand BTW. If Microchip behaved more like Atmel (for example), they would have a much more positive image.

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP 
Microsoft: Bringing you 1980s technology to a 21st century world
Reply to
Simon Clubley

They don't unfortunately. It's something I keep a lookout for and I have yet to come across such parts.

For some hobbyists (especially when you are doing high-end stuff) they are not exclusive, but being able to breadboard a circuit makes the cost of experimenting _very_ low (or even zero) and you don't have to pay for, and wait for, the latest version of your PCB to be delivered through the post.

And when you are ready to make your final circuit permanent, it's easy enough to do so yourself without needing chemicals in the house.

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP 
Microsoft: Bringing you 1980s technology to a 21st century world
Reply to
Simon Clubley

For prototyping and low quantity stuff you could possibly use a breakout board, e.g.:

formatting link

Reply to
Paul Rubin

I know of only two dip ARM chips: lpc810 (dip8, Cortex-M0+) and lpc1114 (dip28, cortex-M0).

The lpc810 used to be priced nice (< $1 IIRC), but recenty they are priced much higher (~ $3). Anyobe know why??

Wouter

Reply to
Wouter van Ooijen

Only hobbyists buy them?

--

John Devereux
Reply to
John Devereux

My cynical genius is whispering that it's because they've gotten some design wins and now they want to cash in...

--

Tim Wescott 
Wescott Design Services 
http://www.wescottdesign.com
Reply to
Tim Wescott

Umm ... modern medical students ARE taught about blood letting and other things. Leeches are used routinely after certain types of surgery to control swelling, and maggots are used to remove dying and dead tissue from wounds, which helps them heal.

And you have the wrong gods: modern doctors pray to themselves.

George

Reply to
George Neuner

And being engineers we of course take all advertising statements 100% exactly at face value. Sure. No doubt about that. None at all. Yeah, right.

Reply to
Hans-Bernhard Bröker

I'm glad that there are others out there that share my enthusiasm for the book. It's been a while since I've just read it cover-to-cover, but it does an excellent job both as the reference manual it claims to be (99% of my usage of it these days starts with the index) and as a text that can be read from page 1 on to the end.

--
www.wescottdesign.com
Reply to
Tim Wescott

I don't know that one - but some candidates could be:

Am-heh ? A dangerous underworld god Apep ? A serpent deity who personified malevolent chaos Heka ? Personification of magic

(I justify including Heka on the list from what customers expect of us.)

When I develop my own programming language to be the perfect replacement for C and all it's quirks, I shall call it Apep.

If one were looking for interesting problems to practice writing C code (though not for embedded systems), I'm sure ancient Egyptian fractions could inspire some good challenges:

Reply to
David Brown

Yes, I happen to know that. I am addicted to science and history magazines - collecting (hopefully!) useless knowledge is a hobby. However, medical students are not taught that blood letting is the cure for /everything/, as medieval European doctors seemed to think.

:-)

Reply to
David Brown

Being mere engineers, we don't get to make all of the decisions - some decisions are made by people who /do/ believe all the advertising.

And being human (or at least roughly humanoid), we still judge things based on names, adverts and rough first impressions. My line of thinking on first hearing of the PIC24 was: The PIC16 is a crap 8-bit cpu advertised as a 14-bit cpu. The PIC18 is a slightly less crap 8-bit cpu advertised as a 16-bit cpu. So the PIC24 will be a less crap 8-bit cpu advertised as 16-bit, or 24-bit, or whatever - because Microchip doesn't know how cpu "bitness" works.

And when the PIC32 came out, I knew it had a MIPS core - but because they had called it a PIC, I assumed they had found a way to make it as bad a cpu as the other PIC families. And I was right - by using sub-optimal MIPS core (MIPS has many cores that would be far better in a microcontroller family), combined with a full-scale effort to cripple the compiler and make the MIPS core run as fast as a traditional PIC, they did manage to make a bad device. And I gather that the key selling point of the PIC32 - 480 Mbps USB - /still/ doesn't work reliably.

To my mind, the terrible shame of all this is that MIPS makes cores that are highly competitive in power, speed, and die area to ARM's cores - and the embedded world would be far better off if there was a selection of MIPS-based microcontrollers competing with ARM ones. But people assume MIPS must be useless processors since they are in PIC's.

(Note - I make a lot of use of Microchips memory devices, analogue parts, communication devices, and other bits and pieces. It's just their microcontrollers I don't like.)

Reply to
David Brown

There are endless numbers of ready-made boards available with Cortex devices of all sorts, including USB, Ethernet, and whatever, that sit on DIP-40 sized boards or have similar hobby and prototype friendly layouts and connectors. If someone thinks they can't use a Cortex because it doesn't come in DIP and they can't solder surface mount, they have no imagination. Get a simple eval board from TI or Freescale or whoever, and use that as your base.

Reply to
David Brown

I said nothing about not being able to use Cortex parts - using eval boards for the larger MCUs is exactly what I do.

It's just that for the projects with low resource requirements, I prefer to build my own circuits if possible.

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP 
Microsoft: Bringing you 1980s technology to a 21st century world
Reply to
Simon Clubley

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.