PIC controllers and c++???

Look at this
I won’t even pretend to know what I’m talking about here but wouldn’t this compile the same and make it possible to program a robot in c++? Opinions?

It would be great if it works. It should, but that requires actual testing of some programs. :slight_smile: Great find.

I was lookin through, and it looks like it only supports PIC12’s and PIC16’s. I think the RC is a PIC18 so I’m not sure if it works. Anyone know for sure?

i just checked out the specs for that program, it shows support for the PIC 12 and 16 series only as of now. I know we use the PIC 18F8520 unit. Though i do have a linux PIC Loader that was designed for the IFI FRC, and i also was told that MPLAB runs in Linux. Heres the Linux IFI PIC-Loader.

Full OOP on an integrated processor? Cool.
I’m not sure if it’s really practical or just the engineer impulse. :cool:

But what’s the diference between the procs?

Running MPLAB on Linux is problematic. Wine seems to be okay with the installer up to the point where it checks to see if Internet Explorer is installed. Since Internet Explorer isn’t native to *nix and wine doesn’t like it, wine doesn’t work with MPLAB.

The other option is using a virtual machine like VMWare (currently setting this up), Xen or whatever.

Actually, MPLAB IDE does not run under linux via WINE. However, the compiler itself and the linker (c:\mcc18\bin\mcc18.exe) do run perfectly under WINE! I’m using Quanta as the main development suite, and created buttons mapped to scripts to compile and link all files. I’ve even mapped a button to the linux loader Mike posted above in Quanta, so all development and downloading capability is in one application, rather than having to launch the IFI loader after compiling.

I haven’t been able to test yet (since robot is in crate on way to Atlanta), but I’m assured by the documemtation on the sourceforge site that it’s operable, and am happy at the prospect of the ability to program under linux :smiley:

C++ would be much less efficient on such a controller though.

Yes, it’s called OOP overhaed. And it really sucks for this sort of thing.

It isn’t necesarilaly less efficient. It depends on the compiler. Plus, if you don’t use things like runtime polymorphism, you basically have C with classes. And the classes get reduced to hex code that does pretty much the same as equilivant C code.

C++ encourages using classes, which in turn encourages use of functions… All I’m saying is that a school-taught C++ programmer would want to encapsulate everything in classes and functions, which adds significant overhead on our little controller…

On the other hand, inline functions are a great feature of C++, would enhance performance.

I have never actually used C++ in too much detail, but I do know a little about it. Could someone give me a run down on whats different between C and C++?

I am not positive of all the differences since this was my first year using either language for like, 3 years. I talked to a guy from FIRST and he said that they had really looked at using C++, but they decided that using C would be easier for the students in the long run and that C++ was as good for doing the task that we do in FIRST. i.e. programming robots.

I too do not pretend to know what im saying, but i do know that, at least in the early days, C++ compilers would actually convert the C++ code entirely into C code and then use an already existing C compiler to compile that. The point is that it is entirely possible, and i think likely, that you could find or at least modify a compiler to do this for you.

3 words: Object Oriented Programming.

The main feature differences are these:

  1. Classes - like structs from C
  2. Polymorphism (runtime and compile) - Basically this is the ability to have muptiple functions with the same name
  3. Templates - generic classes
  4. Exceptions - error handling mechanism

Polymorphism and Templates also cover Interfaces and Sub- & Super-classes.