Download presentation
Presentation is loading. Please wait.
Published byJaime Cunnington Modified over 9 years ago
1
Software Design Considerations
2
Abstract Design and build a compact robot to traverse a maze Use the robot to generate an ASCII representation of the entire maze Mark light locations on map as they are discovered Revisit lights intelligently throughout the maze in a user-defined order
3
Software Design Considerations PIC18F4550 Microcontroller Interfaces General Purpose I/O A/D sensors PWM motor control Communication with compass via I2C Data transfer via USB “Flag”-driven Design Embedded C
4
General Purpose I/O 5 registers for general purpose I/O PORTx registers refer to pin TRISx registers: 0 – output 1 – input 3X Single-colored LEDs 1X RGB LED (3 pins) 2X Pushbuttons 4X Motor direction control
5
A/D Sensors 13 A/D Channels Conversion process Set channel to corresponding ANx pin Set GO_DONE bit to 1 Conversion complete when GO_DONE bit = 0 1X RGB Color Sensor (3 pins) 3X Short-range sensor 1X Long-range sensor
6
PWM PWM enable by setting bits 2 and 3 of the CCPxCON register CCP1 CCP2 Motor speed control Alter duty cycle to change speed
7
I2C / USB Communication between compass and microcontroller via I2C Data transfer to computer with USB Byte-by-byte transfer of data Data structure decoded by PC
8
Flowchart for Main Loop
9
Power On / User Input
11
Maze Mapping
13
typedef struct _mazeNode { /* bits 7-5: 000 = normal node 001 = red 010 = green 011 = blue bits 4-0: location from -10 to 10 */ char locX; // holds X location char locY; // holds Y location // holds the path description /* bits 7 & 6: 00 = nothing 01 = entrance 10 = return 11 = unused bits 5-0: index of the next node in mazeNode array */ char Npath; char Spath; char Epath; char Wpath; } mazeNode;
14
Tremaux’s Algorithm
15
[1] Tremaux’s Algorithm
16
Revisit Lights / USB Transfer
18
Hierarchical Block Diagram of Code Organization
19
References [1] David B Suits, “Playing With Mazes,” Rochester, NY, 1994
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.