# Presentation: 913191

## Robotics with the XBC ControllerSession 1

- Instructor: David Culp
- Email: _[culpd@cfbisd.edu](mailto:culpd@cfbisd.edu)__ _

**Rev.1/07**

## Learning goals

- The student will learn about the history of robotics and become familiar with installing Interactive C, downloading firmware and the bitstream, the capabilities of the XBC and will build the demo-bot.

## Course overview

- Every Tuesday and Thursday 6:00pm – 7:30pm CST.
- Session 1 – Course overview
- Session 2-
- Digital sensors
- motor control
- if-then statements
- Engineering process

## Course overview continued

- Session 3
- Analog sensors
- Variables and data types
- For – next loops
- Library functions

## Course overview continued

- Session 4
- C functions
- Preprocessor
- XBC buttons
- Session 5
- Gears and drive trains
- Feedback and control
- Servos
- Structures

## Course overview continued

- Session 6
- Arrays and uploading arrays
- XBC Color vision
- Session 7
- BEMF Motor Control
- Multitasking
- Engineering Process; incremental design
- Session 8
- Advanced color vision management
- Interactive and programming of color models

## Course overview continued

- Session 9
- Odometry
- Session 10
- Odometry II
- Course wrap up

## What is a robot and robotics?

- The word robotics come from the 1921 play by Czech writer Karel Capek Rossum’s Universal Robots.
- The word robota means laborer or worker.
- The word robotics first appeared in the short story “Runaround” by Isaac Asimov in 1942

## What is a Robot?

*In practical usage, a robot is a mechanical device which performs automated physical tasks, either according to direct human supervision, a pre-defined program or, a set of general guidelines using artificial intelligence techniques. Robots are typically used to do the tasks that are too dirty, dangerous, difficult, repetitive or dull for humans. This usually takes the form of industrial robots used in manufacturing lines. ...*- Wikipedia.org

## Installing Interactive C From CD

- If you have the CD that came with your XBC starter kit:
- Insert CD and open “My Computer”
- Double click on your CD drive
- Navigate to the Interactive C directory
- Double click on the “InteractiveC_XXX.exe” icon
- Follow on screen prompts and use default values.
- You may need to reboot your computer after installation.

## Installing Interactive C from Website

- If you do not have the CD that came with the XBC starter kit:
- Open your browser and go to _[http://www.botball.org](http://www.botball.org/)_
- At the top is a menu bar.  Place your cursor over “Educational Resources” and a menu will drop down.
- Choose “Interactive C”

## Slide 12

## Installing Interactive C from Website

- You should now be on the Interactive C website at Botball.org
- Click “Download Interactive C” from the menu on the left.
- You will be taken to the download page.  Fill out required information and click “Submit”

## Installing Interactive C from Website

- Scroll down and find the download link for “Interactive C 6 with Xport Utility”
- RIGHT-CLICK on the link and choose the “Save Target As” option.
- Save the file to your desktop.
- When download completes view your desktop and double-click on the “InteractiveC_XXX.exe”
- Follow on screen prompts and use the defaults for installation.

## Getting ready to start IC

- Plug your XBC charger into a wall outlet.
- Plug the other end of the charger into your XBC.
- Take the serial cable and plug it into a serial port on your computer (you may need a serial to USB adapter).
- Plug the other end into the XBC serial port.

## Downloading the bitstream

- The “bitstream” is a piece of software that runs on the XBC and configures and controls the hardware on the XBC.
- Rarely needs to be replaced.
- Make sure your XBC is plugged in.
- Start the “Xport Utility” **NOT** Interactice C.

## Downloading the bitstream

- Choose your com port.
- Click on “Browse for file”
- The bitstream should be located in the “lib/xbc/” folder and is called “bitstream8d03.bit”
- Make sure your XBC is turned **OFF**
- Click “Upload”
- Turn your XBC on.
**DO NOT DISTURB THE DOWNLOAD PROCESS!**

## Slide 18

## Starting Interactive C

- Click on the “Start Menu”
- Go to “Programs”
- Scroll to Interactive C X.X.X
- Click on “Interactive C X.X.X”
- Choose “XBC” from the “choose controller screen”.

## Slide 20

## Starting Interactive C

- Make sure your XBC is turned on and choose which com port your XBC is plugged into.
- If all goes well IC will start and download the IC libraries to your XBC.

## Downloading the firmware

- The firmware is the “Operating System” of the XBC.
- Does not need to be replaced often.
- Start IC if not already started.
- Choose tools->download firmware from the menu bar.
- Select your com port if IC asks.
- Click “Download firmware”
- Turn your XBC on.

## XBC Capabilities and Connectors

- From the menu bar of IC choose tools->view diagram.
- This diagram shows the layout of the XBC.  Refer to it when you have questions about where to plug connectors into the XBC.

## Slide 24

## Connectors and capabilities of the XBC

- Serial connector
- Charge port
- Power switch
- Analog ports 0-7 (cannot use port 0)
- Digital ports 8-15
- Servo ports
- Motor ports
- Camera
- Game boy buttons

## Your first XBC program

- Start IC if it is not already started.
- Click on file->new or click the “New” icon on the menu bar.
- A new editor area appears.
- Enter the following program and save it as “hello xbc.ic”

## Your first XBC program

- void main()
- {
-     display_clear();
-     printf("Hello XBC!!\n");
-     sleep(4.0);
-     printf("Goodbye XBC!!");
- }

## Simulating the program

- On the menu bar click the simulate button.
- If IC asks to save the program save it as as “hello xbc.ic”
- The simulator pops up.
- The simulator allows you to run an IC program without actually downloading and running it on the XBC.

## Slide 29

## Simulating the program

- Click “Run Main” in the lower left portion of the screen.
- You should see the words “Hello XBC!!” appear in the screen display on the right.
- When finished click “Quit Simulator” in the lower right portion of the simulator.

## Slide 31

## Downloading and running the program on the XBC

- Make sure your XBC is turned on and the serial port is plugged in.
- Click the “Download” icon on the IC menu bar. Program should download.
- Look at the XBC screen.  The first menu item should be “Run Hello IC.exe”
- Use the arrow keys to highlight the first menu selection.  Press the “A” key to run the program.
- Display should clear and should print “Hello XBC!!” followed by “Goodbye XBC!!” four seconds later.

## Your first lesson in “C”

- void main()
- All C programs begin at the “main” function.
- All C programs MUST have a “main” function.
- {
- Braces denote blocks of code in C
- Everything between the opening brace { and the closing brace } in this example belongs to the “main” function.
- display_clear();
- Function that clears the XBC display window.  Notice the ending ;

## Your first lesson in “C” continued

- printf("Hello XBC!!\n");
- Prints “Hello XBC!!” to the Game Boy screen.
- \n = print a carriage return (go to a new line)
- Notice the ending ;
- sleep(4.0);
- Used to put a pause in an IC program
- Notice the ending ;
- printf("Goodbye XBC!!");
- Prints “Goodbye XBC!!” to the Game Boy screen.
- Notice the ending ;
- }
- Ends the main function

## Getting Help

- The IC manual is built into IC.
- Choose help->Manual.
- The manual pops up in a browser window.
- Don’t be afraid to use the manual!

## Build Demo-Bot

## Session 2 Preview

- Motor control – Our demo-bot will move around!!
- Digital sensors
- If-then statements – our robot can make decisions!
- Boolean expresions