Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 07, 2016, 03:22:08 15:22


Login with username, password and session length


Pages: [1]
Print
Author Topic: Noob question: C++ compilers for PIC, are there any and do I need one?  (Read 4786 times)
0 Members and 1 Guest are viewing this topic.
LithiumOverdosE
V.I.P
Senior Member
*****
Offline Offline

Posts: 289

Thank You
-Given: 246
-Receive: 396


« on: August 02, 2008, 02:12:34 02:12 »

I'm just starting to read the literature related to embedded programming and I was wondering is there any C++ compiler for PIC worth looking at. I mean I was educated as a C++ programmer for PC and I got comfortable using objects. I'm getting very aware of the fact that in embedded programming I have much less memory space available and I have to look out for many details that were automated using various classes on PC.

So my question is are there any worthy C++ compilers for PIC and do I really need one?


TIA  LOE
Logged
mbandala
Senior Member
****
Offline Offline

Posts: 271

Thank You
-Given: 123
-Receive: 304



« Reply #1 on: August 02, 2008, 02:09:15 14:09 »

As far as I am aware, there isn't a commercial C++ compiler for the PIC microcontroller. There is a free C++ compiler in development though. Try the link below. I have never tried it and personally don't think it is worthy...

http://softwarepic.50webs.com/freesoft.html

Remember that the PIC is mainly used to control things, like a basic programmable logic controller (search for PLC in Wikipedia). Generally speaking, PICs can do more complex things than many PLCs but there is limitations. The available C compilers just make life easier with complex programs. You can always use assembler for simple stuff like moving 8-bit data between registers and perform basic logic/arithmetic operations. If you need object oriented programming it means you are focused on writing programs that are more readable and maintainable. This is more like PC programming. If you want to develop embedded systems with this kind of functionality, better use ARM of FPGA hardware.

In other words, you can do whatever is possible to do with PICs by using a C compiler. Just have a look at my thread below and you can find plenty of books related to PIC C programming.

http://www.sonsivri.com/forum/index.php?topic=13538.msg58300#msg58300
« Last Edit: August 02, 2008, 02:13:04 14:13 by mbandala » Logged

Feel free to press "thank you" if you think you have found something useful! -^
LithiumOverdosE
V.I.P
Senior Member
*****
Offline Offline

Posts: 289

Thank You
-Given: 246
-Receive: 396


« Reply #2 on: August 02, 2008, 04:07:08 16:07 »

@mbandala

Thx for clarifying things a bit. I must admit that I underestimated embedded programming complexity. When one get used to all of the available classes and automation on PC it's a bit hard to get used to all the microcontroller limitations. Although I have experience with avionics, navigational and radar systems I'm still struggling to get grasp of all the possibilities of just a simple fuse configuration on microcontroller.

I considered several microcontroller to start with those novel concepts but so far PIC proved to have a largest base of books and source codes available not to mention easy availability and a great selection of hardware. I considered switching to ARM if and when need arises but for the moment I want to understand basic concepts on simpler devices.
 
A friend told me that SourceBoost C++ compiler is available http://www.sourceboost.com/Products/BoostCpp/Overview.html but to be honest the more I understand memory constraints and limitations the more I'm inclined to use C. I weighed on whether to go straight to the ANSI C compiler or to use the ones with more available libraries so for now I'm testing CCS and MikroC. While MikroC has extensive library collection, CCS seems to be more understandable to me (don't really know why).

Thx for the links with the books you uploaded but I already downloaded from it and read some of useful stuff. That was a great collection so thx for it. Wink
Logged
mabd
Junior Member
**
Offline Offline

Posts: 71

Thank You
-Given: 13
-Receive: 16


« Reply #3 on: August 03, 2008, 05:28:33 05:28 »

may be, there is one called OOPic. In one of those master classes
they described how OOPic was ued in some NASA projects!!!!
« Last Edit: August 03, 2008, 05:30:27 05:30 by mabd » Logged
cjeffries1
Senior Member
****
Offline Offline

Posts: 323

Thank You
-Given: 218
-Receive: 160


« Reply #4 on: August 03, 2008, 05:04:21 17:04 »

Isn't C++ an extension of the C language? So in a sense all the current C compilers are the same as any C++ compilers without any of the C++ extensions (that probably wouldn't be required in any case?). Just a thought.
Logged
mbandala
Senior Member
****
Offline Offline

Posts: 271

Thank You
-Given: 123
-Receive: 304



« Reply #5 on: August 04, 2008, 02:13:31 02:13 »

