Introduction: Simple Binary Converter and Display With DP32

Have a DP32 board and wondering if you could do it with something useful ?

: )

Here is an instruction that will show you how to turn it into a binary converter and display the results.

Step 1: Step 1: Getting Started.

You will need:

  • DP32 board X 1
  • ChipKit Programmer/Debugger X 1
  • USB A to Mini-B Cable X 1
  • Micro USB Cable X 1
  • Computer with USB ports and internet connection X 1

Step 2: Step 2: Installing the IDE

You will need some software in order to program on the board and make it work.

MPLAB X : http://bit.ly/1qqu0Xm (Windows version)

Arduino IDE: http://bit.ly/1RJFw6X (Windows Version)

here I only listed the windows versions.
You could find other versions from:

http://bit.ly/1R2xniM (Arduino)

http://bit.ly/1R2xniM (MPLAB X)

Step 3: Step 3: Install the ChipKit Core

  1. open this site: http://bit.ly/1SSEnyl ,
  2. click on the chipKit core as underlined in blue.
  3. scroll down that page until you see this link:https://github.com/chipKIT32/chipKIT-core/raw/master/package_chipkit_index.json, save it for later.

Step 4: Step 4: Setting Up Your Arduino Preferences

  1. Open your Arduino
  2. click on "File" → "Preferences" to open the setting page.
  3. Then paste the link you just saved to the field "Additional Boards Manager URLs".
  4. Then click on "OK"

Step 5: Step 5: Setting Up the Arduino Board

  1. Click on "Tools" →"Board ...."→ "Boards Manager..."
  2. then search chipkit in the pop up window, you will see result similar to the second picture.
  3. Then click on "install" in the red circle.
  4. Then go back to "Tools"→"Board..."→ This time scroll down and choose "chipKIT DP32".

Step 6: Step 6: Download the Bootloader

  1. Open this page: http://bit.ly/1ptXXWh
  2. then scroll down to the "Design Resources",
  3. then click on the "Download" beside the Bootloader.

You will get a zip file which contains a file named chipKIT_Bootloader_DP32.hex

save it for later.

Step 7: Step 7: Setting Up the MPLAB X

  1. Connect your Board and Debugger to your computer.
  2. Open your "MPLAB X"
  3. Click on "File" → "New Project..."
  4. then choose "Microchip embedded" → "Prebuilt (Hex, Loadable Image) Project"
  5. then "browse" to your bootloader file which just downloaded in the last step,
  6. and then choose your debugger in the "hardware tool" (It may varies from the picture I show).
  7. Click "next", then name the project and then click on "Finish".

and now your project is built.

Step 8: Step 8: Install the Bootloader

  • Find the icon in the red circle in your MPLAB X and then click on it.

Your output should look similar to the second picture, and the LED 1 on your board will flash.

  • If not, try previous steps again and check your board connections.

(IMPORTANT: every time when you try to write code to the DP32 board, you will have to flash the bootlader again.)

Step 9: Step 9: Compile and Upload Your Arduino Code

  1. Keep your board connected.
  2. Open your code with Arduino
  3. and then click on the "check" mark (red circled in 1st pic)
  4. If error occurs, rewrite your program.
  5. Then click on the "Upload" button (red circled in the 2nd pic)
  6. If the terminal says "No Target Found" (Green Box in the 3rd pic),
  7. go to "Tools" →"Port" and then try a different Port (as in the 4th pic, yours may vary).
  8. It should look like this if the upload is successful. (as in the last pic.)

Step 10: Step 10: Time to Have Fun

Here I posted my code for one approach.

It will work as below:

  • button 1 is used as the counter,and button 2 as the switch.
  • Button 1 will record the entered number no bigger than 15, and press button 2 for 3 times will show the presses on button 1 in binary as the represent of the LED.
  • Each time each button is pressed, there would be a single blink of an LED as the indicator.
  • If the presses exceed the maximum number, the presses will reset to 0, and one LED will blink for 5 times as the indicator.

I also post the demo running video for the testings in the following steps.

  • Since my button 1 seems have some issue contacting the board, it might not response sometimes when I press it, but it will eventually work.

Step 11: Step 11: Test My Code for Input 7

  1. press the Button 1 for 7 times
  2. press the Button 2 for 3 times
  3. the LED show "0111", which represents as LED 4 off, LED 1,2,3 on.

Step 12: Step 12: Test My Code for Input 15

  1. press the Button 1 for 15 times
  2. press the Button 2 for 3 times
  3. the LED show "1111", which represents as all LED on.

Step 13: Step 13: Test If Button 1 Input Exceeds Maximum.

  1. press the Button 1 for 16 times
  2. LED 4 flashes for 5 times indicate the input out of bounds.

Step 14: Step 14: Test Button 2 Exceeds Maximum

  1. press the Button 1 for 4 times
  2. press the Button 2 for 3 times
  3. LED show as "0100"
  4. press the Button 2 for one more time
  5. LED 4 flashes and indicate exceeding maximum input for Button 2.

Step 15: Step 15: Test Open Switch at Beginning, Display Every Single Input and Test Bounds for Both Buttons

  1. Press the Button 2 for 3 times at the beginning.
  2. Keep presses the Button 1 and the LED display changes as the presses increment.
  3. When Button 1 presses exceeds 15, LED 4 flashes indicate exceeding maximum.
  4. Presses Button 2 for one more time, which results 4 presses for Button 2, LED 4 flashes indicate exceeding maximum.