Teach me?

Hey everyone!
I was wondering if someone could help me with programming. We use MPLAB(not even sure if thats what everyone uses, or just us) and I have no idea how to program. I need to learn, because nobody else on our team knows either. So can someone either point me to a good tutorial, or possibly teach me how?



You may have already seen this, but http://www.chiefdelphi.com/forums/showthread.php?t=30976 is infinitely helpful in getting started. Plus read through all the documentation and whatnot pertaining to what you want to do, along with checking out the internal comments within each of the sections of code. At least, our default code came with comments when I was looking through it.

Anyway, not too helpful, but it could get you started.

Also, Demonoid? Needs more OiNK, #it, or x264.

Have you searched the papers in CD-Media? There are some good resources there!! Do you have a copy of MPLAB? My next suggestion is start with the basic user code and read its comments. It is very well commented (although I feel maybe too much is there for starting out) and learn how to modify some of the variables within it. Better yet, have the robot there with you. Tweak the basic code so it does something different like have it drive forward when you move the joystick to the left or have it spin around when you press a joystick button. Dedicate some time to experiment with the code and get used to syntax, declarations, and write a function or two!

Remember you also need C18, which is in fact the compiler. MPLAB is just the IDE(Integrated Development Environment). NOTE: you can only use the V2.4 of C18. The new ones don’t work. You should have gotten this in your kit Microchip CD. If you don’t have it or can’t find it pm me with your email.

Good Luck…you have a long road ahead of you…but the EFFORT is well worth it.

Hello again =),

I used simple programming tutorials and books when learning C. Check out www.programmingtutorials.com
Its free and surprisingly very fast to learn C or any other language.

thanks everyone :slight_smile:

I know you already stated that you are using MPLab, but is there any reason that for your first year you can’t use EasyC? As much as people say it limits you and whatever else, I think it would be very useful to at least play with it during the off-season… Just another idea

Sam is right.

For FIRST, easyC doesn’t limit at all. It makes the simple, mundane code much easier and quicker to do; but it still allows custom code to be written in plain C. It’s really a huge time saver.

I know a lot of programmers avoid EasyC because it’s easier and they don’t want their ego’s hurt, but c’mon, it’s a win/win situation. The code is done quicker, with less chance of syntax errors. And if you don’t believe complex things can be done with it, look at team 40; they program entirely in easyC.

Also, for the programmers that defiantly stick to MPlab or other IDEs; I work at Northrop Grumman in the satelite area. Most of the programming is done in a program similar to EasyC, not an IDE like Mplab.

Do you have access to a VEX system? The VEX robots can be programmed using “C” and MPLAB and are much easier to take home to work on (and pick up when they decide to start smashing into everything because of a bug in the code.)

I have found that my students have had good success teaching themselves to program VEX and FRC machines using the tutorials and assistance available on CD and by… gasp… reading the manuals.

It is kind of dry, but if you stick with it, you should have some killer auto modes by March. Best of all, perhaps, with your experience as a driver you should be able to develop drive control code that makes your robot respond really well in telop mode as well.


Yeah, building a sqaurebot with encoders on the drive, an ultrasonic sensor, Ir sensors, line followers, and maybe even touch sensors would keep you happy for a long time.

I personally would wire up teh KOP gyro to a squarebot and put encoders on the drive to try to make some decent autonomous drive functions.

I’ve found if you give yourself a project you want to do, you’ll learn better than if you’re just trying to learn.

Can you guys point me in the right direction to do VEX with MPLAB? Is it the same MPLAB as the FRC robots but with VEX-specific code? I actually had some project ideas for the VEX and, yes, I could be using EasyC but… Well, we’ll leave that debate alone.

start here;


While EasyC may not limit you at all for FRC (I’ve never tried it, only done it the normal way), it seems to me that if one relied on it consistently, this might hamper development of actual programming skills. While this may not be of any concern if you just want to program something and get it done and over with, if you are seeking to develop these skills, it might be better to build from floor 0.


