Fundamental C question about "if" statements

Figured it was something like that... just didn't see it in the datasheet I had in the heat of the moment. Looking again I see something called DebugWIRE that looks to be a 1-pin interface to control code execution and overwrite code, that's interesting.

1 pin is better than 3 and it's on the reset pin so don't have to share it with other stuff.

Thanks for the clarification... saw gcc credits in the docs but looks like it's just the preprocessor that was used, compiler itself is totally different.

Thanks for writing that up, very informative.

Yes it does seem like gcc is much nicer! I use gcc all the time to compile Linux apps, but not being much of a C programmer it's hard to spot the differences. I treat C like BASIC... if then else for while until math and logic and stay away from pointers like the plague. My uC apps almost never use interrupts other than simple stuff like wake from sleep when a button is pressed. But that's just me, I'm an old-school hardware guy, not a software guy - I like 100% deterministic behavior with no unknown variables that might bite me later. Using C is scary enough as it is... I still wade through the assembly listing to make sure it does what I think I told it to do.

Probably time to bow out on this thread and get back to other stuff but here's my takeaway...

C on an AVR is looks to be much more efficient than on a PIC, so if I need to code a big/fast app, AVR is probably better.

Cortex/ARM (esp M0) looks to be the future, huge selection and cheap. Really need to learn that stuff.

For simple stuff that just needs to work, just use what's already on the workbench and go with what ya know. But probably not wise to use that as an excuse to avoid "new" things...

Cheers, Terry

Reply to
Terry Newton
Loading thread data ...

In addition, don't forget that little lack of peripheral specific vectored interrupts on the PIC18 and that whole having to read down the various status registers to find out which peripheral needs attention.

Actually Terry might be wrong about the SDCC origins, but he's absolutely right about the Microchip headers in the SDCC kits; they do have language about how you can only use them with Microchip devices. (Or at least they did with the SDCC versions from several years ago; I havn't checked the current SDCC versions to see what the current situation is.)

The same also applies to Microchip's public source code in general BTW. Not really a problem when it's only the 8-bit PICs, but it's a real problem with the PIC32; you can't use Microchip's public code (or at least the code I looked at) on other MIPS devices.

I know you tend to dismiss them but don't underestimate the advantages of PDIP in some areas; you can walk into the Farnell trade counter and buy various PDIP devices over the counter while you wait. These things would not be stock inventory unless there was still a viable commercial demand for them.

5V tolerant I/O is still a potentially important issue however.

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

I've done both at bare metal level although my ARM bare metal experience is currently more the traditional ARM architectures.

The AVR is easier to get started with (and I especially like the interrupt on any I/O level change option (regardless of direction), which is something a number of ARM MCUs do not offer).

The ARMs are more powerful however and the internal architecture reflects that. Once you have learnt one core the knowledge tends to transfer to other cores however. The major downside for ARM however are the manufacturer specific peripheral interfaces which isn't an issue for AVR given it's single manufacturer status.

The ARMs also come into their own when you need to start manipulating data in units of greater than 8 bits.

BTW, I actually like the ARM ISA; it comes across as (reasonably) elegant to me as does the AVR's.

I also think the people you have talked to are right in some circumstances; the AVR does offer things at I/O level that some traditional ARM MCUs do not. I get the feeling that this is getting addressed in the Cortex M series however; how successfully I can't honestly give you a truthful answer yet.

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

I'd forgotten about that (or perhaps repressed it...).

Sorry, I was referring to the compiler here. I didn't mean to say or imply anything about the Microchip headers. I haven't looked at the licenses for them, but I have no reason to doubt you.

These stores cater mainly for hobby users and very small professional use, so the bias as to which parts are popular is very skewed. And I remain convinced that in many cases where someone is looking for a DIP part, they would be more successful in using a ready-made PCB with a non-DIP part combined with essential components (such as oscillator, a few caps, etc.) in a prototype-friendly format.

True - I have had plenty of projects where it would be nice for the 3.3V microcontroller to have 5V tolerant inputs, and outputs that have high enough voltage guarantees to be safely usable to drive devices that expect 5V logic levels. I was stating a fact here, rather than suggesting it is a good thing.

Reply to
David Brown

Yea, I was wrong about that. Only the preprocessor is derived from (I presume an old version of) gcc.

Terry

Reply to
Terry Newton

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.