With the advent of a new season and the influx of new programmers-to-be I decided to do a 1 or 2 page write-up on just how a programmer new to FIRST can get started. [font=Verdana]I wrote this up to bootstrap rookie team programmers. Sort of a how does one get started when they know absolutely nothing about where to even start programming the FIRST controller. It’s not intended to replace the IFI documentation, it’s more to direct new programmers to it. I tried to stay away from most “how to program” type stuff and more advanced topics like the Linux/Windows debate and configuration management. This is just to get newbies rolling. Anyone have suggestions, additions, corrections. Everything is up for debate. [/font]
P.S. I have enough tips now to continue the recent trend in “lists”, but I’ve created three lists: One for programming tips, another for tips specific to just the control system, and the third for quick starting new FIRST programmers.
Programming Quick Start
[ol]
[li]Beginners need the following to program the FIRST robot:[/li][ul]
[li]FRC (Full-size Robot Controller) RC Default Code[/li][li]Microchip MPLAB & C compiler[/li][li]IFI_Loader[/li][li]A standard serial cable[/li][li]A Windows PC with a serial port or USB-to-serial converter[/li][/ul]
[li]All default code, updates, documentation, and support information is available at http://innovationfirst.com/FIRSTRobotics/documentation.htm, the Innovation FIRST (IFI) website, The default code “FRC RC Default Code” comes ready for basic driving and with a variety of sample I/O usages.[/li][li]MPLAB is the FIRST supplied Windows based development environment (edit, compile, debug) that runs on your desktop computer and is usually provided to each team on a compact disk in the Robovation kit. MPLAB is free on-line at the Microchip website http://www.microchip.com/, but the C compiler is not free except via the Robovation CD and is only available online as a time-limited trial copy or for purchase. Manuals for using MPLAB come on the FIRST CD.[/li][li]IFI_Loader (from the CD or IFI website above) is used to download the compiled code into the RC via a serial cable from your desktop or laptop computer.[/li][li]Check the IFI website periodically for updates to the software that corrects issues fixes problems.[/li][li]The programming language used is “C” or PIC assembly. Tutorials in C can be found on the web, in your local bookstore or on the FIRST website, e.g.,[/li]
[ul]
[li]C Programming Resource Library [http://www.usfirst.org/robotics/C_help.htm[/li][li]Learn C Programming - Developed by Carnegie Mellon and the National Robotics Engineering Consortium specifically for FIRST, this interactive website will get your team prepared for the upcoming FIRST Robotics Competition season. [url=“http://www.rec.ri.cmu.edu/education/robot_builder/”]http://www.rec.ri.cmu.edu/education/robot_builder/](http://www.usfirst.org/robotics/C_help.htm)[/li][li]FIRST Robovation - A Primer for Success Learning Modules http://www.usfirst.org/robotics/robovation/primer/index.html[/li][/ul]
[li]Newer laptops no longer come with serial ports. If you have this problem one solution is to use a USB/Serial converter. Various models are available at Radio Shack, CompUSA, or online.[/li][li]Documentation is your friend. Take the time to at least leaf through each manual, so you have an idea of where information can be found. Most of the basic information beginners require can be found in the IFI documents or MPLAB documents: [/li]
[ul]
[li]IFI Programming Reference Guide – basic how to program and download to the RC, hookup switches and sensors and do normal robot operations.[/li][li]IFI RC Default Code Reference Guide – description of how the default code is structured and where users can add their own custom code.[/li][li]MPLAB v6.xx Getting Started – basic how to use MPLAB and set options.[/li][li]MPLAB C18 Users Guide – table of max numbers each variable type will store, compiler options, error messages, detailed descriptions of pragmas and some other advanced topics.[/li][li]MPLAB C18 Libraries – details on timers, interrupts, and various other utility functions available to the programmer.[/li][/ul]
[ul]
[li]More advanced documents are also available, e.g., 18Fxx20 Data Sheet (& Errata)– PIC assembly instruction set and details on EEPROM and other chip specific topics, and several others.[/li][/ul]
[li]Programming limits to the 2004 RC: [/li]
[ul]
[li]30,720 bytes program space is available to the user, after 2004 IFI code.[/li][li]1,343 bytes of ram available to the user, after 2004 code overhead.[/li][li]256 bytes of global variables available within any one MPLAB file.[/li][li]120 bytes of variables within a single routine.[/li][/ul]
[ul]
[li]The program and data space your code has used can be checked either by the status line at the bottom of the IFI_Loader window or via the optional .map file that MPLAB will generate for you.[/li][/ul]
[li]Common beginner problems include improper MPLAB project setup, trying to pack too much code into the controller, printf misunderstands, using too small a variable type to hold the largest possible intermediate as well as the largest final value of a calculation, and lack of proper variable typecasting.[/li][li]Visit the ChiefDelphi Programming forum for discussions on all programming topics, problems, and issues http://www.chiefdelphi.com/forums.[/li][/ol]