The first project for this blog is a Wireless Rover using a Rabbit miniCore RCM5600W. For more information on the car itself see Puck’s Workbench. My primary tasks are:
- Write the low level driver code for developing the PWM signals which are used to drive the four H-bridges which drive the motors
- Design the H-bridge circuit.
The requirements for the software driver are:
- Use an ISR to create the PWM
- The period of the PWM pulse stream must be variable
- The duty cycle of each of the four pulse streams must be individually programmable
- The number of pulses for each motor must be individually programmable
- The direction of each motor must be individually programmable
The ISR I wrote does all of the above. The resolution I chose is 1 millisecond and is based on Timer B being driven by Timer A1. Timer B is set to divide by its full count of 1024. The value for Timer A1 is calculated based on the CPU clock frequency.
This file is the initial ISR and test code: Rover.c. (The file is saved as a .txt due to some browser/server problem with .C files.) The code is well documented and should be fairly easy to follow.
The software was written based on using the Toshiba TA7291S H-Bridge. The selection of this particular H-Bridge was quite pragmatic – I went to the Mouser web site and did a search for “H-bridge.” The 7291 was one of the first ones listed with a reasonable price. I looked up the specs on it and immediately saw that it was just what I was looking for
.