[chbot] C vs C++ and embedded

Mikael Stewart mikael.stewart at gmail.com
Wed Dec 31 00:35:01 GMT 2008


Until recently I was very much hooked on Atmels AVR series microcontrollers and using WinAVR (Package containing GNU-GCC C compiler, Programmers Notepad IDE and documentation), and also a linux port of GNU-GCC while under UBUNTU/Debian. I liked the idea of not having to spend a ridiculous amount of money on hardware programmers or software - I was a student at the time! There is also a strong support base for AVR stuff on the 'net with lots of sample code around and since I'm the type that learns by example and not by long winded literature, this was very important to me.

Just recently I've switched to Microchip dsPIC 30F and 33F range of microcontrollers for my projects. The development tools might cost more but there are some major hardware advantages that suit my applications. I generally use the Microchip C30 C compiler as it is so well optimized but will still use inline assembly for certain things e.g. a bit-banged proprietary 2-wire comms routine because I cringe at the thought of how using C might slow this down! As they say, engineering is an art of compromise...

For the record, I only ever used assembly language when messing around with the 68hc11 microcontroller some 6-7 years ago. I'm still getting used to the dsPIC architecture but will probably be coding a bit more assembly in the future. Also, I've never touched C++ for microcontroller programming.. I can think of a few cases where it would be handy, but C structures, unions and bitfields are usually good enough for what I do...

Cheers,
Mikael


  ----- Original Message ----- 
  From: Chris Hellyar 
  To: Christchurch Robotics 
  Sent: Wednesday, December 31, 2008 11:16 AM
  Subject: Re: [chbot] C vs C++ and embedded


  That makes interesting reading, coming from someone who has avoided OOP programming for ages, and only just got dragged in, kicking and screaming in the last year or so.

  I'm a die-hard assembly fan for embedded stuff, which probably makes me a dinosaur.  I suspect if it was still a part of my income I'd have switched to C long ago though.  I find it's the thrill of the chase with assembly which makes it interesting, but it also means it takes 5x as long to get the same result. :-).

  Case in point would be my current modbus project.  There are some good open source C code bases for modbus RTU on various platforms, but I'm coding from scratch in assembler for PIC 'cause I can'.  200+ hours of work and it's working well with a bunch of standard test tools, but in C I think it would have been more like 30 hours work.

  Which leads me to a straw-poll question...  What are people using as their tool set of choice for robots/gadgets?  What processor/language?  I'm 1 vote for PIC/asm. :-)



  Cheers, Me.


  On Wed, 2008-12-31 at 09:56 +1300, Richard Jones wrote: 
After the last meeting Paul was discussing with me the merits of using 'C'
structures and C vs C++. This article might prove interesting to anyone
interested in the tradeoffs between C and C++ for embedded applications
like robotics: http://www.embedded.com/98/9802fe3.htm

Richard


_______________________________________________
Chchrobotics mailing list, web site: http://kiwibots.org
Chchrobotics at lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/chchrobotics



------------------------------------------------------------------------------


  _______________________________________________
  Chchrobotics mailing list, web site: http://kiwibots.org
  Chchrobotics at lists.linuxnut.co.nz
  http://lists.ourshack.com/mailman/listinfo/chchrobotics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ourshack.com/pipermail/chchrobotics/attachments/20081231/6b00c271/attachment.htm 


More information about the Chchrobotics mailing list