C for embedded controllers
Ed Lansinger
elansi01 at mpg.gmpt.gmeds.com
Tue Nov 28 17:34:26 GMT 1995
Bruce Bowling writes:
>I am surprised there is not a war between C and C++, instead of
>assembler vs. C.
>I will start one........
>I have been using C++ on a major project (a accelerator simulation)
>for the last year, and my conclusion is that C++ is
>useful if the problem you are working on can be easily
>represented by objects. Otherwise, use C.
>[...]
>Using C++ on an embedded processor code, with virtual functions
>and the like, could lead to suicide (yours).
I would be honored to pick up a gauntlet thrown by such a worthy
opponent!
I found object-oriented methods to be quite useful in designing a
fuel injection system. I found C++ to be an effective language
when used to code the design.
In 1994 I produced a running EFI system for a Formula SAE car. The
software was written almost entirely in C++ (including interrupt
handling through virtual functions). The system featured speed-density
fuelling, spark timing and delivery, asynchronous tasks, round-robin
tasks, heap management, and graphics LCD display handling with multiple
(non-overlapped) windows which displayed various things from graphic
tachometers to diagnostic information. It ran on a 68HC16 at engine
speeds over 11,000 RPM.
I had to jump through enormous hoops to get the C++ code to run on
this target, for which no C++ compiler existed at that time. Some
of this caused code ugliness. There were other inefficiencies, too,
which in the future I can go into if this thread keeps up. However,
I did find that the overall system was cleanly compartmentalized,
easy to maintain, and suprisingly stable on the first try.
Curiously enough, I was informed today that the "C/C++ User's Journal"
will be publishing an article I wrote about this system. I am told
it should be in the February issue.
More later (if you're interested) when I have all my materials in
front of me...
Ed Lansinger
GM Powertrain Premium V (Northstar/Aurora) Software & Calibration Group
Rensselaer Formula SAE Engine Group Leader '93, '94
More information about the Diy_efi
mailing list