Difference between revisions of "Tutorials/Getting Started/Getting Started with the VEX PIC"

Jump to: navigation, search
(Created page with "<yambe:breadcrumb>Tutorials|Tutorials</yambe:breadcrumb> <br /> == Getting Started with the VEX PIC == === Configuring Serial Port === {|width="740px" |- |When using ROBOTC ...")
(No difference)

Latest revision as of 18:53, 17 May 2012

Tutorials → Tutorials/Getting Started/Getting Started with the VEX PIC

Getting Started with the VEX PIC

Configuring Serial Port

When using ROBOTC for the first time, you may need to specify which Serial Port is used to communicate with your VEX. To change the Serial Port, follow these steps:

1. Open the Preferences menu under the "View" menu.
Robotc view menu.png

2. Select the serial COM port that your controller is attached to from the Communications Port drop-down menu. Click 'OK' to save your settings.
Be sure to also select the correct Platform with the "Platform" drop-down menu.
Robotc preference port.png

Download Master Firmware

The Master Firmware for the VEX is sperate from the ROBOTC Firmware. The Master firmware controls all of the lower-level controls of the VEX controller (such as serial and radio communication). This firmware is supplied by Innovation FIRST and has not been modified by ROBOTC. Every VEX Microcontroller is preloaded with a version of the master firmware, but downloading the latest version will ensure that your robot is compatible with the latest hardware available.

To update the VEX Master Firmware:
1. Open ROBOTC for IFI. Ensure that your VEX controller is connected and turned on.

2. Go to View > Preferences > Detailed Preferences. On the Platform tab, ensure that VEX 0.5 Microchip is selected as the Platform, alsong with the Prolific USB-to-Serial option as the Communication Port.
SS-2010-10-13 14.27.33.png

3. Go to Robot > Download Firmware > Master CPU Firmware > Standard File to download the Master Firmware.
SS-2010-10-13 14.31.58.png

4. A Download Progress window will appear. When the window closes, the download is complete.
SS-2010-10-13 14.05.46.png

Download ROBOTC Firmware

Before you can use ROBOTC with the VEX platform, you have to download the ROBOTC firmware to the VEX.


  • Connect the VEX to your computer and power it on.
  • Make sure VEX 0.5 Microchip is selected as the Platform Type

1. Open the Robot menu, select "Download Firmware", "ROBOTC Firmware", and then "Standard File".
SS-2010-10-13 14.35.48.png

2. A Download Progress window will appear. When the window closes, the download is complete.

3. Power cycle the VEX so that the new firmware will take effect.

Sample Programs

One of the best ways to start working with ROBOTC and learning how to program is to look at already developed programs. ROBOTC comes with over 75 sample programs to help the programmer learn how to program their robotics controllers.

To access these sample programs, open the "Sample Programs" folder by going to the "File" menu and selecting "Open Sample Program."
Sampleprograms menu.png

Inside of the sample programs folder, there are a number of samples organized by topic. ROBOTC will automatically open the sample programs folder of the platform you currently have selected.
Sampleprogram files.png

Just double click on one of the sample programs to open it up and learn more about ROBOTC programming.

Compiling and Downloading

ROBOTC is considered to be an "Integrated Development Environment." This means that ROBOTC has a custom text editor for developing code that will assist the programmer by color coding different potions of code to differentiate between integers, reserved words, functions and parameters.

Robotc gui.png

ROBOTC also contains a compiler for turning this user generated code in a byte-code language that the different controller platforms can understand. To run the compiler, access the compile function from the "Robot" menu.
Compile program.png

When the compiler runs, ROBOTC will check your program for errors and warnings that would cause your program to not run properly on the robot. Rather than send this broken code to your robot, ROBOTC will inform you of these errors so they can be corrected.

In the example below:

  • The reserved word 'motor' was incorrectly typed as 'Motor', generating a warning. A warning tells the user that they've created an error, but ROBOTC is able to correct this error itself when the program is sent to the controller. A program with warning will compile successfully, but users should use good programming practice to avoid warnings. Warnings are denoted by a yellow "X".
  • The code on line 5 is missing a semicolon, which is generating an error. An error will prevent the program from being sent to the controller. ROBOTC will do its best to explain what the error to assist the user. In this example, ROBOTC is informing the user they left a semicolon off a line of their program which is preventing the program from being compiled. Errors are denoted by a red "X".

Errors and warnings.png

Once your program has successfully compiled, you can send the program to the controller by clicking the "Compile and Download Program" option under the "Robot" menu. Note: Your robot must be turned on and connected to the computer before you can download a program.

Once the download starts, a "Download Progress" bar will appear. This bar will show the status of the transfer of the compiled byte-code to the controller.
SS-2010-10-14 11.36.04.png

Once the download starts, a "Download Progress" bar will appear. This bar will show the status of the transfer of the compiled byte-code to the controller.
SS-2010-10-13 14.05.46.png

Once the download finishes, ROBOTC's built in debugger will be launched. There will be a number of windows that launch, such as the Global Variables window, the Devices window and the Program Debug window. You can start your programs execution by clicking the "Start" button on the "Program Debug" window. Learn more about these windows in the 'Debugger' section of the help file.