Easy C is useful to do 2 things. a) teach basic control flow and algorithmic processes. b) get a non-programmer started and through an FRC season.

If any of the following conditions are true, then you should be migrating to MPLab tools as soon as you can.

  1. If you are going to major in engineering, computer science, or science.
  2. If you need to do professional grade embedded programming.

One book that I like for teaching ‘C’ is the following:

Note that it is NOT the ‘C++’ book but IS THE ‘C’ book of a very similar name.

Then you can download this from Microsoft:

It is the Visual C++ Express. For this educational experience you will NOT do c++ but c programs inside of Visual Express.

After installing Visual Express you should register it. It is free and easy.

Then go File->New->Project->WIN32 Console Application
Call your project ‘demo’ or whatever you like.

then do a Control-F5 and compile and run it.

Now you are ready to do a ‘hello world’ application, which starts on about page 29 of the book.

At some point you will need to master everything in the book in your college career.

But, there are several things that will not be done in an FRC controller, like calloc(), malloc(), disk I/O, probably not sorting/searching, linked lists.

Do your 21 days and then it will be time for the next step.

If you want to learn programming … I think you may want to actually learn on something other than the robot.

The robot introduces alot of extra stuff that doesn’t really help in getting people to think like programmers.

I suggest using either Python or Ruby. These will make it easier to write simple command line programs and start thinking logically. They are very easy syntactically, there is no compiler or useless overhead stuff needed either.
Just download the interpreters at :


I’d also suggest getting a book on it.

Once you can do simple (or complicated programs) move over to C. As far as programs … just make stuff you want… try making a simple board game or something.


Note : I have never used EasyC.

It seems like this is beginning to trend toward a “What is the One True Programming Language” thread. I am a firm believer that languages are tools, and the “OTPL” model leads to a very lonely tool-box.

Go ahead and learn EasyC. Get good and comfortable. Then learn Python. Then C. At this point, you will be able to pick up any imperative language in less than 2 weeks.

You won’t be an expert in any of them, but that is just fine. I’ve never gotten a job that uses a language I already knew. Each time I took an internship, I needed to learn a new tool ( or 3 ).

So Ed, let me disagree with you. The CS/CE people should get familiar with EasyC, as it is a specific tool designed for a specific task, and it will help them learn harder tools quicker.

For quick reference, here are my favorite tools.
Python : Quick and simple, one person programming tool. LEARN THIS.
MATLAB : Darn good for matrix math.
C : Wish I didn’t have to use this, but you really don’t get a choice some times.
Verilog : Really slow to write, but wow FPGAs are cool.
LabVIEW: Just started on this one, but it is surprisingly intuitive.

I doubt we are really disagreeing. As I said, EasyC is good for teaching concepts and getting through a season.

And then a CS/CE would move onto other tools as their skill set progresses, like you said.

And yes it is true, the tools you use depends on what kinda nail you have to drive. For me today it is a full time job writing C for ARM9 processors and linux kernals.

A few years a go it was FORTRAN and the Oracle. so yeah.


I think the future of FIRST programming is using ROBOTC - carnegie-mellon’s new software, which is compatible with the LEGOS NXT, VEX, and very-soon the FRC controller.

Aside from:

+real-time debugging (robotc can make the robot perform the highlighted line of code as you step-through your program) and

+real-time monitoring (a window automatically shows all variables current value in the program),

I was impressed with the simple little things that make programming much easier:

+A big X next to the line where the compiler is having problems (along with a very detailed explanation). No more scouring for semicolons…

+And as you’re typing, the program suggests words in a drop-down box, just like you’re using gmail…

You can download a 30-day trial at www.robotc.net, and seats are $100 less than EasyC. (ROBOTC may be included with the 2008 KOP.)

Either way, we’ll be using ROBOTC to learn programming on our VEX kits, and look forward to our team using ROBOTC for the FRC comptetion in the coming season.

It’s the same IDE. I think when you program an FRC robot you have to link to a different library etc.

This tutorial I wrote might be helpful: