Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
ECE 477 Digital Systems Senior Design Project Spring 2008 Homework 9: Software Design Considerations Due: Friday, March 21, at NOON Team Code Name: _RoboRubik_________________________________ Group No. __11__ Team Member Completing This Homework: _Tyler Heck___________ e-mail Address of Team Member: _theck @ purdue.edu____________ Evaluation: SCORE DESCRIPTION Excellent – among the best papers submitted for this assignment. Very few corrections needed for version submitted in Final Report. Very good – all requirements aptly met. Minor additions/corrections needed for 9 version submitted in Final Report. Good – all requirements considered and addressed. Several noteworthy 8 additions/corrections needed for version submitted in Final Report. Average – all requirements basically met, but some revisions in content should 7 be made for the version submitted in the Final Report. Marginal – all requirements met at a nominal level. Significant revisions in 6 content should be made for the version submitted in the Final Report. Below the passing threshold – major revisions required to meet report * requirements at a nominal level. Revise and resubmit. * Resubmissions are due within one week of the date of return, and will be awarded a score of “6” provided all report requirements have been met at a nominal level. 10 Comments: Comments from the grader will be inserted here. ECE 477 Digital Systems Senior Design Project Spring 2008 1.0 Introduction RoboRubik is a self-contained Rubik’s Cube solver consisting of a microprocessorcontrolled PCB with multi-colored LEDs under each cube face. A user interface is used to input the current state of the cube via an embedded web server. The microcontroller contains a stored algorithm to calculate the moves required to solve a Rubik's Cube from any valid starting position. The cube has two different modes of operation. Help mode allows the user to follow the steps leading to the solution with RoboRubik acting as a visual aid. Play mode gives the user the ability to solve the RoboRubik cube manually using buttons located on each cube face. The overall software design focuses on the ability of the microcontroller to receive the initial cube configuration or “state” from the user interface, output this cube state to the LEDs, determine the steps leading to a solved cube state, and change the cube configuration based on pushbutton presses subject to the mode of operation. The details of the software considerations and the software design flow are discussed in the remainder of this report. 2.0 Software Design Considerations The software design of the RoboRubik project begins with the user interface. The graphical user interface, GUI, used for the user to input the configuration of the unsolved cube is run on an external computer. The initial configuration of the cube is transmitted wirelessly from the external computer to RoboRubik via an internal Lantronix WiPort wireless network device [1]. The user interface has no use after sending the initial cube configuration to RoboRubik. Once the cube configuration is received by the microcontroller from the user interface, the configuration is output to the LEDs and the solving algorithm stored on the microcontroller calculates the moves required to reach the solved cube state. The microcontroller then waits for a pushbutton press to change the state of the cube depending on the mode of operation. In the Help mode, the microcontroller will walk through the determined solution in a step-by-step fashion upon a pushbutton press. In the Play mode, the cube configuration will be changed by the microcontroller based on individual pushbutton presses. A single press represents a 90° clock-wise “rotation” of the cube face corresponding to the pushbutton located on that face. It is important to note the cube does not physically rotate. Instead the LED configuration changes to visually represent a face rotation. -1- ECE 477 Digital Systems Senior Design Project Spring 2008 The overall organization of application code represents a hybrid of both program-driven and interrupt-driven modes. While RoboRubik is waiting for the initial cube state from the user interface, the application code utilizes a polled program-driven organization style. The microcontroller waits for the data from the user interface by constantly polling the wireless network device. Once the data is received, the solution determined, and the cube configuration output to the LEDs, the microcontroller enters the interrupt-driven mode. Until a signal to change the cube state is sent to the microcontroller via a pushbutton, the present configuration is sent to the LEDs. The pushbutton press fires an interrupt causing the cube state to change to either the next step in the solution or by “rotating” a face of the cube in the Help or Play mode, respectively. It was decided to implement the command-driven or hybrid application code organization since it was preferred to use both the program-driven and interrupt-driven code organization styles. The polling program-driven application code organization was chosen while the cube is waiting for the initial configuration from the user interface since the wireless network device is the only device being polled requiring a small polling loop and small latency. The interruptdriven organization style was selected to be used during the process of changing the cube configuration since the microcontroller will be constantly sending the configuration status to the LEDs at the moment a pushbutton is pressed. This will require the microcontroller to interrupt the current LED output configuration and change the state of the LEDs based on the mode of operation. There are three main data blocks stored in the microcontroller memory. The first of which is a lookup table for the LEDs representing a transition diagram. Secondly, the solving algorithm will be saved in memory. Also, the list steps produced by the solving algorithm will be saved. The explicit memory locations of this data have yet to be determined mainly due to the lack of a finalized solving algorithm. Since the microcontroller selected for RoboRubik has 128KB Flash and 4KB RAM, it has been determined the amount of memory is sufficient for the application at hand [2]. 3.0 Software Design Narrative There are four major blocks in the hierarchical arrangement of the RoboRubik code modules; user interface, main program, configuration output, and pushbutton interrupt. The user -2- ECE 477 Digital Systems Senior Design Project Spring 2008 interface communicates with the cube via RoboRubik’s internal wireless network device as mentioned above. The wireless network device connects to the microcontroller serially through the microcontroller’s SPI interface module [2]. The main program stored on the microcontroller sits in a polling state until receiving the initial configuration data from the user interface at which point it switches to an interrupt-driven mode of operation. In this interrupt-driven mode, the configuration output displays the cube state via LEDs using the PWM module of the microcontroller [2]. While the cube state is displayed, the main program is interrupted at the press of a pushbutton causing the state of the cube to be changed according to the mode of operation and the specific pushbutton pressed. The graphical user interface allowing the user to input the initial cube state has been completed. The wireless network device has been tested and shown to successful send and receive data in a stand-alone fashion. The device has yet to be combined with the microcontroller to receive information from an external computer wirelessly. The microcontroller has been programmed to continuously strobe LEDs. The RGB LEDs used by the design have yet to be integrated into the microcontroller strobing program to allow for multiple color displays [3]. A simple program using a pushbutton to change the configuration of LEDs has also been successfully tested using single-color LEDs. The algorithm used to “rotate” the cube has not been fully realized. Additional features requiring further software design have been suggested for implementation, but have not been tested or outlined. Some of these features include multiple buttons presses corresponding to on/off switch, change of mode, and return to initial cube state. Also, the idea of displaying the solution status, the number of steps left to solve the cube, on the user interface has been discussed. These extra aspects are in the preliminary design stages and will be integrated once the core software design is completed and successfully tested. 4.0 Summary The software design of RoboRubik consists of the above mentioned considerations and narrative. The two main organization aspects of the software design correspond to the receiving of the initial cube state and the altering of the current state. While receiving the initial state, the main program runs in a program-driven fashion. The main program operates as an interruptdriven organization mode during the changing of the current state. -3- ECE 477 Digital Systems Senior Design Project Spring 2008 List of References [1] Lantronix WiPort Wireless Network Device Data Sheet, [Online document], 2006 Mar, (Rev. 1.0), [cited 2008 Mar 20], Available HTTP: http://cobweb.ecn.purdue.edu/~477grp11/files/datasheets/WiPort_Data_Sheet.pdf [2] Freescale MC9S12C128 Data Sheet, [Online document], 2004 Oct 27, (Rev. 01.10), [cited 2008 Mar 20], Available HTTP: http://cobweb.ecn.purdue.edu/~477grp11/files/datasheets/Microcontroller%20MC9S12C12 8%20-%20Freescale.pdf [3] TT Electronics OVSRRGBCC3 LED Data Sheet, [Online document], 2007 Nov, [cited 2008 Mar 20], Available HTTP: http://cobweb.ecn.purdue.edu/~477grp11/files/datasheets/LED%20%20TT%20Electronics%20OVSRRGBCC3.pdf -4- ECE 477 Digital Systems Senior Design Project Appendix A: Flowchart/Pseudo-code for Main Program Initialization Receive Initial Configuration Display Cube Configuration Calculate Solution Mode of Operation Help Mode Play Mode Cube “Solved” Figure A.1: Flowchart for Main Program -5- Spring 2008 ECE 477 Digital Systems Senior Design Project Help Mode Pushbutton Press Step Through Solution No Display Cube Configuration Cube Solved? Yes Cube “Solved” Figure A.2: Flowchart for Help Mode Play Mode Pushbutton Press “Rotate” Face Display Cube Configuration Figure A.3: Flowchart for Play Mode -6- Spring 2008 ECE 477 Digital Systems Senior Design Project Appendix B: Hierarchical Block Diagram of Code Organization User Interface Main Program Configuration Output Pushbutton Interrupt Figure B.1: Block Diagram of Code Organization -7- Spring 2008