CM-5: Creating a simple “Hello World” C program

This post try to explain how to compile, load in the CM-5 (transmit) and execute a C program (a servo version of the “Hello World” classic example).

What do you need?

(You can find here how to start programming CM-5 / CM-510)

Obviously, some Bioloid hardware:

– The CM-5

– The battery or power source

– The serial cable

– An AX-12

– A cable to connect the AX-12 with the ID 17 to the CM-5. You can change the ID in the program.

What should you do?

1. Download and install the software:

1.- Download and install the Robotis RoboPlus software.

2.- Download and install WinAVR

3.- Download a Hello World example for WinAVR.

The C “Hello World” servo program is based in the original Robotis example.

4.- You should create a folder for your CM-5 program, for example c:myprojectscm5helloworld Copy there the previously downloaded helloworld.zip and unzip it.

2. Compile and link the program

1. Execute WinAVR and open the unzipped project:

( Bioloid User’s Guide.pdf could help you using WinAVR)

You should change the ID 17 of the servo for the ID of the servo you are using

2.- Compile and link. Make all:

3.- You should see “Errors: none”

4.- Transmit and execute the helloworld.hex to the CM-5

( Here you can find more info )

Well, if you only want to test the executable, you can download only the hex.

When loaded you should see an screen with two equal values as a correct “Checksum” check (in this example the value is 81, it’s calculated from the source code). If the values are not equal there is an error in the transmission.

CM5HexLoaded

5.- Every time you press the red MODE button the servo should spin

Series Navigation<< Start programming CM-5/CM-510 in C (AVR microcontrollers)Bioloid CM-510 programming tutorial: First steps with C >>
%d bloggers like this: