Close

A step through of Palm Power’s program.

A project log for Palm Power!

Control a robot with the twist of a wrist.

dennisDennis 08/25/2018 at 19:240 Comments

Palm Power’s program was written in “C” with MPLAB X IDE v3.05. The compiler was XC16. I love Micro-chip’s stuff.  It’s a nice development environment. Below is the beginning of the program. A typical start with the necessary libraries, registers being defined and functions.

Next, the chip is set up, then “MAIN” sets up the ports and calls the subroutines for UART setup and the analog to digital setup. After the setups are complete, the program settles into a loop that continuously pauses 100ms, calls the analog to digital converter and checks to see if any new data has been received from the UART receive interrupt.

Leaving the “MAIN”, we see the subroutines.  Below is the UART receiving decoder that is looking for the magic word “send”.  When it detects “send”, the sub “send_string” is called.  Send_string sends the present potentiometer values detected by the A to D converter and the present value of the three switches through the Bluetooth to the robot.

The next few pictures are the UART and analog to digital sections covered in earlier updates.

The complete program is available in the repository.

Discussions