Log in

View Full Version : PIC controllers and c++???


K0r34nB0y
07-04-2004, 17:48
Look at this (http://www.picant.com/c2cpp/cpp.html)
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?

Ryan M.
07-04-2004, 18:09
Look at this (http://www.picant.com/c2cpp/cpp.html)
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. :) Great find.

K0r34nB0y
07-04-2004, 18:22
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?

dez250
07-04-2004, 18:25
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 (http://sourceforge.net/projects/ifi-picloader/).

Astronouth7303
07-04-2004, 21:26
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?

Kamikaze
07-04-2004, 22:12
and i also was told that MPLAB runs in Linux.

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.

Marc P.
12-04-2004, 14:05
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 :D

jdong
24-04-2004, 15:10
C++ would be much less efficient on such a controller though.

Astronouth7303
24-04-2004, 20:57
Yes, it's called OOP overhaed. And it really sucks for this sort of thing.

Ryan M.
25-04-2004, 07:31
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.

jdong
25-04-2004, 10:05
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.

Tom Bottiglieri
25-04-2004, 10:38
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++?

fred
25-04-2004, 14:57
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.

Max Lobovsky
25-04-2004, 23:16
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.

Astronouth7303
26-04-2004, 07:34
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++?
3 words: Object Oriented Programming.

Ryan M.
26-04-2004, 08:34
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++?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

Astronouth7303
26-04-2004, 11:40
Polymorphism and Templates also cover Interfaces and Sub- & Super-classes.