Difference between revisions of "Tutorials/Getting Started"

From ROBOTC API Guide
Jump to: navigation, search
(Sample Programs)
(Getting Started with the VEX PIC)
Line 238: Line 238:
 
<br />
 
<br />
  
=== Compiling and Downloading PIC===
+
=== Compiling and Downloading ===
 +
{|width="740px"
 +
|-
 +
|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.<br />
 +
[[File: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.<br />
 +
[[File: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".<br />
 +
[[Image: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.<br />
 +
[[Image:download.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.<br />
 +
[[Image: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.<br />
 +
[[File: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.<br />
 +
[[File:compiler.png]]
 +
|}
 +
<br />
 +
 
 +
== Compiling and Downloading CORTEX ==
 
{|width="740px"
 
{|width="740px"
 
|-
 
|-

Revision as of 19:48, 7 May 2012

Tutorials → Getting Started




System Requirements

ROBOTC requires basic system specifications to run properly. The development environment is not processor intensive, but the interactive debugger may slow down computer performance on older machines.


System Requirements:
Intel® Pentium® processor or compatible, 800 MHz minimum Windows XP Professional or Home Edition with Service Pack 2 or greater 256MB of RAM minimum Up to 30MB of available hard disk space 1 available USB port Compatible Bluetooth adapter (optional)


ROBOTC will not run natively in any other operating system other than Microsoft Windows. ROBOTC will run with a Virtualization client on a Apple Macintosh. ROBOTC has been tested with VMWare Fusion, Parallels Desktop, and Apple's Boot Camp. You will still need to download/install device drivers found on your purchased CD or on the ROBOTC website.


Uninstalling and Installing ROBOTC

Uninstalling

You must uninstall your previous version of ROBOTC before upgrading to the newest version of ROBOTC.

To uninstall ROBOTC, follow these steps:

1. Open the Control Panel from your "Start Menu"
Uninstall1.gif


2. Inside of the Control Panel, select "Add or Remove Programs"
Uninstall2.gif


3. Navigate through the "Add or Remove Programs" list until you find your version of ROBOTC that you wish to uninstall. Press the "Remove button"
Uninstall3.gif


4. Windows will start the uninstall process. When the window below disappears and you are returned to the "Add or Remove Programs" list, ROBOTC has been successfully uninstalled.
Uninstall4.gif


Installing

To Install the latest version of ROBOTC, follow these steps:

1. Double click on the ROBOTC installer. You will be presented with the Installshield installer for ROBOTC. Click "Next" to proceed.
Install1.gif


2. Before you can proceed, you must read over the accept the End User License Agreement. Click "I accept" and then the "Next" button to proceed.
Install2.gif


3. Choose where you would like to install ROBOTC to. By default, ROBOTC is installed to your "Program Files" folder. Click "Next" to proceed.
Install3.gif


4. The installer will ask you to confirm your settings. If everything looks correct, click "Install" to being the installation process.
Install4.gif


5. The installer will begin copying files from the installer to your computer. Please wait until this is complete.
Install5.gif

6. When the installation is complete, the install will inform you of this. Click "Finish" to complete your install.
Install6.gif

7. Double click the "ROBOTC for Mindstorms" icon to launch ROBOTC.
Install7.gif


Activate Online

To continue using ROBOTC past the 30 day trial period, you must purchase a ROBOTC license and then activate the license on each computer.


To activate ROBOTC, you will need the License ID and Password that was sent to you during the purchase process.

  • If you purchased a ROBOTC license online, the License ID and Password were sent to the email address specified.
  • If you ordered the CD-ROM version of ROBOTC, the License ID and Password are printed on the CD label.

If you are Activating the ROBOTC license on computers with internet access, follow the Activation instructions below. If you are activating the ROBOTC license on computers without internet access, skip to Activate by Web instructions.

NOTE: ROBOTC must be activated on each individual computer.


Follow these steps to activate on a computer with internet access:

1. Open ROBOTC and select "Activate ROBOTC" from the start-up prompt.
Activate Main.gif


2. Select "Activate ROBOTC for MINDSTORMS Online"
Activate Selection Online.gif


3. Enter in your License ID and Password that you received via emaill. Click the "Continue" button to proceed.
Activate Online LicenseIDPass.gif


4. ROBOTC will communicate with the activation server via the internet to verify your License ID and Password.
Activate Processing.gif


5. ROBOTC is activated and ready for use. Click Continue to use ROBOTC for MINDSTORMS.
Activate Success.gif


Activate by Web

Follow these steps to activate on a computer without internet access:

Note: You will need to use a separate computer with Internet access in step 4 at this activation process. You must repeat this process on each computer without internet access.

1. Open ROBOTC and select "Activate ROBOTC" from the menu.
Activate Main.gif


2. Select "Activate by Web"
Activate Selection Web.gif


3. Two user codes will be displayed. Copy both of these down. Take these codes with you to a separate computer with Internet access.
Activate Web UserCodes.gif


4. At a separate computer with internet access, visit http://www.robotc.net/register. Enter your License ID and Password that you received via email and click "Next."
Activate Web EnterLicense.gif


5. Enter User Code 1 and User Code 2 that you copied down in step 3. Click "Next" to proceed.
Activate Web EnterUserCoders.gif


6. A Registration code will be displayed. Write this down and return to the original computer on which ROBOTC is installed.
Activate Web RegistrationCode.gif


7. Enter the Registration code from step 6 into the "Activation Code 1" field.
Note: Leave Activation Code 2 blank.
Activate Web UserCodes EnterReg.gif


8. ROBOTC will be activated and ready for use. Click Continue to use ROBOTC.
Activate Success.gif


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.

Prerequisites:

  • 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.
Vex-firm-download.png


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.
Download.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-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.
Compiler.png


Compiling and Downloading CORTEX

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.

SS-2010-10-14 11.33.22.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.
SS-2010-10-14 11.33.57.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".

SS-2010-10-14 11.34.58.png


Before downloading code to your robot, you should verify that the "VEX Cortex Download Method" matches your setup.
SS-2010-10-14 11.35.39.png


Option 1: Download Using VEXnet or USB
With this option selected, ROBOTC will download ROBOTC firmware and programs to your Cortex using a VEXnet or USB connection. In this mode, when the Cortex is powered ON it will look for a VEXnet or USB connection before running your program. (The Communication Port > Automatic Selection option in the ROBOTC Preferences should be selected if you plan on switching between VEXnet and USB as your download method.)

Option 2: Download Using USB Only
With this option selected, ROBOTC will download firmware and programs to your Cortex using only the USB connection. In this mode, when the Cortex is powered ON it will immediately run your program. This option is NOT recommended if you are using the VEXnet Joysticks to download to the Cortex, or remotely control it.

Option 3: Download for Competition (VEXnet)
This option disables the ROBOTC debugger, and is not recommended for classroom use.

Note: Switching between Download Modes may require you to power cycle your Cortex before it takes effect.

Once your program has successfully compiled and you've selected the appropriate Download Method, 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.
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.
Compiler.png