Compiling and Running code using Propeller Tool

A few people have asked me to explain how to go about building the POV code and getting it running on their badge. I decided to make a quick walk through explaining the steps.

What you need:

You’ll first need to go and download the Propeller Tool from the link above. Install it and run it, you will see a screen similar to this.

You will see that it automatically opens up a new file and names it ‘Untitled’ this is an empty .spin file where you actually write your code. There are several simple tutorials online that show you how to do the ‘hello world’ style first program, and other things to get you going. Many can be found here.

For now we will just load the POV app and load it onto the badge. Go grab the source code from The best way is to just copy and paste the raw code from the bottom of the page directly into the Propeller Tool. It should look like this.

Once you have the code in the tool feel free to save the file (File->Save). This will allow you to name it something.spin so you can load it up easily next time.

You now have to decide if you want the code to be temporarily on the badge, or permanent. Those are the only two options.

  1. RAM only: This will compile the code and load it into the device ram, once the device is reset, the ram will be cleared, and the code will be gone. If you decide to do it this way you will probably want to remove the ‘600’ from the ‘repeat 600’ line in the ‘PUB main’ function. Other wise it will only seem to work for a couple minutes and then stop.
  2. EEPROM only: This will compile the code and load it into the device EEPROM. This will allow you to reset, remove the batteries, and do just about anything without erasing the code. If you do this, you will erase the original Defcon 20 game that was on the badge. There are ways of recovering it, so don’t worry that you broke your badge.

Once you decide which one you want to do, go to Run->Compile Current->Load RAM (F10) or Run->Compile Current->Load EEPROM (F11). This will compile and load the software on your badge.

Your badge should now be running the new code. In the ‘PUB main’ section I included a couple different patterns for drawing. You can comment out the DEFCONXX line by putting a ‘ in front of it, and uncomment one of the other lines.

I’m currently working on making it more stable when drawing using an accelerometer, but I’m still waiting for it to arrive in the mail. If you modify the code, I’d love to see what else people get it to do.

Hope this helps.


7 responses to “Compiling and Running code using Propeller Tool

  1. Thanks, this is awesome.

    I am noticing something strange. When I disconnect the badge from my laptop, it seems that the badge changes behaviors. It blinks for 2 secs or so, then pause for 5-6, then runs the POV for 15 secs, than stops. I tried a few other programs (binky lights) and they do not do this. I have the repeat set for infinity. Do you know why this is happening? Showing the “new secret message” to the minions is goofy with the USB cable attached. I cannot see anything in the code.

    Do you see this too? I changed the batteries (thinking maybe the clock function is goofy under lesser voltage).

    • Are you loading into ram or eeprom? If you are loading into ram, once you unplug the cable, i think that is considered a reset and it will go back to running whatever is in the eeprom. I believe the 5-6 second delay is when the program is loading in the letter maps into memory. Moving them to a DAT section might make that a lot faster.

  2. Pingback: DEF CON 20 badge information « Mick's Mix

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s