Assignment 5
Program Design/Layout
Due Tuesday, Feb13 in class
Spend some time together with your group designing the software that will produce a winning Natcar! Determine what major functional software blocks you will have and how they will communicate. Make timing diagrams to figure out how often you need to be doing/calculating various things related to controlling your car. Come up with a design that will allow you to start with a very simple program and then add complexity without total restructuring of the code. Use whatever combination of flowcharts, pseudocode, and timing diagrams you need to figure out how everything will interact.
Microcontroller features you'll need to understand:
1) A/D converter - What do you need to do to convert your analog sensor signals to digital values you can manipulate in code? How fast will you be updating these values.
2) PWM generator - What PWM signals do you want to generate and how are you going to schedule the calculation/updating of them?
3) Real Time Interrupts - We haven't covered this yet, but it is a good feature to know about. You can set up some registers on the HC11 or HC12 to give you an interrupt at fixed intervals (ie: every 4.1 ms). You can then implement a interrupt service routine (just a function that is called on every interrupt) to execute a particular chunk of code at these regular intervals. This can be useful for any algorithms that utilize time in the calculations - such as a derivative term in the control algorithm (ie: how fast the car is approaching the line can affect the steering angle).
4) Pulse Accumulator - Another feature we haven't discussed (but you can certainly read about) is the pulse accumulator on the HC11 or HC12. You can wire this up to count external pulses, which is a convenient way to measure speed of the vehicle (with a slotted disk on the motor/axle and some photo LEDs and sensors). For desiging your code all you need to know is that there is a register somewhere that once initialized, can count pulses, be read and reset.