Mk. III graphic


User's Guide
Introduction
Features
Requirements
Controller
Chassis
Assembly
Testing
Troubleshooting
Programming
Contests
Extending

Appendix
Hints
Polarized
Resistors
Capacitors
Servos
Batteries

Datasheets


PDXBot
RoboMaxx
Robothon

Buy Robots!
View Cart

Shipping
Privacy

About
Contact
Printable Version

Programming

One of the goals for the Mark III is to provide software and a programming environment that is easily accessible to beginners, while at the same time not limiting for experts. In particular, no proprietary programming environment or software is required. The Mark III supports a variety of languages and computing platforms to appeal to all levels of expertise.

There are a variety of languages that can be used to program the Mark III. It is suggested that you pick the one most suited to your level of expertise and experience. Sample code for self-test, servo calibration, MiniSumo and Line Following is available for each of the supported languages.

First, a Note About Support

What kind of support do you get, you might ask? Well, we can't guarantee much hand-holding or personal attention. Sorry! We're all doing this for free and have jobs of our own, so please rely on the following:
  • directions to get started posted here
  • sample programs posted here
  • the Mark III support forum on Yahoo! Groups at http://www.yahoogroups.com/group/MiniSumoMarkIII/, where your question may already be answered; the Search Archive button is your friend!
  • NOTE: you must join the forum in order to post questions or search for answers; it costs nothing, and you can choose at any time whether to receive all messages posted to the forum via email or only read them from the web site
  • if you can't find an answer to your question through these three avenues, then post your question to the forum; some other MarkIII owner may know the solution, or one of the MarkIII team members may answer

Supported Languages

The members of the MarkIII project have figured out and documented methods for the use of a variety of programming languages with the robot.

Your choice of a programming language depends on your experience, interest level, and budget. There are other languages and programming tools for the PIC16F877 than these; we just aren't currently supporting them.

The supported languages and their advantages are:

  • CH Basic (proponent Mark Gross)
  • JAL (proponent Brett Nelson)
  • C (proponent James Farwell for CC5X, Pete Skeggs for CCS C)
    • CC5X compiler from http://www.bknd.com/cc5x/index.shtml.
      • Integrates with the MPLAB development environment.
      • There is a free version of CC5X available for download from the above site; the standard edition is $250.
    • CCS C compiler from http://www.ccsinfo.com/picc.shtml.
      • This also integrates with the MPLAB development environment.
      • The PCM compiler costs $125.
    • C is harder to learn than BASIC, but is a great skill to develop; C language compilers are available for virtually every computing platform today
    • C has many of the advantages of assembly language but takes care of the nitty-gritty details for you
  • OOPic (proponent Pete Skeggs)
    • Requires separate purchase from http://www.oopic.com/ of an OOPIC chip ($49 gets you a chip, a programming cable, and a prototyping board)
    • Also requires installation of a serial EEPROM in socket U4
    • The OOPic II (http://www.oopic2.com/) is an even more powerful version ($59 at http://www.acroname.com/)
    • Despite the additional cost, provides a powerful object-oriented programming language that lets you bring up a robot prototype very quickly
    • Easy to learn
    • The OOPIC compiler comes with a built-in downloader which requires the use of a parallel port and a Windows PC
    • There are OOPIC accessory boards which can connect to the 40-pin header to add additional functionality to your robot not available on the standard MarkIII accessory boards:
  • PIC assembly (proponent Rick Farmer)
    • Develop using Microchip's MPLAB
    • Requires a lot of effort to learn, but once you do, you really understand how microcontrollers work and how to get them to do what you want
    • It's free!

The MarkIII kit comes with a license for CH Basic, a nice BASIC language compiler specially designed for the PIC. This compiler normally costs $99, but is included in the price of your kit. The maker of the compiler has donated licenses to the project for $10 each, which is a great bargain.

For nonprogrammers, this is the best way to go.

Links to Example Programs

CH Basic examples are here: http://thegnar.org/mIII/markIIICode.htm.

CC5X examples are here: http://groups.yahoo.com/group/MiniSumoMarkIII/files/C-Samples/.

OOPIC examples are here: http://groups.yahoo.com/group/MiniSumoMarkIII/files/OOPIC%20Samples/.

CCS C examples are not ready yet. Sorry.

Neither are JAL examples.

Links to Software Tools

Members of the MarkIII community have created tools to help program the robot.

Rick Farmer's PICLoader, a boot loader or ROM Monitor program that comes preprogrammed into the PIC chip included with the Mark III kit. This small program gives the PIC chip enough smarts to talk to a computer and enables it to reprogram the Flash memory in the PIC with new robot programs using only an RS232 serial cable. Without the PICLoader, you would also need to buy a PIC programmer board, such as the Warp-13a from Newfound Electronics (available from the Mark III Store).

Mark Gross's miii_tools (http://thegnar.org/mIII/mIII_tools.zip) include CHPre.exe and mbuild.bat, which help convert the output of CH Basic so that it can be loaded into the PIC using Rick's PICLoader and either HyperTerminal or BotLoader (see below). These are required for all CH Basic users. Power users can hand-edit the CH Basic assembly code and run MPLAB themselves to do this, but even they can benefit by having it done automatically using Mark's tools. Mark's instructions for using them can be found at http://thegnar.org/mIII/mIII_tool_chain.htm.

Pete Skeggs's companion BotLoader and BotLdrCmd are Windows programs that make it easy to send your robot programs to the MarkIII's PICLoader. You can upload programs to the MarkIII using only a simple terminal program such as HyperTerminal (that comes with Windows), but it can be difficult to get all the settings right. BotLoader automatically finds the serial port in use, configures it correctly, and talks to Rick's PICLoader for you. Just browse your PC's hard disk to select your .hex file or type it in to the filename box, then click Go!. BotLdrCmd does the same thing except runs as a command line program for power users to integrate with their make environment. Instructions are here.

Pete Skeggs's CLst2Asm program for enabling the use of CCS C with the version of the PICLoader (1.1) burned into the standard MarkIII PICs. This is useful if you plan to use a variety of languages with the MarkIII. Alternatively, you can reprogram the PICLoader with version 1.3, which automatically works with the hex files output by CCS C, but which makes it hard to use other languages.

Pete Skeggs's Reloader, which (seemingly) does the impossible -- it can reprogram the PICLoader with another version of PICLoader. You can use this program to switch between versions 1.1 and 1.3 of the PICLoader. Instructions are available here.

General Procedure for Programming the Robot

Regardless of the language you choose, you will need to perform these steps:
  1. write your program's source code (sumo.bsc, firefighter.c, linefollow.jal, etc.) using an editor that either comes with your language tool or with something like Windows' Notepad; start with an example program listed above just to get a feel for the process
  2. compile the source code using your language's compiler
  3. fix up the output of the compiler (sumo.asm) to be compatible with Rick's PICLoader
  4. assemble the fixed up output using MPLAB so that it can be loaded into the PIC (sumo.hex)
  5. connect the robot to your PC using a straight-through 9 pin RS-232 serial cable (female on one end, male on the other)
  6. load the hex file into the PIC using BotLoader or Hyperterminal or whatever tool you like; NOTE: you must hit enter in Hyperterminal, launch BotLoader or hit the Scan Ports button in BotLoader, within 5 seconds of powering on the robot, or else any existing robot program will be automatically run by Rick's PICLoader.
  7. test it out and see if the robot does what you want it to do; if it doesn't, go back to step 1 and try to figure out what went wrong, then fix it and try again

Mark's miii_tools performs steps 3 and 4 for CH Basic users. Steps 3 and 4 are not necessary if you are using CCS C and have switched bootloaders to version 1.3.

Describe functioning of example sumo code, example line following code

T.B.D.
 
webmaster@junun.org