C Programing language. Is it the devil?

Do you think that first should switch back to PBasic and leave us alone or should we continue to use C. Please state your case. :confused: This could be interesting. ^L^

C is sooo much more powerful.

My only thoughts are that they need to clean up thier default code and all. IT’s wierd how you can write a function and it NEVER returns from it. Also they can;t make stupid mistakes like forgetting to initialize the outputs in the auton mode, and bad firmware. When it’s all polished up hopefully by next year, i think it will shine!

C is a better langauge. We are now capable to do things we werent capable of before (ex interrupts). C is a language that is highly used by different compaines as a main programming language. Also, FIRST is about embracing changing technology, not sticking to what you know because you dont want to learn anything new.

The problem with BASIC is that…well it really isn’t a real language. The technology behind it is archaic, and stripped down besides. C is much more powerful, I believe easier to use, and certainly more applicable to real technology development than BASIC. I think its great that we can use C now. Now I just have to get out of MPLab…wonder if theres an equivalent in C for Java’s Eclipse…

PBASIC is great if you’re playing around with simple microcontroller experiments in your basement. It’s not at all well-suited to controlling large robots that need fairly sophisticated navigation and control algorithms in order to function optimally. PBASIC has its uses, but I don’t think they include FIRST robots.

C is much better for students. It is a main stream language (probably the most common one) while PBASIC is a stripped down version of BASIC made by Parrallax. Of the 6 programming HS students on the team, 4 had already programmed in C (or C++) in school so I didn’t have to teach them the language.

No student who has ever entered our program had ever heard of PBASIC before. Only one engineer on the team ever programmed in it before (he was a pro but he really wanted to use C like in the Atmel processors he uses at work). After he left in 2002, I had to teach everyone (students and a couple new mentors) PBASIC, because I had done a little programming in my rookie year. Some people had QBASIC or Visual BASIC before so most of my time was spent teaching limitations of the code (no function calls or signed math) and its inefficient syntax (more goto statements then I ever want to see again). It should be easier for teams to find mentors with C experience since it is such a common language.

Along with the increased power of C comes increased responsibly. There are many new ways to shoot yourself in the foot. Projects contain over a dozen files (and include many more) instead of 1-6 (depending on how many 2K banks you used). The biggest problem with C this year is the MPLAB complier and all of its bugs (yes I know I can use something else but that is not easy when you have a big programming team)

Overall programming in C is a more valuable learning experience for the students because they are likely to use it again in college and their careers. C will probably continue to be widely used in the future for low level applications. Basically all new languages are object-oriented or intended for web use. None of these languages are appropriate for a procedure oriented system like a robot. C is a superior language to PBASIC so FIRST should keep it. C is going to be around for a long time, so learn to like it, or start building a PBASIC to C converter. :stuck_out_tongue: (I think Mike Soukup built a C to PBASIC converter, maybe it will work in reverse :slight_smile: ).

I agree with the last post by the Lucas. C is much more sutiable for someone who may eventually go on to do enginneering. It is a much more modern programming language, unlike BASIC, which only supports things like functions as clumsy after-thoughts.

Why I would pick C over PBasic for anything:

  1. From a technical standpoint, C can do far more than PBasic could ever do. You simply can’t have as much control over the robot with PBasic as you can with C. PBasic’s structure is also very akwardly construed when compared to the majority of languages. We wrote algorithms on our robot this year that we could never have dreamed of putting on last year’s PBasic bot, only because we couldn’t write them in PBasic.
  2. C is the “real programmers’” language (including C++, also). I highly doubt that many professional programmers use PBasic to create real world projects. Remember, FIRST is all about us pursuing careers in science/tech/engineering/etc. so why wouldn’t they pick a language that we can use in our careers?
  3. From a practical standpoint: Learning PBasic and then trying to use your knowledge as a stepping stone to other languages is very hard. If you know C, however, it is simple to learn C++ or Java, which are far more widely used than PBasic.

Why wait for IFI to clean up their default code? Throw it all away! There isn’t much magic in the code. You just have to respect a couple calls & sequences (all noted with /*DO NOT CHANGE */) and after that you are free to party! I agree totally that the default code was warty as heck. Even the EDU default code was better structured and easier to follow. By the time I was done I saved the printf code and nothing else. Oh, I did reuse the file name “user_routines.c”…

One of the big reasons I re-wrote everything was to make sure I understood how it all worked. Sometimes it is easier to rewrite than to take the time to understand and work around someone elses choices. The down side of the rewrite is that one cannot use any of the tutorial stuff on IFI…

Is it just me or is this a recurring theme? Even last year with that dreaded thing called pBasic, the edu code was better than the FRC code (which was why i used it to run our bot lat year). Yes, I know this is off topic, so i’ll add in my blurb about C

C, even if it is not the most common language, is essentially the granddaddy of all other modern languages. Look at Java or C++(duh) or C# (another duh) or J#, or php to a degree. All of them are structured like C and have very similar, if not identical syntax and basic functions (i.e. ++ << >> etc). If I had to narrow it down to one reason i would keep C over pBasic, it is the following:

X=X+1 becomes X++;


Isn’t most of the default code headers and printf? I built mine on the default code, but totally destroyed anything user. As in: select>delete.

Funny, I hear a lot of people are throwing away the printf code and writing their own. :slight_smile:

I was a complete newcomer to FIRST this year, with absolutely no experience with the IFI computers. My strategy was to make as few structural changes to the code as possible, so I could always go back and look at the default code to figure out how it was supposed to flow. I did end up with a separate “math utilities” file, and I am only just now on the verge of splitting out the autonomous code into its own file.

There is nothing wrong with PBASIC, expecially with the latest release. The only thing missing from the language syntax that I missed was structs. The issue with the old controller has more to do with the architecture of the stamp. The stamp 2sx has 8 banks of 2kb program memory, but they all share the same 32 bytes of RAM. You can write a separate source file for each of the 8 program slots, but unless you declare the same variables in the same order in each file you can’t share variable values between slots. Its sort of modular, but not really.

The big advantage to C is the fact that you can break your code up into logical blocks based on shared interfaces. When you write a complex program it is much easier to work with small, fully tested modules than one huge file. Once you define your interfaces you can code as many implementations of each as you want. It makes it much easier to write platform independent code that will run on either the mini or FRC controller. It also makes it easier to share code between teams because you’re only adding files to the project instead of pasting code.

You’ll eventually learn that for a good developer the language is largely irrelevent. Aside from the normal caveats in any language, value is added by knowing how to solve problems, not in knowing the syntax.

Yes, but not knowing the syntax makes it dificult to solve the problem.

I still say the biggest advantage to C is signed math. The hoops you had to jump through with pBASIC to get anything to work was rediculous. Look at the following two statements:

PControl = Error * PGain - 127*(PGain-1) // What???

PControl = Error*PGain;

It seems to me that the C implementation is much easier, more intuitive, and requires less testing/debug to be sure you recentered yourself correctly around zero. The sad thing is, it just took me 2 seconds to write the C line, but about 5 minutes to figure out the pBASIC line. Given that, I’d rather have C any day.

Eclipse supports C/C++.

But IDEs for losers. Real programmers use Vi :wink:

hear hear :wink:

learning java first, c was a much easier transition than pbasic :slight_smile:

pbasic is old and ugly. C may be old but its obviously good enough to spawn 5 (probably more, but all i can think of at the moment) new languages

C+, C++, C#, plus all the varients and standards of C (PIC C, ANSII C, NQC, etc.).