Isn't C++ an extension of the C language? So in a sense all the current C compilers are the same as any C++ compilers without any of the C++ extensions (that probably wouldn't be required in any case?). Just a thought.
No, they are not the same. At least no such thing as object oriented programing is possible in all the PIC C languages available (HI-TECH, CSS, MikroC, FED, C18, C30, C32, etc.)
Logged

Feel free to press "thank you" if you think you have found something useful! -^
LithiumOverdosE
V.I.P
Senior Member
*****
Offline Offline

Posts: 289

Thank You
-Given: 246
-Receive: 396


« Reply #6 on: August 05, 2008, 02:21:16 02:21 »

Well it would certainly be great to have classes supported for easier code recycling and cleaner code when repeating several common actions. When I get to know PIC C programming a bit better I might try some PIC C++ compiler (like Sourceboost C++) and compare code size and speed of execution when using classes in comparison with classic ANSI C. I wonder if C compilers for PIC support "struct"- although they're not the same thing as classes they do share some of the common traits.
Logged
preatorian
Junior Member
**
Offline Offline

Posts: 44

Thank You
-Given: 16
-Receive: 18


« Reply #7 on: March 06, 2009, 01:19:07 13:19 »

Hi all,
against most opinions here I must say: There is a C++ PIC compiler. Just google for "C++ Pic C" and you will find a software called SourceBoost.

Regards
Logged
sam_des
Active Member
***
Offline Offline

Posts: 221

Thank You
-Given: 47
-Receive: 111


« Reply #8 on: March 07, 2009, 06:20:30 18:20 »

Hi,

Quote
I'm just starting to read the literature related to embedded programming and I was wondering is there any C++ compiler for PIC worth looking at. I mean I was educated as a C++ programmer for PC and I got comfortable using objects. I'm getting very aware of the fact that in embedded programming I have much less memory space available and I have to look out for many details that were automated using various classes on PC.

So my question is are there any worthy C++ compilers for PIC and do I really need one?

It all depends on what you want to do with your microcontroller. Personally I will never dare to use c++ in any of my projects. Here are the reasons to avoid c++ ...
1) It makes code too much slow. This is of supreme importance for any software. It's lost art in today's "faster micro will take care of sluggish code". Most embedded systems have hard time-lines to achieve and every single cycle has to be utilized.
2) Increases code(ROM) size very rapidally.
3) Uses/asks too much RAM.
4) Does many things behind my back which may be needed by (careless Wink) PC programmer, but not in commercial world of embedded systems. Your system must function correctly with least or no human intervention. Even in case of fault, must do everything as gracefully as possible. So you must write the code & debug it with utmost care.
5) Embedded systems rarely have same requirements & configuration. Reusing code by means of classes, inheritance simply simply bloats the code. Your final code will carry unnecessay baggage which means you might need a micro with bigger memory or you have very small empty space which makes enhancements/addition of new features very difficult.

List can go on & on...

If you want to check how c++ affects your code, use AVR & IAR's EWAVR compiler which supports EC++. Write your code first in C then in C++. Just see the results. That will tell you why c++ haven't made it big in embedded world. This is true even for higher end processors like ARM.

I might add that I prefer assembly over C (even for PC programming). Though it takes more time to write & maintain(if written by someone else or badly commented), end result always makes you proud.

Just my opnion Tongue

regards,
sam_des
Logged

Never be afraid to do something new. Remember Amateurs built the Ark, Professionals built the Titanic !
solarwind
Newbie
*
Offline Offline

Posts: 32

Thank You
-Given: 4
-Receive: 1


« Reply #9 on: March 07, 2009, 10:37:15 22:37 »

No. You do not need a C++ compiler for a PIC. They exist, but you do not need one. C is the best language for PIC micros. I recommend Microchip, CCS and HI-TECH compilers. They are the best.
Logged
oldvan
V.I.P
Senior Member
*****
Offline Offline

Posts: 375

Thank You
-Given: 152
-Receive: 106


If the van is a Rockin'...


WWW
« Reply #10 on: March 20, 2009, 03:06:09 15:06 »

I wonder if C compilers for PIC support "struct"...

I can say from personal experience that HI-TECH C PRO for the PIC18 does, I'm using them in my current project.
Logged

Give a man a fish and you feed him for a day.
Teach a man to fish and he will sit around in a boat drinking beer all day.
chyun3
Junior Member
**
Offline Offline

Posts: 64

Thank You
-Given: 24
-Receive: 5


« Reply #11 on: April 23, 2009, 03:56:57 03:56 »

Hi,

IAR PIC compiler support C++ language...maybe you can refer to the link below:

http://www.iar.com/website1/1.0.1.0/214/1/
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC