Mplab programming

I was wondering how to use mplab, and test it I’m used to ez c. can you help me?

Note: you can get mplab here (unpack the zip first)

I’m assuming you have MPLab, the compiler, and the IFI Loader all ready set up.

First you download the files here, and after getting a project set up with all of them (instructions here)
you go into the user_routines.c and user_routines_fast.c to add you’re own code (this is not the same as easyc, ex. in easyc, command is setmotor, in MPLab you change the value of the pwm output, such as pwm01).

Once you have finished your code, build the project, and, after downloading the correct master file to the microcontroller via the IFI Loader, download the project’s .hex file and WALAA! it works

tell me if there are any problems or if you have any questions…

Thanks for posting on time :slight_smile:

(couple seconds later)
okay I get it now!!! thanks!!!

(couple MORE seconds later: “what is with all the varibles and functions and such???”)

That is what it “really takes” to make the Vex work… EasyC just “hides it” from the Beginner…

The word you’re looking for is “Voila!”:wink:


I’m also using MPLAB for the first time and I was wondering, when I build my program it builds as a .cof file type. How do I change it back to a .hex file type so I can use the IFI loader to put in the the VEX micro-controller? Thanks.

When I load the VexUserCode project from VexLabs, and Click the “MPLINK Linker” Tab on the Dialog Box under the “Project–>Build Options–>Project”, I see the Hex-File Format is “INHX32”.

When you “Build All” the VexUserCode under Project, it will Create the .Hex file after the Compile and Link steps in the same directory as the Source Code.

I thought I was having this same problem last night. I would build the VexUserCode project in MPLAB, and the last two lines in the MPLAB Output Window would read:
Loaded C:\mcc18\VexCode\VexUserCode.cof.
BUILD SUCCEEDED: Thu Aug 16 11:24:22 2007

I would try downloading the VexUserCode.hex file to my bot, but nothing would happen with the Vex motors when I fiddled the joysticks of the transmitter. I thought to myself, “Self, why is the object code a .cof file when I want it to be a .hex file so I can download it to the bot? This clearly isnt working. There must be some way to convert that .cof to .hex” And then I went to bed.

This morning I realized my problem (which may or may not be the same problem you had): I hadnt hooked the radio receiver to the Rx port of the micro controller, which is why nothing happened when I fiddled with my joysticks.

I guess there are two morals to this story. The more obvious and philosophical one is to make sure you arent making a really silly mistake with the hardware before you blame the software for the hardware not working. Secondly, if you go through the My Computer directory and check the .hex file for the VexUserCode (or any other project you compile), the object code should end up in the same folder that the source code came from, and you should see that it was most recently updated the last time you built the project in MPLAB. Just because the MPLAB Output Window says it loaded a .cof file doesnt mean that the .hex file wasnt also compiled with the new code for download to the bot.