EE 477 Final Report
ECE 477 Final Report ( Spring 2008
Team 11 ( RoboRubik
[pic]
Team Members:
#1: ___Erik Carron_______________ Signature: ____________________ Date: _4/28/08_
#2: ___Dave Bukiet_______________ Signature: ____________________ Date: _4/28/08_
#3: ___Tyler Heck________________ Signature: ____________________ Date: _4/28/08_
#4: ___Casey Kloiber______________ Signature: ____________________ Date: _4/28/08_
|CRITERION |SCORE |MPY |PTS |
|Technical content |0 1 2 3 4 5 6 7 8 9 10 |3 | |
|Design documentation |0 1 2 3 4 5 6 7 8 9 10 |3 | |
|Technical writing style |0 1 2 3 4 5 6 7 8 9 10 |2 | |
|Contributions |0 1 2 3 4 5 6 7 8 9 10 |1 | |
|Editing |0 1 2 3 4 5 6 7 8 9 10 |1 | |
|Comments: |TOTAL | |
| |
TABLE OF CONTENTS
|Abstract |1 |
| 1.0 Project Overview and Block Diagram |1 |
| 2.0 Team Success Criteria and Fulfillment |2 |
| 3.0 Constraint Analysis and Component Selection |3 |
| 4.0 Patent Liability Analysis |8 |
| 5.0 Reliability and Safety Analysis |10 |
| 6.0 Ethical and Environmental Impact Analysis |12 |
| 7.0 Packaging Design Considerations |16 |
| 8.0 Schematic Design Considerations |18 |
| 9.0 PCB Layout Design Considerations |22 |
|10.0 Software Design Considerations |24 |
|11.0 Version 2 Changes |27 |
|12.0 Summary and Conclusions |27 |
|13.0 References |28 |
|Appendix A: Individual Contributions |A-1 |
|Appendix B: Packaging |B-1 |
|Appendix C: Schematic |C-1 |
|Appendix D: PCB Layout Top and Bottom Copper |D-1 |
|Appendix E: Parts List Spreadsheet |E-1 |
|Appendix F: Software Listing |F-1 |
|Appendix G: FMECA Worksheet |G-1 |
Abstract
The following information in this report will describe the design process leading up to the completion of the RoboRubik project. RoboRubik is a Rubik’s Cube solver with the ability to play in the same way as a traditional Rubik’s Cube and also give hints to the solution to a scrambled cube. The details of all design considerations of the RoboRubik project are discussed in the remainder of this document.
1.0 Project Overview and Block Diagram
RoboRubik is a self-contained Rubik’s Cube solver consisting of a microprocessor-controlled 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. A stored algorithm calculates the moves required to solve a Rubik’s Cube from any valid starting position. The cube has two different mode 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. RoboRubik is shown in Figure 1-1 and a block diagram of the RoboRubik design is shown in Figure 1-2 below.
[pic]
Figure 1-1: RoboRubik Project
[pic]
Figure 1-2: Block Diagram
2.0 Team Success Criteria and Fulfillment
Below is the list of the team success criteria approved by the course staff. All five project-specific success criteria were successfully demonstrated.
An ability to:
• control the device state/configuration via an embedded web page
The wireless network device inside RoboRubik has a Java applet stored in memory which allows the user to configure a Rubik’s cube to an initial state.
• display “state” of cube via a series of integrated (multi-color) LEDs
Each cube face of RoboRubik has eight RGB LEDs allowing the device to display the colors white, blue, red, green, yellow, and magenta by different RGB combinations.
• change the “state” of the cube via a pushbutton on each face
The pushbutton located in the center of each cube face of RoboRubik performs a single 90º rotation of the corresponding face of the pushbutton being pressed.
• autonomously solve the cube from arbitrary (user defined) initial state
When the user switches to Help mode in the user interface, the solving algorithm stored on the wireless network device calculates the moves needed to change RoboRubik into the solved cube state.
• provide “hints” when solving the cube in “manual” mode
Pressing the Step button located on the user interface while in Help mode shows the user the next step leading to a solved cube.
3.0 Constraint Analysis and Component Selection
Since the intention of the RoboRubik is to replicate a Rubik’s Cube in digital form, the dimensions of RoboRubik are as close to an official Rubik’s Cube as possible. Therefore, the size of RoboRubik’s packaging is a major design constraint. Due to the aim of constructing a self-contained project, RoboRubik requires batteries for its source of power. Thus, power consumption is also considered a major constraint. The final limitation is the on-chip memory of the microcontroller since a stored program is used to calculate the moves required to solve the cube. The design constraints of the RoboRubik project are discussed in detail in the remainder of this section.
1. Computation Requirements
During initialization of the cube state, RoboRubik receives the information input by the user from the user interface on a separate device. Once the data is received, the state of the cube is represented on the cube via multicolored LEDs. The stored solving program is used to compute the moves required to solve the cube. These moves are then saved to memory. In both Help and Play modes, the user rotates each face by pressing the pushbutton on that respective cube face. This causing the LEDs to change colors illustrating a rotation of the cube face, but the cube does not physically rotate. In Help mode, the user steps through the stored solution by pressing one of the face pushbuttons. In Play mode, the user manually solves the cube. Rotation of a single face is accomplished by pressing the pushbutton on the respective face. The speed of microcontrollers is more than sufficient for the application of pushbutton sensors, LED updates, and other computations. Therefore, speed will not be a limiting design factor.
2. Interface Requirements
A user interface is used to input the initial state of the cube. A GUI Java applet is stored on the wireless network device inside of RoboRubik and is accessed on an external computer for the user to input the color of each of the cubes on each face. The data received by the wireless device is then passed on to the microcontroller. The wireless network device communicates with the microcontroller through the microcontroller’s on-chip serial interface [1]. The wireless device runs at a 3.3V input requiring a DC-DC converter to step down from the 6V battery source [2]. Also, an additional DC-DC converter is required to decrease the input source voltage to 3.3V in order to power the microcontroller [1].
Pushbuttons located on each cube face instruct the microcontroller to perform tasks determined by the mode of operation. The cube state is represented via LEDs under the cube face. Each face contains eight LEDs and one pushbutton. Therefore, a total of forty-eight LEDs and six pushbuttons are required. All of the LEDs on a single face are controlled by a 16-bit LED driver IC. Each IC is capable of controlling sixteen LEDs [3]. A serial interface with the ICs is used to input and output data. Three separate LEDs are integrated to form each multicolored LED. Thus, two LED driver ICs are required to control the LEDs of each cube face.
3. On-Chip Peripheral Requirements
The Serial Communications Interface module of the microcontroller is used to communicate with the internal wireless device of the cube. The wireless device requires a single channel of serial I/O to interact with the microcontroller [5]. The Pulse-Width Modulation peripheral is used to strobe the LEDs and output the state of the cube via the LED driver ICs. The microcontroller’s Timer module samples the pushbuttons regularly to determine when they are pressed.
4. Off-Chip Peripheral Requirements
The 3.3V power source input of the wireless device and microcontroller require DC-DC converters [5,1]. The LEDs on each cube face are controlled by LED driver ICs using a serial interface with the microcontroller.
5. Power Constraints
Since the RoboRubik is a battery powered device, power consumption was taken into serious consideration while designing. The large number of LEDs left two options for controlling the output of the cube state. While the microcontroller is capable of operating all the LEDs, the amount of output pins would require a much larger and more powerful microcontroller than needed for this application. To achieve every color, 20mA of current is required [4]. Therefore, the second option of using off-chip ICs was accepted. Utilizing the PWM, Pulse-Width Modulation, peripheral of the microcontroller allows RoboRubik to strobe the LEDs. Strobing the LEDs reduces the amount of time each LED is on decreasing the amount of current drawn while remaining unnoticeable to the naked eye. With the LEDs remaining constantly on, the entire circuit draws approximately 900mA of current. Strobing the LEDs with a 50% PWM duty cycle reduces the current drawn to around 600mA, a reduction of approximately 33%. The Energizer 2CR5 lithium/manganese dioxide battery produces a maximum continuous discharge of 1500mA hours [22]. The DC-DC converter used to drop the supply voltage from 6V to 3.3V is the only component dissipated an excessive amount of heat. Therefore, heat dissipation was considered due to the small size of the RoboRubik, but it was deemed a minor concern.
6. Packaging Constraints
Each side of a Rubik’s Cube measures approximately 5.7cm across [6]. Due to the minimum size of some major components, the size of each side of the cube container must be increased to 9cm, approximately 3.5”, for the RoboRubik design. Since the design is intended to be a handheld/tabletop device, the packaging must withstand minor turbulence. Surrounding the internal PCB structure of RoboRubik are thin cotton sheets acting as light diffusing filters as well as a cushioning between the circuitry and RoboRubik’s external plexiglass shell. Silicone sealant connects the six plexiglass segments together completing exterior of RoboRubik.
7. Cost Constraints
The RoboRubik is intended for entertainment and educational purposes. The Rubik’s Cube is the major competitor of RoboRubik to be considered. With a MSRP of $11.99, the Rubik’s Cube is much cheaper than the RoboRubik [6]. However, the additional functionality of multiple modes and the digital aspect of RoboRubik make it more like a simple gaming system. Nearly all prices of the components listed for RoboRubik are the result of a small order size. Considering the reduction in cost of mass production, the overall price of RoboRubik would decrease drastically to an estimated $190. This would make a simple educational gaming system such as RoboRubik much more appealing to a family than one of the current gaming systems which are much less educational and more expensive.
8. Component Selection Rationale
One of the major components considered was the wireless network device. The two devices compared were the WiPort and MatchPort by Lantronix [7]. The purpose of the wireless device is to communicate with the external user interface and the microcontroller. The two major features differentiating the two devices are size and power consumption. The physical dimensions of the WiPort and MatchPort are very similar [7]. However, the MatchPort requires an additional antenna to be connected to the device for wireless transmission and reception. The inactive power consumption of the devices is comparable [7]. While the active power consumption of the WiPort is nearly twice that of the MatchPort, it was assigned a smaller weight in terms of comparison since the amount of time the wireless device will be active in the RoboRubik is small compared to the inactive state. Therefore, the deciding factor in the decision to choose the WiPort was the size of the device. A comparison of the design constraint features of the WiPort and MatchPort is shown in Table 3-1 below.
|Part |Size (mm) |Range (ft) |Power (mW) |Memory (KB) |
| WiPort |33.9 x 32.5 x 10.5 |328 indoors |750 active |2000 Flash |
| | | |300 inactive |256 RAM |
| MatchPort |45 x 45 x 10.4 * |328 indoors |740 active |2000 Flash |
| | | |250 inactive |256 RAM |
| * Requires additional attachment (antenna) |
Table 3-1: Wireless Network Device Comparison
The other major component selected was the microcontroller. The two microcontrollers considered were the MC9S12C32 and the MC9S12C128 by Freescale. The major difference taken into consideration between these two microcontrollers is the size of on-chip memory. The solving algorithm which calculates the solution to a Rubik’s Cube puzzle requires an extremely large amount of code and thus a large amount of memory. The C32 has 32KB of on-chip Flash and 2KB of RAM while the C128 has 128KB Flash and 4KB RAM [1,8]. Another difference between these two microcontrollers is the price. The C128 is nearly triple the price of the C32 even when the items are purchased in bulk [1,8]. While the price difference points toward the C32, the C128 was chosen as the microcontroller for RoboRubik due to its greater memory capacity. A comparison of the design constraint features of these two microcontrollers and an additional similar microcontroller is shown in Table 3-2 below
|Part |Size (pins) |I/O (pins) |Power (mW) |Memory (KB) |
| 9S12C32 |48 LQFP |60 |82.5 |32 Flash |
| | | | |2 RAM |
| 9S12C64 |48 LQFP |60 |82.5 |64 Flash |
| | | | |4 RAM |
| 9S12C128 |48 LQFP |60 |82.5 |128 Flash |
| | | | |4 RAM |
Table 3-2: Microcontroller Comparison
9. Summary
The major constraints of size, power consumption, and on-chip memory were taken into consideration while choosing the components for the RoboRubik project design. The limiting factor in the size constraint category was the wireless network device. The WiPort by Lantronix was chosen due to its lack of additional components required. In the case of the power consumption constraint, some sacrifices had to be made in order accommodate for other design constraints which were not able to be compromised. The microcontroller chosen has more than a sufficient amount of memory required to store the data necessary for the project. A complete parts list is included in Table E-1 of Appendix E.
4.0 Patent Liability Analysis
The RoboRubik project is one in which the Rubik’s Cube logic puzzle is replicated without the moving parts but instead implemented with LEDs. RoboRubik has a user interface such that a player may make all the same moves one could make on a regular Rubik’s Cube, but RoboRubik has an additional feature to be able to solve any provided initial state of the cube. The main purpose of this section is to provide information regarding any patent liability to be taken under consideration when completing this product. The original patent filed by Erno Rubik for his cube was in 1983. So worry about infringing on this patent can be minimized due to the fact that this patent has expired some time ago. There are many products on the market today that utilize the logic puzzle that Rubik did and there were a few patents that have slightly similar qualities to the RoboRubik project. Even though this is true, the possibility for liability, even among all these patents was found to be very slim.
4.1 Results of Patent and Product Search
In doing research on patents and products for which the RoboRubik might infringe on, it became clear that the products currently on the market and the patents going through the reviewing process made no direct claim to the puzzle game implemented in the Rubik’s cube. Every product or patent was a way of marketing a specific version of the game or a new and inventive game based on the same principles of the game. Take for example patent number 6,974,130 [9] filed on December 13, 2005 called “Manipulable puzzle cube.” The abstract describes it as “an improvement of the classic Rubik’s Cube,” where the goal is to create pictures on the sides instead of return it to its original configuration. Their claims include the fact that their cube is 3x3x3 in size, but it’s hard to infringe on what is known in the geometric world as a “cube.” Another patent, number 5,310,183 [10] filed on May 10, 1994, is called “Transparent cube puzzle.” This patent’s abstract defines this product as in the most basic sense a see-through version of the puzzle game of Rubik’s Cube. The argument being that users enjoy variety, the clear sides provide a new entertaining way to enjoy an old puzzle game. The claims of this product are very specific and include that the size sides must have specific indentations in them, so the fact that our sides are made of a clear plexi-glass to see to the LED’s won’t be infringing on this patent if the specific indentations are absent. Patent number 5,651,715 [11] filed on July 29, 1997, is yet another implementation of the Rubik’s cube but with another twist. According to the abstract, the polygonal sections are held together by elastic rather than the typical axes. This patent is not being presented as a liability threat so much as another sample of the large amount of products implementing Rubik’s Cube uniquely and acquiring patents in the process.
4.2 Analysis of Patent Liability
In all of the aforementioned patents, there were similarities across the board. For all of these patents to be allowed to exist, their implementations needed to be different. The concept of spatial logic puzzles is not a new one, but the RoboRubik idea is completely revolutionary and inventive. None of the patents that could be found during research implemented a Rubik’s cube using only LEDs to represent the colored sides. In addition, every implementation of a logic puzzle that could be found involved rotational parts about an axis where RoboRubik requires no moving parts to partake in the game. The simple action of a button press causes our project to spring to life and “rotate” the sides in a manner identical to the original Rubik’s Cube. There may be some trademark infringement with including the name “Rubik,” but for our reinvention of a classic game, patent liability is nearly non-existent.
4.3 Action Recommended
Despite the assertions made that there is a negligible chance of patent liability, this doesn’t mean action is not in order. Of course there could have been oversights and specific patents relating to RoboRubik could have been missed and also there is the chance of someone with a pending patent identical to RoboRubik that has been recently filed. In any case, research on the subject must be continued to insure that patent liability will remain at the level this research has shown.
4.4 Summary
The information provided in this section concludes the RoboRubik currently needs no revision in its current state to attempt to avoid patent infringement. Many versions of Rubik’s Cube are on the market but they avoid infringement through unique implementations. The implementation of the cube through the use of software and LEDs without moving parts is extremely unique to the current field of patents available. Research must be continued to assure no patents arise during production of the RoboRubik.
5.0 Reliability and Safety Analysis
Since RoboRubik is basically a toy, there are very little high criticality concerns with it. The only possible way the user can be harmed from the RoboRubik is by the brightness of the LEDs and a possible battery acid leakage. Both are very unlikely to happen, but possible. For reliability, there are very little major components that can fail. These components do not work at a high temperature which makes them less likely to fail. The components that will be investigated are the microcontroller, the WiPort, the voltage regulator, and the LED drivers.
5.1 Reliability Analysis
For the reliability analysis, the components investigated were the microcontroller, the WiPort, the voltage regulator, and the LED driver. All these components play a major role in the functionality of the RoboRubik and they all operate at a temperature above room temperature. The MIL-HDBK-217F military handbook was used to calculate the reliability of each of these components. The coefficients selected and the reliability values are shown in Table 5-1.
|Reliability Calculations |
|Component |
Table 5-1: Reliability Coefficients and Calculations
As you can see, the microprocessor and the WiPort are the most vulnerable. They both have about 2.7 years between failures for every one million products. The other two have about 13 years between failures. This is acceptable for the RoboRubik because there is pretty much no high criticality. There were several assumptions made when calculating these values. The first was that all these products have been in production for over two years. Another was that each device had a worst case scenario of having an operating temperature of 85˚C. The Environment Factor was not exactly known so the average of 5 was used. The Quality Factor was also not exactly known and neither was the class the components fell into so a value of 1 was used. As far as the complexity of the components, the microprocessor used the 16-bit value. The WiPort used the 30,000 to 60,000 MOS logic array. The Voltage Regulator used the 1 to 100 bipolar linear gates. The LED driver used the 101-1000 MOS logic array. The package failure rate was calculated with the nonhermetic package and the number of pins for each component. An easy way to improve these reliability factors is to decrease the operating temperatures. The temperatures are proportional to the amount of current each component draws so by decreasing the current, the temperature goes down. This can be done by efficiently strobing the LED drivers. Another way to improve operating temperature is by making sure the cube has enough air circulation to dissipate heat.
5.2 Failure Mode, Effect, and Criticality Analysis (FMECA)
There are very little high criticality failures for the RoboRubik. As mentioned before the only possibility to harm the user is by the LEDs being too bright and the battery leaking acid. There are many possibilities for low criticality failures such as anyone the major components failing. The two criticality levels are defined in Table 5-2.
|Criticality |Failure Effect |Max Probability |
|L1 |Eye damage or acid burns |λ < 10-9 |
|L2 |Partial or no functionality |λ < 10-6 |
Table 5-2: Criticality Levels
There are four functional blocks investigated for failure. They are the microcontroller block, the WiPort block, the voltage regulator block, and the LED driver block. The schematics of these blocks can be viewed in appendix A. The FMECA worksheet can be viewed in Appendix B.
5.3 Summary
The RoboRubik has a high reliability rate for being a toy. There is very little possibility to harm the user, but possibility to unsatisfy the user due to functionality failure. The components that can cause the L2 criticality level were within the specific failure rate of λ < 10-6. The components that can cause the L1 criticality level were not within the specific failure rate of
λ < 10-9 , but they were close.
6.0 Ethical and Environmental Impact Analysis
Being a toy, RoboRubik has been designed to be as safe as possible and including RoHs compliant components as well as cutting down on power consumption were two major considerations during the design process. The main ethical issue in any product is that the device does not or will not cause any harm to the user. RoboRubik is not a dangerous device but if it malfunctions, it could pose a danger to the user. These issues were kept in mind during the design of RoboRubik. The environmental impact of RoboRubik is most noticeable when looking at the number of printed circuit boards being used. With seven in total, all these boards require the use of hazardous chemicals in order to produce them and these chemicals must be disposed of properly. RoboRubik must also not cause undue harm to the environment once its lifecycle has ended. This is addressed as well.
6.1 Ethical Impact Analysis
As mentioned above, RoboRubik was designed to be as safe as possible. The main pieces of the design are our PCBs, which will be covered by a sheet of plexi-glass and pieces of paper to help filter and spread the light, and our electronic components which are all attached to the PCB. There are two possible ethical problems that could arise and both of them relate to the safety of the user. In its normal usage, RoboRubik is very safe and poses no threat. However, it some part of the design was to malfunction then a danger could come about. First, the LEDs being used are incredibly powerful and can be hard to look at if running at full power. On the specification sheet for the LEDs it has a warning not to look directly at them, saying “Do not look directly at LED without unshielded eyes or damage to retina may occur” [13]. During normal operation the LEDs will not be running at full tilt so there will not be a danger for retina damage, but a warning label will be included, cautioning the user as to the possible danger. Strenuous testing will also be done during the development phase to ensure that the LEDs operate at a level that is not damaging to the eye but is bright enough so the user can distinguish its color.
The second ethical concern is that of the batteries being used to power RoboRubik. Nothing is inherently dangerous about these batteries, but the danger of the power circuitry shorting is present in any electrical device. In RoboRubik, if a short occurs and no power is being dissipated then the batteries could rupture. They are lithium / manganese batteries and contain hazardous chemicals like corrosive acids that could damage the user. With proper testing, any possible problems can be identified and resolved before the product reaches the market. Many of these lithium batteries contain fail-safe devices in them and can shut off the circuit if any problems occur. As a precaution, a warning label is put in the documentation stating the possibility of rupturing batteries.
There is another ethical concern that does not involve possible injury to the user and that is if one of the hardware components fails or a bug is discovered in the code. The software concern will hopefully be addressed during the development of RoboRubik and it will be produced without any significant bugs. RoboRubik should be of good quality and last a long time and the best way to ensure that is to choose components with a long lifespan and to test the product thoroughly before it’s sold.
6.2 Environmental Impact Analysis
There are three main phases to the lifecycle of any product: the manufacturing stage, the normal-use stage, and the disposal/recycling stage. The main components being discussed in this section will be the printed circuit boards, the lithium/manganese batteries and the hardware components.
6.2.1 Manufacturing Phase
RoboRubik uses a total of seven printed circuit boards in its design, each one 3.4” x 3.4”. These boards are not very large but with seven of them for each RoboRubik, the manufacturing of these will definitely have an environmental impact. Any PCB created is going to contain a small amount of lead along with other materials that are not good for the environment [15]. The Restriction of Hazardous Substance Directive has stated that manufacturers must make efforts to reduce six prominent chemicals in their printed circuit boards, lead being one of these [16]. During the manufacturing process a number of steps produce pollutants. After drilling, the PCB is scrubbed to extraneous copper particles which are typically lost with the waste water. Near the end of the process the PCB is etched to reveal the circuit pattern using an ammonia-based solution. This is another pollutant that should be reduced.
It is always a good decision to choose a manufacturer that is environmentally conscience and one that will strive to cut down on the hazardous materials used and disposed of during production. Methods such as installing a water-chiller that re-circulates and reuses the chemical bath water in PCB production can cut down on the hazardous chemicals released into local water sources [15]. Another thing that can be done in the concentration of chemical baths can be reduced to only what is absolutely necessary for production. The copper particles lost after drilling can be reclaimed and used in another batch of PCBs. Inefficiency and laziness are not excuses for using processes that damage the environment.
As stated above, the batteries used in RoboRubik are lithium/manganese. These batteries are widely used in electronics, have a long life and are very reliable. They are not rechargeable but can be disposed of safely into a landfill. The hardware components chosen were all RoHs compliant are not harmful to the user.
6.2.2 Normal Use Phase
The main environmental concern of the normal-use phase is use of non-rechargeable batteries. The batteries can be disposed of in a landfill once they are fully discharged but it is ideal to cut down on how often the user must get new batteries. The best way to reduce the power consumption of RoboRubik is to reduce the current sourced through the LEDs. With 48 total, a lot of current is going to be drawn so RoboRubik is designed to strobe the LEDs with a square wave. This will significantly reduce the power consumption. The WiPort has the capability of being set to different power states depending on the functionality required. The WiPort draws a couple hundred milliamps of current in normal power mode. A low power mode would reduce the amount of current drawn by the WiPort.
6.2.3 Disposal and Recycling Phase
Once RoboRubik has reached the end of its normal use phase, the product needs to be recycled or disposed of properly. After a long life of use if RoboRubik is still in good working order, the best option would be to give the device away, perhaps to a friend or sibling who has not had a chance to play with the toy. If RoboRubik is not in working order then proper disposal and recycling is imperative to ensure as little environmental impact as possible. Organizations such as ICER, the Industry Council for Electronic Equipment Recycling, have a vast amount on information of different companies that are committed to recycling as much of their electronic equipment as possible [17]. Many of the metals on the PCBs can be retrieved and used again such as copper, nickel, gold, silver and palladium [14]. Many of the hardware components can be removed from the PCB and either broken down into base materials or refurbished and used again in another product. Companies like Eastern Environmental Technologies specialize in recycling printed circuit boards and all sorts of other electronic components [18]. Many old PCBs in computers and CRTs cannot be thrown away without proper steps taken. Businesses and institutions are not legally allowed to dispose of old computers in landfills or incinerators as doing so could release dangerous chemicals into the environment. Eastern Environmental Technologies encourages all businesses to take their old PCBs and computers to companies like itself for proper disposal. They can remove some of the precious metals like gold, silver and copper for reuse as well as quarantine hazardous chemicals. In doing so, the business knows it won’t face possible litigation for environmental damage or health hazards. They also recover some of their initial capital investment and qualify for a tax break.
6.3 Summary
As with any electronic device there are ethical and environmental issues that take place with the creation of RoboRubik. It is intended to be a toy but even toys can have an impact on the environment or have dangerous consequences for the user if precautions are not taken. The two main ethical concerns of RoboRubik both revolve around possible harm to the user. Our LEDs can possibly get too bright to look at and cause retina damage for anyone in the vicinity. The possibility of this can be lowered through rigorous testing during development. The other ethical concern is the possible danger of the batteries we are using. Any electronic device has the capability for explosion of the circuitry is damaged but rigorous testing will make sure that doesn’t happen. The environmental concerns are the same as any other electronic device. RoboRubik contains seven printed circuit boards and manufacturing those boards requires the use of hazardous chemicals. Cutting down on the concentration of the chemical baths used in production is a major goal to strive toward. The user of RoboRubik should also properly dispose of and recycle as many of the components as possible. There are a number of organizations willing to recycle the PCBs and hardware components so they can be refurbished and put into new electronic devices. Only by taking these steps can RoboRubik not impact the environment more than is absolutely necessary.
7.0 Packaging Design Considerations
The RoboRubik project is similar to a traditional Rubik’s Cube built not with moving parts, but with LEDs and pushbuttons to represent all the sides of the cube as well as cube rotation. The entire project is housed in a cube built using clear plexiglass so the LEDs can display the various colors of the squares of the cube. The top side of the cube can be removed to turn the device on or off and change the battery.
7.1 Commercial Product Packaging
The two commercial products found to be similar in design to the RoboRubik project are the original Rubik’s Cube [19]and the newer Rubik’s Revolution [20].
[pic] [pic]
Figure 7-1: Rubik’s Revolution Figure 7-2: Rubik’s Cube
Figure 7.1 on the left is the Rubik’s Revolution and Figure 7-2 to the right is the original Rubik’s Cube. Both products used a packaging which displays nine cubes per face of a cube. The sides of the Rubik’s Cube can be rotated whereas the Revolution’s sides cannot. The Rubik’s Cube was the inspiration for the RoboRubik project, but with its LED centers and programmed hardware contained internally, the Revolution is closer to the design chosen to implement. Details on the products are presented below.
7.1.1 Product 1: Rubik’s Cube
The original Rubik’s Cube, as mentioned before, was the initial inspiration for the RoboRubik project. The length of each face is 5.7cm per side made of hard plastic. There are three layers of sides, each made up of nine individual plastic cubes. Each cube has stickers placed on it to display the color of the side to which it belongs. The concept of the Rubik’s Cube game was taken for the RoboRubik project, but instead of moving each cube face as the Rubik’s Cube, LEDs change colors to simulate the rotation of a side. This product is very compact and the portability aspect of the Rubik’s Cube was a constant consideration when constructing the RoboRubik project. The issue with the Rubik’s Cube is the area in the center of the cube is extremely limited allowing virtually no room for hardware.
7.1.2 Product 2: Rubik’s Revolution
The Rubik’s Revolution is a much larger product with an 11cm length per cube side and it is much closer to the design RoboRubik was intended to accomplish. There are no moving parts and the Revolution contains internal hardware which is fairly similar to the way RoboRubik operates. Much like its Rubik’s predecessor, the Revolution is made up of nine cubes per side, but the difference is the center of each side contains a pushbutton LED to help the user interact with the games in the Revolution. The pushbuttons in the middle of each side is an aspect of the Revolution which is implemented in RoboRubik to help interface with the user. The only design problem with the Revolution is large in comparison to the original Rubik’s Cube to which the RoboRubik design was intended to be closer in size.
7.2 Project Packaging Specifications
The RoboRubik project packaging is simple and straightforward. The six sides of the cube are constructed out of clear plexiglass with a square hole cut out of the middle to allow access to the pushbutton on each face [21]. Each of these side is connected to a PCB sections containing eight LEDs and a single pushbutton. The six sides are connected together, one of which is connected with magnets so it can be removed to access the interior of the cube. Inside the cube, another PCB is used to host the microcontroller and other parts needed to complete the operation of RoboRubik. The drawings in Appendix B give a better understanding of the orientation of these PCBs. Figure B-1 gives a cut-away view of the interior of the cube illustrating the guts of RoboRubik. Figure B-2 is an exploded view of one of the side PCBs showing the layout of the pushbuttons and LEDs.
7.3 Printed Circuit Board Footprint Layout
Based on the major components chosen for this project, there are two different footprints. One is for all the side of the cube and the other is for the internal components. There is only one way to make a footprint for the sides since the project is dependent on the placement of the LEDs. The LEDs must be placed in a square around the pushbutton and the LED controller is placed next to the pushbutton. For the internal components, there needs to be enough room for the microcontroller, the battery pack, and the embedded web server. The layout provided in Appendix D displays the PCB footprint for both the main PCB, Figure D-1, and the side PCBs, Figure D-2. The dimensions of each PCB are 3.4 inches by 3.4 inches for both main and side PCB. Since RoboRubik requires one main PCB and six side PCBs, there are a total of seven PCBs making up RoboRubik internal structure.
7.4 Summary
In this sections, the packaging design for RoboRubik was discussed. The other products having similar packaging were shown to give insight into the considerations taken when designing RoboRubik. There are several drawings in the appendices showing the packaging design in more illustrative detail including sketches in Appendix A and PCB layouts in Appendix D.
8.0 Schematic Design Considerations
The design of the schematic can be broken up into two subsections: the theory of operation and the hardware design narrative.
8.1 Theory of Operation
The RoboRubik is comprised of four basic hardware subsystems: power, CPU, wireless control and display.
8.1.1 Power
Much like a normal Rubik’s Cube, RoboRubik is handheld and compact, and much like the Rubik’s Revolution, RoboRubik has a substantial battery life. The power options were limited by merely how many batteries could fit into the cube. The Energizer 6V EL2CR5 lithium battery has approximately 900 to 1200 milliamp hours [22]. Do to the large number of LEDs, RoboRubik requires a large amount of current. It was found through testing that these batteries were acceptable for use in RoboRubik.
Given that all components operate in the 3.3V range, these 6V batteries had too high a voltage to handle. Therefore a voltage converter was necessary to step down the 6V input voltage. The Fairchild KA278R33 LDO voltage regulator performed this task for us. It takes a wide input range and outputs a 3.3V operating voltage [23]. One of these was placed at the start of the circuit.
8.1.2 CPU
The RoboRubik CPU is a Freescale MC9S12C128MFAE 16-bit microcontroller. Commands are sent to the microcontroller using a Serial Communication Interface (SCI) and stored on the chip’s onboard memory. Subroutines that change the current state of the LEDs are called when user input is received from the external pushbuttons or when the user requests a hint, via the web server, as to the next move. The microcontroller is running off of an 8MHz crystal oscillator. The PLL circuitry in conjunction with this oscillator causes the microcontroller to run at approximately 24MHz. The microcontroller can be set to operate at a 5V or 3.3V range [24]. The operating voltage was set to 3.3V for two reasons. The first is that the Lantronix WiPort operating voltage is also 3.3V [25], which means there was no need to amplify signals. Secondly, the forward voltage of the green and blue components of the Optek RGB LEDs is 3.3V [13]. As mentioned before, by using a 3.3V operating voltage for the microcontroller one voltage level
8.1.3 Wireless Control
The Lantronix WiPort Embedded Wireless Networking Device was chosen for the wireless communication device. The WiPort provides TCP-to-serial communication between a user interface website and the microcontroller. The WiPort includes a complete 802.11 b/g radio, serial interface to external CPU or other device and 2MB of Flash memory for webpage storage [25]. Upon initialization the WiPort’s serial port is coupled with a specific TCP port number. This serial port is tied to the SCI port on the microcontroller. A static IP address is assigned to the WiPort also upon initialization, which is receives from the DHCP server on a local WLAN [26]. The WiPort and microcontroller were set up to communicate with a baud rate of 9600.
To begin using RoboRubik the user navigates to the homepage of the WiPort embedded web server, which is located on the static IP address port 80 [26]. The homepage lets the user select from different operating modes such as Play, Help, etc. Once the user has made a selection, that command is placed on the WiPort web server IP:port [26]. The command is serialized and transmitted on the TCP stack to the WiPort serial port where it is received by the CPU and further computation takes place [26].
8.1.4 Display
The display subsystem consists of 48 LEDs (8 per side). The remaining square of each side is a colored pushbutton. There are a total of 48 tri-color RGB LEDs. The RGB LEDs from Optek Electronics contain one red, one green and one blue LED and can subsequently be light to create a large spectrum of colors [13]. Six distinct colors are necessary for a Rubik’s Cube and are created by signaling one, two or three LEDs at once. The six colors used were Red, Blue, Green, Yellow, White and Magenta.
The LEDs are driven by a series of Allegro A6279 latched LED drivers. The A6279 can drive up to 16 LEDs. For the design of RoboRubik the A6279 will drive 12 individual LEDs, or 4 RGB LEDs. There will be 2 drivers for each side of RoboRubik.
The LED drivers operate by receiving a serial input from the CPU as a shift register. Rather than use the SCI for this, two I/O pins can be configured to represent the serial and clock signals. The data is shifted down and the driver latches the value upon enabling [27]. When the display requires updating, the serial data moves along the shift register every time the input clock goes from low-to-high. Once the 16-bit value arrives, the data is for each shift register is latched upon LATCH ENABLE signaled high. The latch data is then outputted upon OUTPUT ENABLE signaled low. To specify which driver is to be updated, the serial data and clock signal are sent to all 12 drivers and the LATCH ENABLE signal is multiplexed by a 4x16 multiplexer [27].
8.2 Hardware Design Narrative
The main subsystem of the microcontroller that was used was the Serial Communication Interface and the Pulse-Width Modulator. The rest of the subsystems will be deactivated to allow for more I/O pins to be used.
8.2.1 Serial Communications Interface
The SCI has two pins on the MC9S12C128MFAE: TXD and RXD [24]. TXD is the output pin for the SCI and RXD is the input pin for the SCI. TXD is tied to the RXD0 pin on the WiPort and RXD is tied to the TXD0 pin on the WiPort. This establishes a flow of communication between the WiPort and the microcontroller, allowing commands from the web server to be processed on the microcontroller and updates in the LED display subsystem to be sent back to the web server.
8.2.2 Pulse-Width Modulation Subsystem
Since power consumption was a major design consideration, it was decided that the LEDs should be strobed using the PWM to cut down on the consumption of power. The LED drivers OUTPUT ENABLE pin is strobed with a 100Hz wave with a 50% duty cycle. This reduced the power consumed by the LEDs without lessening their effectiveness.
8.2.3 Initialization Narrative
Once RoboRubik has been powered on and the user has navigated to the website, the initialization can begin. The user selects from different operating modes depending on their need of RoboRubik. This command is posted to a TCP port that is directly connected to the WiPort. This hardware functionality is already built in. Once the command reaches the WiPort the data is sent through the serial port to the microcontroller where a serial interrupt occurs. The interrupt handler interprets the command and dispatches the necessary subroutine located in memory. This subroutine computes what the most current display state should be and once it has been fully processed; it proceeds to load the 12 LED drivers with this information. The output of the LED drivers is enabled and the display now reflects the most current RoboRubik state.
8.2.4 Pushbutton Narrative
RoboRubik has been powered on and initialized and the user is free to play with the device. They determine what their next move should be and press the corresponding pushbutton. Upon pressing the button, the timer interrupt on the microcontroller that is monitoring the pushbuttons detects a pushbutton event. The interrupt handler interprets the command and dispatches the appropriate subroutine. The subroutine computes the next state of display and sends this information to the LED drivers. The drivers are loaded with this new state and updated to reflect the changes.
8.3 Summary
In this section of the report, the theory of operation and hardware narrative were discussed. Design issues of size and power were taken into consideration and major subsystems of RoboRubik were outlined. The major subsystems each have a specific purpose and must work in conjunction with the others in order for RoboRubik to operate correctly. The schematic of RoboRubik is shown in Appendix C.
9.0 PCB Layout Design Considerations
Our design project the RoboRubik, a digital Rubik’s Cube that uses LEDs to represent colored blocks unlike a normal Rubik’s Cube that uses a mechanical system and colored stickers.
There are seven total PCBs in the RoboRubik, the main board and 6 side boards. Each face of the cube has a PCB containing a pushbutton and eight LEDs to represent the multicolored blocks of a normal Rubik’s Cube. The main board in the middle contains the “brains” of the RoboRubik.
9.1 PCB Layout Design Considerations – Overall
The size of the cube was our main constraint. The main board contains the heart of the design. It contains the microcontroller, the WiPort [29], the power circuitry, and the headers to the other boards. The side PCBs contain the Optek LEDs [13], the Allegro LED drivers [27], and the NKK pushbuttons [30]. The layout of the side PCB is important because it interfaces with the external enclosure of the RoboRubik. There is a pushbutton in the center of each board that sits in a cutout in the enclosure and the eight LEDs of each board needs to be in the correct location to represent the square blocks of a normal Rubik’s Cube. Since all of our components are small and simple, we do not have to worry about too much current going through our traces. There are no analog signals to work with either in our project. The WiPort is the only thing that has analog and RF signals, but that is all self-contained in its own package. The only challenge the WiPort gave us was the footprint. It is a little difficult to work with because it is in a metal enclosure and the 40 pins are located on the bottom. The Integration Guide was very helpful.
2. PCB Layout Design Considerations – Microcontroller
The microcontroller used is the MC9S12C128 [28] in the 48 pin package. This package is just like the one from the ECE362 demo kit. Since this microcontroller is so common, it was easy to determine the layout for it. The documentation was also very helpful. It uses a basic oscillator circuit with 2 capacitors and a resistor. This circuit was kept as close as possible to the microcontroller. The other circuit needed was the power supply bypass capacitor circuit. This is located under the microcontroller on the opposite side of the PCB to keep it close to the clock pins. There are 6 bypass capacitors used ranging from 0.1 uF to 470 nF. These were the only major considerations for the microcontroller.
9.3 PCB Layout Design Considerations – WiPort
The WiPort also needs bypass capacitors like the microcontroller. It needs six of them ranging from 4.7uF to 0.01uF. These need to be right under the power supply pads. The WiPort also requires a special male header to fit the female header on the underside of the device. This is important because it needs to be in the exact location for the WiPort to sit correctly on the PCB. The documentation was very helpful for this and the development board that came with the WiPort was also a good reference.
4. PCB Layout Design Considerations - Power Supply
The power supply circuit is very simple. Since the cube is powered with a battery of 6V to 9V, it only needed to be stepped down. This is done with aFairchild LDO [23] voltage regulator to drop the voltage down to 3.3V, the voltage all of the components run on. This circuit is located in the corner of the main PCB and does not require too large of traces.
5. Summary
Overall the PCBs are very straight forward. The main consideration was keeping them as small as possible. The PCBs are unique because there are seven of them. There are six for the sides and a main one in the middle. The side layout is important because it interfaces to the user through a pushbutton and LEDs. The main board is also important because it contains the main components and is what will most likely limit the size of our cube.
9. Software Design Considerations
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 section.
10.1 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 stored on RoboRubik’s embedded wireless network device and is accessed via 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 [25]. Once the cube configuration is received by the microcontroller from the user interface, the configuration is output to the LEDs and the stored solving algorithm 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.
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 interrupt-driven 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 requires the microcontroller to interrupt the current LED output configuration and change the state of the LEDs based on the mode of operation. The SCI, Serial Communications Interface, peripheral of the microcontroller is used to communicate between the microcontroller and the wireless network device. The PWM, Pulse-Width Modulation, peripheral is used to strobe the LEDs and display the configuration of the cube. The TIM, Timer, module of the microcontroller samples the pushbuttons and fires and interrupt when a button press is sensed.
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 [28].
10.2 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. This hierarchical arrangement is depicted in Figure 10-1 below. The user 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 SCI interface module [28]. 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 [28]. 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.
[pic]
Figure 10-1: Hierarchical Block Diagram
10.3 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 interrupt-driven organization mode during the changing of the current state. A listing of the code used for RoboRubik is included in Appendix F.
10. Version 2 Changes
Now that RoboRubik is complete there a few changes that would have made to its design. First the overall package would have been constructed smaller. RoboRubik is currently about the same size as the Rubik Revolution and it would have been nice to keep it close to the same size as the original Rubik’s Cube. Also, headers for the microcontroller were placed on the PCB design and were never used during the testing or implementation of RoboRubik. These headers would have been removed, thus making the PCB layout smaller and easier to create. The LDO would also have been moved to a different location so the user doesn’t burn their finger trying to turn on RoboRubik.
The WiPort, while a very powerful and useful component, is the largest part of the design. Next time a smaller and more compact device would be used. The WiPort was not used entirely in the design of RoboRubik and a smaller device could have still provided the same functionality used. One more change would be to use a pushbutton with an embedded LED for each of the center squares. While the pushbuttons used are effective and do the job well, not having nine LEDs of the same color is not a perfect aesthetic choice.
If the RoboRubik model was to be mass produced as a consumer toy, the final packaging of the cube should be permanent without access to the internal circuitry. The location of the on/off switch could be moved to the exterior of the cube to make access by the user easier and less invasive. Another design alteration might be the implementation of a rechargeable battery. Without access to the cube’s interior, this would require charging by induction. Thus, a charging unit with AC/DC wall adapter would be included with RoboRubik for charging the battery.
Summary and Conclusions
Through the completion of RoboRubik we learned a great deal. No one on the team had done much hardware design before aside from the work done in ECE 270 and ECE 362. This project really challenged us to go above and beyond our current skill set and acquire new knowledge. Most of us had never soldered before starting this project. We also learned a great deal about how components from different manufacturers can be combined to create a working circuit as well as how to create a printed circuit board layout using OrCAD.
We also learned a lot about wireless networking and serial communications. Our packaging design was a good challenge because we had to take into account many factors in its design. We learned much about the Rubik’s Cube itself and how its design influences its challenge and difficulty. Lastly, we had our ability to work as team put to the test and all four of us worked very well together.
References
1] “16-bit Microcontrollers MC9S12C32,” [Online document], [cited 2008 Jan 29], Available HTTP:
2] “RECOM Power Inc. – Our DC/DC Highseller,” [Online document], [cited 2008 Jan 29], Available HTTP:
3] “Allegro | Product | A6276 16-Bit Serial-Input, Constant Current Latched LED Driver,” [Online document], [cited 2008 Jan 29], Available HTTP:
4] “TT Electronics plc,” [Online document], [cited 2008 Jan 29], Available HTTP:
5] “WiPort – Embedded 802.11, Embedded Ethernet, 802.11g,” [Online document], [cited 2008 Jan 29], Available HTTP:
6] “Rubik’s Official Online Site,” [Online document], [cited 2008 Jan 29], Available HTTP:
7] “WiPort vs. MatchPort B/G Compared,” [Online document], [cited 2008 Jan 29], Available HTTP:
8] “MC9S12C128 Product Summary Page,” [Online document], [cited 2008 Jan 29], Available HTTP:
9] United States Patent and Trademark Office Patent #6,974,130, [Online document], 2005 Dec, [cited 2008 Mar 27], Available HTTP:
10] United States Patent and Trademark Office Patent #5,310,183, [Online document], 1994 May, [cited 2008 Mar 27], Available HTTP:
11] United States Patent and Trademark Office Patent #5,651,715, [Online document], 1997 July, [cited 2008 Mar 27], Available HTTP:
12] MIL-HDBK-217F, United States Department of Defense, 2 January 1990.
13] “Optek OVSRRGBCC3 Datasheet” [Online document], [cited 2008 Apr 28] Available
HTTP:
14] Martin Tarr, "PCB recycling issues", [Online Document] [cited 2008 Apr 28] Available HTTP:
15] “Waste Minimization Assessment for a Printed Circuit Board Manufacturer,” Looby and Kirsch. [Online Document], [cited 2008 Apr 28] Available HTTP: .
16] Wikipedia, "Restriction of Hazardous Substances Directive", [Online Document] [cited 2008 Apr 28] Available HTTP:
17] “ICER: Industry Council for Electronic Equipment Recycling”, [Online Document] [cited 2008 Apr 28] Available HTTP:
18] “Eastern Environmental”, [Online Document] [cited 2008 Apr 28] Available HTTP:
19] “Rubik’s Official Online Site,” [Online document], [cited 2008 Feb 08], Available HTTP:
20] “Rubik’s Revolution Official Online Site,” [Online document], [cited 2008 Feb 08], Available HTTP:
21] “Plexiglas Optical and Transmission Characteristics,” [Online document], [cited 2008 Feb 08], Available HTTP:
22] “Energizer 6V EL2CR5 Lithium” [Online document], [cited 2008 Apr 28] Available
HTTP:
23] “Fairchild KA378R33 Datasheet” [Online document], [cited 2008 Apr 28] Available HTTP:
24] “MC9S12C Family User Guide” [Online document], [cited 2008 Apr 28], Available
HTTP:
25] “Lantronix WiPort Datasheet” [Online document], [cited 2008 Apr 28], Available
HTTP:
26] “Lantronix WiPort User Guide” [Online document], [cited 2008 Apr 28] Available
HTTP:
27] “Allegro A6279 Datasheet” [Online document], [cited 2008 Apr 28] Available
HTTP:
28] “MC9S12C Family User Guide” [Online document], [cited 2008 Feb 22], Available
HTTP:
29] “Lantronix WiPort Integration Guide” [Online document], [cited 2008 Feb 22], Available
HTTP:
30] “NKK Series CB3 Pushbutton Datasheet“[Online document], [cited 2008 Feb 22] Available
HTTP: pdf/CB3.pdf
Appendix A: Individual Contributions
A.1 Contributions of Erik Carron:
My main contributions towards the completion of RoboRubik were the printed circuit board layout narrative, the reliability and safety analysis, and the design of the printed circuit board (PCB) layout. I also was the one who came up with the idea of creating a digitalized Rubik’s Cube. Most of my background is in software, which I enjoy, but I decided to do something different and worked mostly with the hardware design of the RoboRubik.
When we first began the planning of the RoboRubik, our initial thought was to have it mechanically rotate. I took on the role of testing stepper motors to see how we could do this in such a small package. I determined that this was not going to be possible with our experience and tools so I came up with the idea of changing it to a static cube with LEDs to represent the colors of the blocks. Once we started to design the new RoboRubik, I decided that my contributions would be mainly focused on the PCB layout design and hardware selection. I worked with my teammates in selecting the components and I was able to find our wireless device, the WiPort. I did some research on it and used my networking experience to determine that it was the perfect device to use. After all of our components were selected, I started my training with Cadence Layout Plus.
Since this was my first time working with PCB layout, it took me some time to figure it out. I worked with Dave to get the schematic corrected and completed so I could start our layout. I spend countless days and nights working on this. I was jumping from device data sheets, to the schematic, to the layout program. I had to make sure that it was flawless so that we would not run into any problems down the road. Dave and Tyler helped me out a lot when it came down to the deadline.
Once we had the PCBs out for fabrication, I went on to testing some of our components that came in. I first did testing on the very small LEDs with the help of Chuck. I then went on to test the LED drivers by programming the ECE 362 development board to clock and shift data in. Dave assisted me in doing this and we were able to get everything figured out so when we got the PCBs back we could get started right away.
Once we got the PCBs, I did a lot of the populating. I got one of the sides fully populated and programmed the ECE 362 development board again to clock and shift data in to test it. We ran into several problems at first, which Dave and I worked on and eventually solved. Once we got one side fully working, I populated the rest of the side PCBs with Tyler. I then focused on getting the main board working. I populated it with the help of Tyler again and did the first testing of the microcontroller. It took me a while to figure everything out but I was able to program the microcontroller with the background debug mode (BDM). I then set up all the initializations in the assembly code for the microcontroller and passed it on to Casey so he could start his programming.
While Dave and Casey worked with each other on the software, Tyler and I worked on the external Plexiglas packaging. He got the rough cutouts of the Plexiglas and we then worked together to come up with ideas to bring everything together. We decided to sand down the edges and use clear silicon sealant to hold it all together. We also painted the pushbuttons different colors to help the user.
A.2 Contributions of Dave Bukiet:
As a computer engineer with an interest and knowledge of signal processing, my main contributions to RoboRubik were the hardware design narrative, the communication protocol between the WiPort and microcontroller and the Java user interface. My understanding of signal processing made me the best candidate to work on the communication between the microcontroller and WiPort. My experience with Java as well as my knowledge of networking gave me useful skills in working with the WiPort.
During the planning stages of RoboRubik I worked with my teammates to finalize ideas about how we would design the circuitry of the project. It was recommended that we use some sort of driver to power our LEDs and I did a lot of research on how this system would work. I did a lot of component research and picked out the LEDs we ultimately ended up using. I did some testing with the LED drivers we chose to determine if they would be suitable for our design. Once we had all of our components chosen I worked on the hardware design narrative.
After familiarizing myself with the specifics of each component, the design of the schematic was my responsibility. I spent a lot of time making sure that all components chosen could operate correctly and be combined to form a working circuit. Once the schematic was finalized I also worked with Erik on the layout of the PCB design.
Once we had sent the PCB design off for fabrication, I started working with the WiPort and determining what the best configuration was. I spent a lot of time testing simple communication programs between the WiPort and our ECE 362 development board. This would ensure that once our main circuit board was populated it would be easy to implement communication between the WiPort and microcontroller.
Once we received our PCBs back from fabrication I helped my team test a fully populated side board. This board contained two LED drivers and eight LEDs. After a number of hurdles we finally got the circuit working correctly and began populating the rest. I also worked heavily to design the overall structure of the user interface as well as how the code on the microcontroller should integrate with it.
After some debate we found that using the microcontroller to solve the cube would be a greater challenge than expected and we decided to use an available Java applet to do the solving. This applet was embedded on the WiPort and could be easily connected to using a wireless connection. Once Casey had found the open-source applet and modified some of the code, I heavily modified the code to include our communication system as well as other functionality. I worked with Casey near the end of development to make sure that his microcontroller code and my Java applet would sync up correctly.
A.3 Contributions of Tyler Heck:
The main contributions I made to the RoboRubik project included, but were not limited to, the design constraint analysis report; software design considerations, narrative, and documentation; and packaging construction. As a computer engineer, my knowledge of software design allowed me to properly develop the software which would eventually run RoboRubik. Having taken a few courses in civil engineering, my experience in structural analysis along with my background in general craftsmanship made me the best person for designing and constructing the internal and exterior packaging of RoboRubik.
I was solely responsible for the designing of the RoboRubik website. Throughout the course of the semester, it was my duty to update the group website with current information on design changes and post documents as they were completed. With assistance from my teammates, my first assignment was to draft a design constraint report based on the components we selected for the RoboRubik project. This component selection served as the foundation of later design considerations.
Although it was not part of my individual assignment, I spent a great deal of time on the PCB layout of our project. I spent a over fifteen hours working in the main PCB and side PCB layout in order to complete the assignment and send the PCB layout for fabrication on time.
Throughout the project, Erik and I were the two group members responsible for soldering. This included soldering components onto the PCBs, creating connectors for the batteries and side PCBs, de-soldering, and often re-soldering. Once the PCBs were back from fabrication, I soldered approximately 60% of all components on the main PCB and 85% of all side PCB components. When the project was near completion, I connected four of the side PCBs to the main PCB via right-angle headers and the remained two side PCBs by connectors mentioned above.
At the beginning of the semester, I was intended to implement the Rubik’s Cube solving algorithm and assist Dave in the software communications interfacing. We were able to find some open-source code for a Rubik’s Cube solving algorithm which could be stored on our wireless network device. Thus, my initial role was outsourced. I spent some time with Dave designing the communications protocol between the microcontroller and wireless network device with Dave making the majority of the contribution in this area. At the point in the semester when our PCBs were not fully populated and software testing could not proceed, I took the initiative to pursue the fabrication of RoboRubik’s external housing. At this point, Casey and I switched roles as he would produce the microcontroller software and I would develop the packaging.
My major contribution toward the end of the project was the final packaging design. One packaging contribution included the idea of placing magnets cut into right-angle triangles in the four corners inside the internal PCB structure to add stability and allow for the removal of the top face. I was exclusively in charge of constructing the plexiglass pieces later used to create an exterior shell to house RoboRubik. I went to the EE machine shop and assisted Chuck Harrington in the initial cutting of the plexiglass and button caps. I later made frequent trips to the shop to sand and bevel the pieces to properly fit the internal PCB structure. Once the internal PCB structure of RoboRubik was finished and the software development was nearing completion, Erik and I attached the plexiglass pieces together allowing the internal structure to slide in perfectly. Once the packaging was finished, the team recorded and edited the RoboRubik video; I created the project poster; and the RoboRubik project was complete.
A.4 Contributions of Casey Kloiber:
My main contributions toward the completion of RoboRubik were the packaging design narrative, the patent liability issues report, and the development of the microcontroller software. My background in programming in several different languages throughout my time in college and even beforehand in high school made me the ideal person for the software development for the microcontroller. I also aided in the development of the Java user interface applet.
When we first decided that our project was going to be RoboRubik, I decided that my contribution would be mainly geared towards the packaging and I would assist in the software development of the microcontroller. In the beginning when there wasn’t much packaging to be done, I assisted my teammates in deciding on appropriate parts to obtain for appropriate functionality of our cube. One of the two LED drivers I had researched ultimately became the part we used to interface with our forty-eight tri-color LEDs. After the parts had been finalized, I familiarized myself with various programs that had the ability to solve the Rubik’s Cube.
Since my teammates were focusing on hardware so that the PCB design would be finished in time for fabrication, I devoted all of my time into finding a piece of software that would be optimal in not only interfacing with the users of RoboRubik, but also would provide a simple and straightforward interface to our microcontroller. After testing several programs that were developed in C++, an applet that was programmed in Java became our new target for development.
I altered the user interface of the Java applet to suit our needs and changed some of the functionality so that extraneous user input wouldn’t alter the state of the cube and cause problems. After I had completed the aesthetics of the applet, Dave took over with the rest of the development of the communication software that our Java applet would need. Around this time the PCB had come back from fabrication and population was under way so I aided in the testing and debugging of several of the parts.
After the board was fully populated was when I began writing the software for the microcontroller. Tyler was originally listed as the lead in software development, but we traded roles and as he worked tirelessly on getting the packaging for the cube prepared, I worked on the software for the microcontroller that would display the appropriate colors on the correct sides. After completing the main segment of code for the microcontroller, Dave and I worked on communication between the WiPort and microcontroller. When all the pushbuttons and lights worked on the cube, the final bit of functionality we got working was updating RoboRubik from commands sent from the WiPort. After that, we all created our poster and video and the project was complete.
Appendix B: Packaging
[pic]
Figure B-1: Cut-Away Internal View
[pic]
Figure B-2: Exploded Individual Side View
Appendix C: Schematic
[pic]
Figure C-1: Schematic for Main PCB
[pic]
Figure C-2: Schematic for Side PCBs
Appendix D: PCB Layout Top and Bottom Copper
.
[pic]
Figure D-1: PCB Layout for Main PCB
[pic]
Figure D-2: PCB Layout for Side PCBs
Appendix E: Parts List Spreadsheet
|Vendor |Manufacturer |Part No. |Description |
|Digi-Key |Freescale |MC9S12C128 |16-Bit Microcontroller |
|Gridconnect |Lantronix |WiPort |Wireless Networking Device |
|Digi-Key |Abracon Corp |ASV |Oscillator |
|Digi-Key |Fairchild |KA378R33 |LDO |
|Allegro MicroSystems |Allegro MicroSystems |A6279 |16-Bit LED Driver |
|Digi-Key |TT Electronics |OVSRRGBCC3 |RGB Surface Mount LED |
|Digi-Key |Texas Instruments |CD74HC4067 |1:16 MUX/DEMUX |
|Wal-Mart |Energizer |EL2CR5 |6V battery |
Table E-1: Parts List
Appendix F: Software Listing
;***********************************************************************
; RoboRubik 1.0
;***********************************************************************
;
;This code controls everything about the microcontroller in our
;RoboRubik project. It's main use is to take the values stored
;in the LED driver registers and paint the faces of the cube
;accordingly. It also interfaces with the Wiiport via SCI by either
;sending values to update the java applet or receiving values from the
;applet to update the LED registers on our cube and repaint the sides
;accordingly.
;
; ======================================================================
;
; Variable declarations (SRAM)
;
; *** NOTE *** Others can be added if deemed necessary
;
org $3800
pbA rmb 1 ; side A pushbutton flag
pbB rmb 1 ; side B pushbutton flag
pbC rmb 1 ; side C pushbutton flag
pbD rmb 1 ; side D pushbutton flag
pbE rmb 1 ; side E pushbutton flag
pbF rmb 1 ; side F pushbutton flag
prevpb rmb 1 ; previous pushbutton state
paint rmb 1
setled rmb 1
storeinfo rmb 1
countclk rmb 1
countled rmb 1
countlights rmb 1
countdrivers rmb 1
fixglitch1 rmb 1
fixglitch2 rmb 1
fixglitch3 rmb 1
fixglitch4 rmb 1
fixglitch5 rmb 1
fixglitch6 rmb 1
temp rmb 2
regholder1 rmb 2
regholder2 rmb 2
regholder3 rmb 2
regholder4 rmb 2
onecnt rmb 1 ; counter for 1 ms
halfsec rmb 1 ; flag for half a second
WHITE rmb 1
MAGENTA rmb 1
YELLOW rmb 1
RED rmb 1
BLUE rmb 1
GREEN rmb 1
counter1 rmb 1
counter2 rmb 1
frontled1 rmb 2
frontled2 rmb 2
backled1 rmb 2
backled2 rmb 2
topled1 rmb 2
topled2 rmb 2
bottomled1 rmb 2
bottomled2 rmb 2
leftled1 rmb 2
leftled2 rmb 2
rightled1 rmb 2
rightled2 rmb 2
;***********************************************************************
;
; ASCII character definitions
;
RET equ $0d ; return
NULL equ $00 ; NULL
LF equ $0A ; Line Feed
;========================================================================
;
; 9S12C32 REGISTER MAP
INITRM EQU $0010 ; INITRM - INTERNAL RAM POSITION REGISTER
INITRG EQU $0011 ; INITRG - INTERNAL REGISTER POSITION REGISTER
; ==== CRG - Clock and Reset Generator
SYNR EQU $0034 ; CRG synthesizer register
REFDV EQU $0035 ; CRG reference divider register
CRGFLG EQU $0037 ; CRG flags register
CRGINT EQU $0038
CLKSEL EQU $0039 ; CRG clock select register
PLLCTL EQU $003A ; CRG PLL control register
RTICTL EQU $003B
COPCTL EQU $003C
; ==== SCI Register Definitions
SCIBDH EQU $00C8 ; SCI0BDH - SCI BAUD RATE CONTROL REGISTER
SCIBDL EQU $00C9 ; SCI0BDL - SCI BAUD RATE CONTROL REGISTER
SCICR1 EQU $00CA ; SCI0CR1 - SCI CONTROL REGISTER
SCICR2 EQU $00CB ; SCI0CR2 - SCI CONTROL REGISTER
SCISR1 EQU $00CC ; SCI0SR1 - SCI STATUS REGISTER
SCISR2 EQU $00CD ; SCI0SR2 - SCI STATUS REGISTER
SCIDRH EQU $00CE ; SCI0DRH - SCI DATA REGISTER
SCIDRL EQU $00CF ; SCI0DRL - SCI DATA REGISTER
PORTB EQU $0001 ; PORTB - DATA REGISTER
DDRB EQU $0003 ; PORTB - DATA DIRECTION REGISTER
; ==== ATD (analog to Digital) Converter / Pushbutton Digital Inputs
ATDCTL2 EQU $0082 ; ATDCTL2 control register
ATDCTL3 EQU $0083 ; ATDCTL3 control register
ATDCTL4 EQU $0084 ; ATDCTL4 control register
ATDCTL5 EQU $0085 ; ATDCTL5 control register
ATDSTAT EQU $0086 ; ATDSTAT0 status register
ATDDIEN EQU $008D ; Port AD digital input enable
; (programs Port AD bit positions as digital inputs)
PTADI EQU $008F ; Port AD data input register
; (for reading digital input bits)
ATDDR0 EQU $0090 ; result register array (16-bit values)
ATDDR1 EQU $0092
ATDDR2 EQU $0094
ATDDR3 EQU $0096
ATDDR4 EQU $0098
ATDDR5 EQU $009A
ATDDR6 EQU $009C
ATDDR7 EQU $009E
; ==== Direct Port Pin Access/Control - Port T
PTT EQU $0240 ; Port T data register
PTIT EQU $0241 ; Port T input read register
DDRT EQU $0242 ; Port T data direction register
; ==== Direct Port Pin Access/Control - Port AD
PTAD EQU $0270 ; Port AD data register
PTIAD EQU $0271 ; Port AD input read register
DDRAD EQU $0272 ; Port AD data direction register
; ==== TIM - Timer 16 Bit 8 Channels
TIOS EQU $0040 ;TIOS - TIMER INPUT CAPTURE/OUTPUT COMPARE SELECT
CFORC EQU $0041 ;CFORC - TIMER COMPARE FORCE REGISTER
OC7M EQU $0042 ;OC7M - OUTPUT COMPARE 7 MASK REGISTER
OC7D EQU $0043 ;OC7D - OUTPUT COMPARE 7 DATA REGISTER
TCNT EQU $0044
TCNTH EQU $0044
TCNTL EQU $0045
TSCR1 EQU $0046 ;TSCR - TIMER SYSTEM CONTROL REGISTER
TTOV EQU $0047
TCTL1 EQU $0048 ;TCTL1 - TIMER CONTROL REGISTER 1
TCTL2 EQU $0049 ;TCTL2 - TIMER CONTROL REGISTER 3
TCTL3 EQU $004A ;TCTL3 - TIMER CONTROL REGISTER 3
TCTL4 EQU $004B ;TCTL4 - TIMER CONTROL REGISTER 3
TIE EQU $004C
TSCR2 EQU $004D
TFLG1 EQU $004E ;TFLG1 - TIMER INTERRUPT FLAG 1
TFLG2 EQU $004F ;TFLG2 - TIMER INTERRUPT FLAG2
TC0 EQU $0050 ;TC0 - TIMER INPUT/CAPTURE COMPARE HIGH REGISTER
TC1 EQU $0052 ;TC1 - TIMER INPUT/CAPTURE COMPARE HIGH REGISTER
TC2 EQU $0054 ;TC2 - TIMER INPUT/CAPTURE COMPARE HIGH REGISTER
TC3 EQU $0056 ;TC3 - TIMER INPUT/CAPTURE COMPARE HIGH REGISTER
TC4 EQU $0058 ;TC4 - TIMER INPUT/CAPTURE COMPARE HIGH REGISTER
TC5 EQU $005A ;TC5 - TIMER INPUT/CAPTURE COMPARE HIGH REGISTER
TC6 EQU $005C ;TC6 - TIMER INPUT/CAPTURE COMPARE HIGH REGISTER
TC7 EQU $005E ;TC7 - TIMER INPUT/CAPTURE COMPARE HIGH REGISTER
; ==== IMPORTANT -- Routing register for Port T (selects TIM vs PWM mapping)
MODRR EQU $0247 ; Port T module routing register
; NOTE: Used to select TIM or PWM mapping to Port T pins
; ==== PA - Pulse Accumulator
PACTL EQU $0060 ;PATCL - PULSE ACCUMULATOR CONTROL REGISTER
PAFLG EQU $0061 ;PAFLG - PULSE ACCUMULATOR FLAG REGISTER
PACNT EQU $0062 ;PACNT - PULSE ACCUMULATOR COUNT REGISTER
; ==== PWM - Pulse width Modulator
PWME EQU $00E0 ; PWM enable
PWMPOL EQU $0000 ; PWM polarity
PWMCLK EQU $00E2 ; PWM clock source select
PWMPRCLK EQU $00E3 ; PWM pre-scale clock select
PWMCAE EQU $00E4 ; PWM center align enable
PWMCTL EQU $0000 ; PWM control (concatenate enable)
PWMSCLA EQU $00E8 ; PWM clock A scaler
PWMSCLB EQU $00E9 ; PWM clock B scaler
PWMPER0 EQU $00F2 ; PWM period registers
PWMPER1 EQU $00F3
PWMPER2 EQU $00F4
PWMPER3 EQU $00F5
PWMPER4 EQU $00F6
PWMPER5 EQU $00F7
PWMDTY0 EQU $00F8 ; PWM duty registers
PWMDTY1 EQU $00F9
PWMDTY2 EQU $00FA
PWMDTY3 EQU $00FB
PWMDTY4 EQU $00FC
PWMDTY5 EQU $00FD
; ======================================================================
REGBASE EQU $0 ; registers start at 0000
RAMBASE EQU $3800 ; 4KB SRAM located at 3000-3FFF
;***********************************************************************
; BOOT-UP ENTRY POINT
;***********************************************************************
org $8000
startup sei ; Disable interrupts
movb #$00,INITRG ; set registers to $0000
movb #$39,INITRM ; map RAM ($3800 - $3FFF)
lds #$3FCE ; initialize stack pointer
;
; Set the PLL speed (bus clock = 24 MHz)
;
bclr CLKSEL,$80 ; disengage PLL from system
bset PLLCTL,$40 ; turn on PLL
movb #$2,SYNR ; set PLL multiplier
movb #$0,REFDV ; set PLL divider
nop
nop
plp brclr CRGFLG,$08,plp ; while (!(crg.crgflg.bit.lock==1))
bset CLKSEL,$80 ; engage PLL
;
; Disable watchdog timer (COPCTL register)
;
movb #$40,COPCTL ; COP off; RTI and COP stopped in BDM-mode
;
; Initialize asynchronous serial port (SCI) for 9600 baud, no interrupts
;
movb #$00,SCIBDH ; set baud rate to 9600
movb #$9C,SCIBDL ; 24,000,000 / 16 / 156 = 9600 (approx)
movb #$00,SCICR1 ; $9C = 156
movb #$0C,SCICR2 ; initialize SCI for program-driven operation
movb #$10,DDRB ; set PB4 for output mode
movb #$10,PORTB ; assert DTR pin on COM port
txdre equ $80
rxdrf equ $20
;***********************************************************************
; START OF CODE FOR EXPERIMENT
;***********************************************************************
;
; Flag and variable initializations
;
; *** NOTE *** Add any others deemed necessary
;
movb pbA,$00
movb pbB,$00
movb pbC,$00
movb pbD,$00
movb pbE,$00
movb pbF,$00
clr prevpb
clr onecnt
clr halfsec
clr countclk
clr countled
clr countlights
clr countdrivers
clr paint
clr regholder1
clr regholder2
clr setled
clr fixglitch1
clr fixglitch2
clr fixglitch3
clr fixglitch4
clr fixglitch5
clr fixglitch6
clr storeinfo
movw #$0000, frontled1
movw #$0000, frontled2
movw #$0000, backled1
movw #$0000, backled2
movw #$0000, topled1
movw #$0000, topled2
movw #$0000, bottomled1
movw #$0000, bottomled2
movw #$0000, leftled1
movw #$0000, leftled2
movw #$0000, rightled1
movw #$0000, rightled2
movb #$07,WHITE
movb #$05,MAGENTA
movb #$06,YELLOW
movb #$04,RED
movb #$01,BLUE
movb #$02,GREEN
ldd frontled1
eorb YELLOW
jsr lsld_func
eorb YELLOW
jsr lsld_func
eorb YELLOW
jsr lsld_func
eorb YELLOW
std frontled1
ldd frontled2
eorb YELLOW
jsr lsld_func
eorb YELLOW
jsr lsld_func
eorb YELLOW
jsr lsld_func
eorb YELLOW
std frontled2
ldd backled1
eorb WHITE
jsr lsld_func
eorb WHITE
jsr lsld_func
eorb WHITE
jsr lsld_func
eorb WHITE
std backled1
ldd backled2
eorb WHITE
jsr lsld_func
eorb WHITE
jsr lsld_func
eorb WHITE
jsr lsld_func
eorb WHITE
std backled2
ldd topled1
eorb BLUE
jsr lsld_func
eorb BLUE
jsr lsld_func
eorb BLUE
jsr lsld_func
eorb BLUE
std topled1
ldd topled2
eorb BLUE
jsr lsld_func
eorb BLUE
jsr lsld_func
eorb BLUE
jsr lsld_func
eorb BLUE
std topled2
ldd bottomled1
eorb GREEN
jsr lsld_func
eorb GREEN
jsr lsld_func
eorb GREEN
jsr lsld_func
eorb GREEN
std bottomled1
ldd bottomled2
eorb GREEN
jsr lsld_func
eorb GREEN
jsr lsld_func
eorb GREEN
jsr lsld_func
eorb GREEN
std bottomled2
ldd leftled1
eorb RED
jsr lsld_func
eorb RED
jsr lsld_func
eorb RED
jsr lsld_func
eorb RED
std leftled1
ldd leftled2
eorb RED
jsr lsld_func
eorb RED
jsr lsld_func
eorb RED
jsr lsld_func
eorb RED
std leftled2
ldd rightled1
eorb MAGENTA
jsr lsld_func
eorb MAGENTA
jsr lsld_func
eorb MAGENTA
jsr lsld_func
eorb MAGENTA
std rightled1
ldd rightled2
eorb MAGENTA
jsr lsld_func
eorb MAGENTA
jsr lsld_func
eorb MAGENTA
jsr lsld_func
eorb MAGENTA
std rightled2
; Initialize digital I/O port pins
movb #$00,ATDDIEN ; program PAD pins to all output
movb #$3F,prevpb ; initialize previous pushbutton state
movb #$C0,DDRT ; initialize PT pins
movb #$3F,DDRAD ; initialize PTAD pins
; Initialize RTI for 2.048 ms interrupt rate
movb #$1F,RTICTL
bclr CRGINT,$80
;
; Initialize the PWM unit to produce a signal with the following
; characteristics on PWM output channel 2:
; - sampling frequency of approximately 100 Hz
; - left-aligned, negative polarity
; - period register = $FF (yielding a duty cycle range of 0% to 100%,
; for duty cycle register values of $00 to $FF
; - duty register = $00 (motor initially stopped)
;
; IMPORTANT: Need to set MODRR so that PWM Ch 2 is routed to port pin PT2
;
;
movb #$20,PWME ;enable ch 5
movb #$00,MODRR
movb #$04,PWMPRCLK ;clock A = bus clock / 16
movb #!75,PWMSCLA ;clock SA = clock A / (2 * 75)
movb #$00,PWMPOL
movb #!100,PWMPER5 ;period
movb #$00,PWMCAE ;left aligned
movb #$20,PWMCLK ;clock = clock SA
movb #!50,PWMDTY5 ; duty cycle, 0% to 100%
; output freq = 24Mhz / 16 / PER / (2 * 75)
; Initialize TIM Ch 7 (TC7) for periodic interrupts every 1 ms
; Enable timer subsystem
; Set channel 7 for output compare
; Set appropriate pre-scale factor and enable counter reset after OC7
; Set up channel 7 to generate 1 ms interrupt rate
; Initially disable TIM Ch 7 interrupts
movb #$80,TSCR1
movb #$80,TIOS
movb #$0C,TSCR2
movw #!1500,TC7
movb #$00,TIE
cli
;================================================================
;
; Start of main loop
;
; *** NOTE *** Add anything else you deem necessary
;
bclr PTT,$C0
bclr PTAD,$3F
bset TIE,$80 ;enable timer interrupt
bclr PTAD,$20 ;active low enable for MUX
bset PTAD,$0C ;select output to none for MUX
bset PTAD,$10 ;set MUX input to high
bclr PTT,$80 ;set data to low
bset PTT,$40 ;set clock to high
movb pbA,$00
movb pbB,$00
movb pbC,$00
movb pbD,$00
movb pbE,$00
movb pbF,$00
inc paint
main_loop
ldaa paint
cmpa #$01
lblo mains
jmp stillpainting
mains
brclr SCISR1,rxdrf,main1
ldaa SCIDRL
jsr incomingData
main1 ldaa pbA
beq main2
clr pbA
jsr pressedRight
jmp main2
main2 ldaa pbB
beq main3
clr pbB
jsr pressedFront
jmp main3
main3 ldaa pbC
beq main4
clr pbC
jsr pressedLeft
jmp main4
main4 ldaa pbD
beq main5
clr pbD
jsr pressedBack
jmp main5
main5 ldaa pbE
beq main6
clr pbE
jsr pressedTop
jmp main6
main6 ldaa pbF
beq main7
clr pbF
jsr pressedBottom
jmp main7
main7
ldaa paint
cmpa #$01
lblo loop
stillpainting
jsr painting_solved
loop jmp main_loop ; main is a continuous polling loop
;***********************************************************************
;incomingData
incomingData
cmpa #$C1
lbne next1
jmp gohome
next1
cmpa #$C2
lbne next2
jmp gohome
next2
cmpa #$C3
lbne next3
jsr setpushbutton
jmp gohome
next3
cmpa #$40
lbne gohome
jsr resetstate
gohome
rts
;***********************************************************************
;setpushbutton
setpushbutton
jsr getData
cmpa #$01
bne bt2
jsr pressedFront
jmp bt8
bt2
cmpa #$02
bne bt3
jsr pressedBack
jmp bt8
bt3
cmpa #$03
bne bt4
jsr pressedTop
jmp bt8
bt4
cmpa #$04
bne bt5
jsr pressedBottom
jmp bt8
bt5
cmpa #$05
bne bt6
jsr pressedLeft
jmp bt8
bt6
cmpa #$06
bne bt7
jsr pressedRight
jmp bt8
bt7 jmp bt10
bt8
inc paint
clr setled
clr countled
clr countlights
clr countdrivers
bt9
jsr painting_solved
ldaa paint
cmpa #$00
bne bt9
jmp setpushbutton
bt10
rts
;***********************************************************************
;registerinfo
registerinfo
clr countled
clr countdrivers
clr storeinfo
movw #$0000, frontled1
movw #$0000, frontled2
movw #$0000, backled1
movw #$0000, backled2
movw #$0000, topled1
movw #$0000, topled2
movw #$0000, bottomled1
movw #$0000, bottomled2
movw #$0000, leftled1
movw #$0000, leftled2
movw #$0000, rightled1
movw #$0000, rightled2
jsr getData
regmain
staa storeinfo
ldaa countdrivers
regd0
cmpa #$00
lbne regd2
ldaa countled
cmpa #$04
lbeq incdrivers
ldaa storeinfo
r00
cmpa #$41
lbne r01
ldd frontled1
eorb BLUE
jsr lsld_func
std frontled1
inc countled
jsr getData
jmp regmain
r01
cmpa #$42
lbne r02
ldd frontled1
eorb GREEN
jsr lsld_func
std frontled1
inc countled
jsr getData
jmp regmain
r02
cmpa #$44
lbne r03
ldd frontled1
eorb RED
jsr lsld_func
std frontled1
inc countled
jsr getData
jmp regmain
r03
cmpa #$45
lbne r04
ldd frontled1
eorb MAGENTA
jsr lsld_func
std frontled1
inc countled
jsr getData
jmp regmain
r04
cmpa #$46
lbne r05
ldd frontled1
eorb YELLOW
jsr lsld_func
std frontled1
inc countled
jsr getData
jmp regmain
r05
cmpa #$47
lbne r06
ldd frontled1
eorb WHITE
jsr lsld_func
std frontled1
inc countled
jsr getData
jmp regmain
r06
jmp goaway
regd1
inc paint
cmpa #$01
lbne regd2
ldaa countled
cmpa #$04
lbeq incdrivers
ldaa storeinfo
r10
cmpa #$41
lbne r11
ldd frontled2
eorb BLUE
jsr lsld_func
std frontled2
inc countled
jsr getData
jmp regmain
r11
cmpa #$42
lbne r12
ldd frontled2
eorb GREEN
jsr lsld_func
std frontled2
inc countled
jsr getData
jmp regmain
r12
cmpa #$44
lbne r13
ldd frontled2
eorb RED
jsr lsld_func
std frontled2
inc countled
jsr getData
jmp regmain
r13
cmpa #$45
lbne r14
ldd frontled2
eorb MAGENTA
jsr lsld_func
std frontled2
inc countled
jsr getData
jmp regmain
r14
cmpa #$46
lbne r15
ldd frontled2
eorb YELLOW
jsr lsld_func
std frontled2
inc countled
jsr getData
jmp regmain
r15
cmpa #$47
lbne r16
ldd frontled2
eorb WHITE
jsr lsld_func
std frontled2
inc countled
jsr getData
jmp regmain
r16
jmp goaway
regd2
cmpa #$02
lbne regd3
ldaa countled
cmpa #$04
lbeq incdrivers
ldaa storeinfo
r20
cmpa #$41
lbne r21
ldd backled1
eorb BLUE
jsr lsld_func
std backled1
inc countled
jsr getData
jmp regmain
r21
cmpa #$42
lbne r22
ldd backled1
eorb GREEN
jsr lsld_func
std backled1
inc countled
jsr getData
jmp regmain
r22
cmpa #$44
lbne r23
ldd backled1
eorb RED
jsr lsld_func
std backled1
inc countled
jsr getData
jmp regmain
r23
cmpa #$45
lbne r24
ldd backled1
eorb MAGENTA
jsr lsld_func
std backled1
inc countled
jsr getData
jmp regmain
r24
cmpa #$46
lbne r25
ldd backled1
eorb YELLOW
jsr lsld_func
std backled1
inc countled
jsr getData
jmp regmain
r25
cmpa #$47
lbne r26
ldd backled1
eorb WHITE
jsr lsld_func
std backled1
inc countled
jsr getData
jmp regmain
r26
jmp goaway
regd3
cmpa #$03
lbne regd4
ldaa countled
cmpa #$04
lbeq incdrivers
ldaa storeinfo
r30
cmpa #$41
lbne r31
ldd backled2
eorb BLUE
jsr lsld_func
std backled2
inc countled
jsr getData
jmp regmain
r31
cmpa #$42
lbne r32
ldd backled2
eorb GREEN
jsr lsld_func
std backled2
inc countled
jsr getData
jmp regmain
r32
cmpa #$44
lbne r33
ldd backled2
eorb RED
jsr lsld_func
std backled2
inc countled
jsr getData
jmp regmain
r33
cmpa #$45
lbne r34
ldd backled2
eorb MAGENTA
jsr lsld_func
std backled2
inc countled
jsr getData
jmp regmain
r34
cmpa #$46
lbne r35
ldd backled2
eorb YELLOW
jsr lsld_func
std backled2
inc countled
jsr getData
jmp regmain
r35
cmpa #$47
lbne r36
ldd backled2
eorb WHITE
jsr lsld_func
std backled2
inc countled
jsr getData
jmp regmain
r36
jmp goaway
regd4
cmpa #$04
lbne regd5
ldaa countled
cmpa #$04
lbeq incdrivers
ldaa storeinfo
r40
cmpa #$41
lbne r41
ldd topled1
eorb BLUE
jsr lsld_func
std topled1
inc countled
jsr getData
jmp regmain
r41
cmpa #$42
lbne r42
ldd topled1
eorb GREEN
jsr lsld_func
std topled1
inc countled
jsr getData
jmp regmain
r42
cmpa #$44
lbne r43
ldd topled1
eorb RED
jsr lsld_func
std topled1
inc countled
jsr getData
jmp regmain
r43
cmpa #$45
lbne r44
ldd topled1
eorb MAGENTA
jsr lsld_func
std topled1
inc countled
jsr getData
jmp regmain
r44
cmpa #$46
lbne r45
ldd topled1
eorb YELLOW
jsr lsld_func
std topled1
inc countled
jsr getData
jmp regmain
r45
cmpa #$47
lbne r46
ldd topled1
eorb WHITE
jsr lsld_func
std topled1
inc countled
jsr getData
jmp regmain
r46
jmp goaway
regd5
cmpa #$05
lbne regd6
ldaa countled
cmpa #$04
lbeq incdrivers
ldaa storeinfo
r50
cmpa #$41
lbne r51
ldd topled2
eorb BLUE
jsr lsld_func
std topled2
inc countled
jsr getData
jmp regmain
r51
cmpa #$42
lbne r52
ldd topled2
eorb GREEN
jsr lsld_func
std topled2
inc countled
jsr getData
jmp regmain
r52
cmpa #$44
lbne r53
ldd topled2
eorb RED
jsr lsld_func
std topled2
inc countled
jsr getData
jmp regmain
r53
cmpa #$45
lbne r54
ldd topled2
eorb MAGENTA
jsr lsld_func
std topled2
inc countled
jsr getData
jmp regmain
r54
cmpa #$46
lbne r55
ldd topled2
eorb YELLOW
jsr lsld_func
std topled2
inc countled
jsr getData
jmp regmain
r55
cmpa #$47
lbne r56
ldd topled2
eorb WHITE
jsr lsld_func
std topled2
inc countled
jsr getData
jmp regmain
r56
jmp goaway
regd6
cmpa #$06
lbne regd7
ldaa countled
cmpa #$04
lbeq incdrivers
ldaa storeinfo
r60
cmpa #$41
lbne r61
ldd bottomled1
eorb BLUE
jsr lsld_func
std bottomled1
inc countled
jsr getData
jmp regmain
r61
cmpa #$42
lbne r62
ldd bottomled1
eorb GREEN
jsr lsld_func
std bottomled1
inc countled
jsr getData
jmp regmain
r62
cmpa #$44
lbne r63
ldd bottomled1
eorb RED
jsr lsld_func
std bottomled1
inc countled
jsr getData
jmp regmain
r63
cmpa #$45
lbne r64
ldd bottomled1
eorb MAGENTA
jsr lsld_func
std bottomled1
inc countled
jsr getData
jmp regmain
r64
cmpa #$46
lbne r65
ldd bottomled1
eorb YELLOW
jsr lsld_func
std bottomled1
inc countled
jsr getData
jmp regmain
r65
cmpa #$47
lbne r66
ldd bottomled1
eorb WHITE
jsr lsld_func
std bottomled1
inc countled
jsr getData
jmp regmain
r66
jmp goaway
regd7
cmpa #$07
lbne regd8
ldaa countled
cmpa #$04
lbeq incdrivers
ldaa storeinfo
r70
cmpa #$41
lbne r71
ldd bottomled2
eorb BLUE
jsr lsld_func
std bottomled2
inc countled
jsr getData
jmp regmain
r71
cmpa #$42
lbne r72
ldd bottomled2
eorb GREEN
jsr lsld_func
std bottomled2
inc countled
jsr getData
jmp regmain
r72
cmpa #$44
lbne r73
ldd bottomled2
eorb RED
jsr lsld_func
std bottomled2
inc countled
jsr getData
jmp regmain
r73
cmpa #$45
lbne r74
ldd bottomled2
eorb MAGENTA
jsr lsld_func
std bottomled2
inc countled
jsr getData
jmp regmain
r74
cmpa #$46
lbne r75
ldd bottomled2
eorb YELLOW
jsr lsld_func
std bottomled2
inc countled
jsr getData
jmp regmain
r75
cmpa #$47
lbne r76
ldd bottomled2
eorb WHITE
jsr lsld_func
std bottomled2
inc countled
jsr getData
jmp regmain
r76
jmp goaway
regd8
cmpa #$08
lbne regd9
ldaa countled
cmpa #$04
lbeq incdrivers
ldaa storeinfo
r80
cmpa #$41
lbne r81
ldd leftled1
eorb BLUE
jsr lsld_func
std leftled1
inc countled
jsr getData
jmp regmain
r81
cmpa #$42
lbne r82
ldd leftled1
eorb GREEN
jsr lsld_func
std leftled1
inc countled
jsr getData
jmp regmain
r82
cmpa #$44
lbne r83
ldd leftled1
eorb RED
jsr lsld_func
std leftled1
inc countled
jsr getData
jmp regmain
r83
cmpa #$45
lbne r84
ldd leftled1
eorb MAGENTA
jsr lsld_func
std leftled1
inc countled
jsr getData
jmp regmain
r84
cmpa #$46
lbne r85
ldd leftled1
eorb YELLOW
jsr lsld_func
std leftled1
inc countled
jsr getData
jmp regmain
r85
cmpa #$47
lbne r86
ldd leftled1
eorb WHITE
jsr lsld_func
std leftled1
inc countled
jsr getData
jmp regmain
r86
jmp goaway
regd9
cmpa #$09
lbne regdA
ldaa countled
cmpa #$04
lbeq incdrivers
ldaa storeinfo
r90
cmpa #$41
lbne r91
ldd leftled2
eorb BLUE
jsr lsld_func
std leftled2
inc countled
jsr getData
jmp regmain
r91
cmpa #$42
lbne r92
ldd leftled2
eorb GREEN
jsr lsld_func
std leftled2
inc countled
jsr getData
jmp regmain
r92
cmpa #$44
lbne r93
ldd leftled2
eorb RED
jsr lsld_func
std leftled2
inc countled
jsr getData
jmp regmain
r93
cmpa #$45
lbne r94
ldd leftled2
eorb MAGENTA
jsr lsld_func
std leftled2
inc countled
jsr getData
jmp regmain
r94
cmpa #$46
lbne r95
ldd leftled2
eorb YELLOW
jsr lsld_func
std leftled2
inc countled
jsr getData
jmp regmain
r95
cmpa #$47
lbne r96
ldd leftled2
eorb WHITE
jsr lsld_func
std leftled2
inc countled
jsr getData
jmp regmain
r96
jmp goaway
regdA
cmpa #$0A
lbne regdB
ldaa countled
cmpa #$04
lbeq incdrivers
ldaa storeinfo
rA0
cmpa #$41
lbne rA1
ldd rightled1
eorb BLUE
jsr lsld_func
std rightled1
inc countled
jsr getData
jmp regmain
rA1
cmpa #$42
lbne rA2
ldd rightled1
eorb GREEN
jsr lsld_func
std rightled1
inc countled
jsr getData
jmp regmain
rA2
cmpa #$44
lbne rA3
ldd rightled1
eorb RED
jsr lsld_func
std rightled1
inc countled
jsr getData
jmp regmain
rA3
cmpa #$45
lbne rA4
ldd rightled1
eorb MAGENTA
jsr lsld_func
std rightled1
inc countled
jsr getData
jmp regmain
rA4
cmpa #$46
lbne rA5
ldd rightled1
eorb YELLOW
jsr lsld_func
std rightled1
inc countled
jsr getData
jmp regmain
rA5
cmpa #$47
lbne rA6
ldd rightled1
eorb WHITE
jsr lsld_func
std rightled1
inc countled
jsr getData
jmp regmain
rA6
jmp goaway
regdB
cmpa #$0B
lbne regmain
ldaa countled
cmpa #$04
lbeq incdrivers
ldaa storeinfo
rB0
cmpa #$41
lbne rB1
ldd rightled2
eorb BLUE
jsr lsld_func
std rightled2
inc countled
jsr getData
jmp regmain
rB1
cmpa #$42
lbne rB2
ldd rightled2
eorb GREEN
jsr lsld_func
std rightled2
inc countled
jsr getData
jmp regmain
rB2
cmpa #$44
lbne rB3
ldd rightled2
eorb RED
jsr lsld_func
std rightled2
inc countled
jsr getData
jmp regmain
rB3
cmpa #$45
lbne rB4
ldd rightled2
eorb MAGENTA
jsr lsld_func
std rightled2
inc countled
jsr getData
jmp regmain
rB4
cmpa #$46
lbne rB5
ldd rightled2
eorb YELLOW
jsr lsld_func
std rightled2
inc countled
jsr getData
jmp regmain
rB5
cmpa #$47
lbne rB6
ldd rightled2
eorb WHITE
jsr lsld_func
std rightled2
inc countled
jsr getData
jmp regmain
rB6
jmp goaway
incdrivers
inc countdrivers
clr countled
clr storeinfo
jsr getData
jmp regmain
goaway
movw #$0000, frontled1
movw #$0000, frontled2
movw #$0000, backled1
movw #$0000, backled2
movw #$0000, topled1
movw #$0000, topled2
movw #$0000, bottomled1
movw #$0000, bottomled2
movw #$0000, leftled1
movw #$0000, leftled2
movw #$0000, rightled1
movw #$0000, rightled2
clr setled
clr countled
clr countlights
clr countdrivers
ba1
jsr painting_solved
ldaa paint
cmpa #$00
bne ba1
rts
cmpa #$40
beq donewithreg
jmp regmain
donewithreg
clr countdrivers
clr countled
clr storeinfo
inc paint
rts
;***********************************************************************
;getData
getData
ldaa #$80
brclr SCISR1,txdre,getData
staa SCIDRL
brclr SCISR1,rxdrf,getData
ldaa SCIDRL
cmpa #$01
beq leavedata
cmpa #$02
beq leavedata
cmpa #$03
beq leavedata
cmpa #$04
beq leavedata
cmpa #$05
beq leavedata
cmpa #$06
beq leavedata
cmpa #$C1
beq leavedata
cmpa #$C2
beq leavedata
cmpa #$C3
beq leavedata
cmpa #$41
beq leavedata
cmpa #$42
beq leavedata
cmpa #$44
beq leavedata
cmpa #$45
beq leavedata
cmpa #$46
beq leavedata
cmpa #$47
beq leavedata
jmp getData
leavedata
rts
;***********************************************************************
;PressedLeft
;
;
pressedLeft ;the left side button
bclr CRGINT,$80
;rotate the side of the button
;aka the easy part
movw #$0000,regholder1
movw #$0000,regholder2
ldd leftled1
std regholder1
ldd leftled2
std regholder2
ldd leftled1
jsr lsld_func
jsr lsld_func
andb #$00
std leftled1
ldd leftled2
andb #$00
std regholder2
ldd leftled1
eorb regholder2
std leftled1
ldd leftled2
jsr lsld_func
jsr lsld_func
std leftled2
ldd regholder1
andb #$00
std regholder1
ldd leftled2
eorb regholder1
std leftled2
movw #$0000,regholder1
movw #$0000,regholder2
;rotate the other sides
ldd topled1
std regholder1
jsr lsld_func
jsr lsld_func
jsr lsld_func
jsr lsrd_func
std topled1
ldd backled2
jsr lsrd_func
jsr lsld_func
eorb topled1
std topled1
ldd frontled1
std regholder2
jsr lsld_func
jsr lsld_func
jsr lsld_func
jsr lsrd_func
std frontled1
ldd regholder1
jsr lsrd_func
jsr lsld_func
eorb frontled1
std frontled1
ldd bottomled2
std regholder1
jsr lsld_func
jsr lsld_func
jsr lsld_func
jsr lsrd_func
std bottomled2
ldd regholder2
jsr lsrd_func
jsr lsld_func
eorb bottomled2
std bottomled2
ldd backled2
jsr lsld_func
jsr lsld_func
jsr lsld_func
jsr lsrd_func
std backled2
ldd regholder1
jsr lsrd_func
jsr lsld_func
eorb backled2
std backled2
movw #$0000,regholder1
movw #$0000,regholder2
ldaa #$05
outcharLt brclr SCISR1,txdre,outcharLt
staa SCIDRL
inc paint
bset CRGINT,$80
clr pbC
donewithA
clr countlights
rts
;***********************************************************************
;PressedRight
;
;
pressedRight ;the right side button
bclr CRGINT,$80
;rotate the side of the button
;aka theeasy part
movw #$0000,regholder1
movw #$0000,regholder2
ldd rightled1
std regholder1
ldd rightled2
std regholder2
ldd rightled1
jsr lsld_func
jsr lsld_func
ldab rightled2
std rightled1
ldd rightled2
jsr lsld_func
jsr lsld_func
ldab regholder1
std rightled2
movw #$0000,regholder1
movw #$0000,regholder2
;rotate the other sides
ldd topled2
std regholder1
jsr lsld_func
jsr lsld_func
jsr lsld_func
jsr lsrd_func
std topled2
ldd frontled2
jsr lsrd_func
jsr lsld_func
eorb topled2
std topled2
ldd backled1
std regholder2
jsr lsld_func
jsr lsld_func
jsr lsld_func
jsr lsrd_func
std backled1
ldd regholder1
jsr lsrd_func
jsr lsld_func
eorb backled1
std backled1
ldd bottomled1
std regholder1
jsr lsld_func
jsr lsld_func
jsr lsld_func
jsr lsrd_func
std bottomled1
ldd regholder2
jsr lsrd_func
jsr lsld_func
eorb bottomled1
std bottomled1
ldd frontled2
jsr lsld_func
jsr lsld_func
jsr lsld_func
jsr lsrd_func
std frontled2
ldd regholder1
jsr lsrd_func
jsr lsld_func
eorb frontled2
std frontled2
movw #$0000,regholder1
movw #$0000,regholder2
ldaa #$06
outcharRt brclr SCISR1,txdre,outcharRt
staa SCIDRL
inc paint
bset CRGINT,$80
clr pbA
donewithRight
rts
;***********************************************************************
;PressedTop
;
;
pressedTop ;the top side button
bclr CRGINT,$80
;rotate the side of the button
;aka theeasy part
movw #$0000,regholder1
movw #$0000,regholder2
ldd topled1
std regholder1
ldd topled2
std regholder2
ldd topled1
jsr lsld_func
jsr lsld_func
ldab topled2
std topled1
ldd topled2
jsr lsld_func
jsr lsld_func
ldab regholder1
std topled2
movw #$0000,regholder1
movw #$0000,regholder2
movw #$0000,regholder3
movw #$0000,regholder4
;rotate the other sides
ldd frontled1
jsr lsrd_func
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
jsr lsld_func
std regholder1
ldd leftled1
std regholder2
jsr lsld_func
jsr lsrd_func
eora regholder1
std leftled1
ldd frontled2
jsr lsld_func
jsr lsld_func
std regholder1
ldd leftled2
std regholder3
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
eorb regholder1
std leftled2
ldd regholder2
jsr lsrd_func
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
jsr lsld_func
std regholder1
ldd backled1
std regholder2
jsr lsld_func
jsr lsrd_func
eora regholder1
std backled1
ldd regholder3
jsr lsld_func
jsr lsld_func
std regholder1
ldd backled2
std regholder3
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
eorb regholder1
std backled2
ldd regholder2
jsr lsrd_func
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
jsr lsld_func
std regholder1
ldd rightled1
std regholder2
jsr lsld_func
jsr lsrd_func
eora regholder1
std rightled1
ldd regholder3
jsr lsld_func
jsr lsld_func
std regholder1
ldd rightled2
std regholder3
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
eorb regholder1
std rightled2
ldd regholder2
jsr lsrd_func
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
jsr lsld_func
std regholder1
ldd frontled1
std regholder2
jsr lsld_func
jsr lsrd_func
eora regholder1
std frontled1
ldd regholder3
jsr lsld_func
jsr lsld_func
std regholder1
ldd frontled2
std regholder3
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
eorb regholder1
std frontled2
ldaa #$03
outcharTop brclr SCISR1,txdre,outcharTop
staa SCIDRL
inc paint
bset CRGINT,$80
clr pbE
donewithTop
rts
;***********************************************************************
;PressedBottom
;
;
pressedBottom ;the bottom side button
bclr CRGINT,$80
;rotate the side of the button
;aka theeasy part
movw #$0000,regholder1
movw #$0000,regholder2
ldd bottomled1
std regholder1
ldd bottomled2
std regholder2
ldd bottomled1
jsr lsld_func
jsr lsld_func
ldab bottomled2
std bottomled1
ldd bottomled2
jsr lsld_func
jsr lsld_func
ldab regholder1
std bottomled2
movw #$0000,regholder1
movw #$0000,regholder2
movw #$0000,regholder3
movw #$0000,regholder4
;rotate the other sides
ldd frontled2
jsr lsrd_func
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
jsr lsld_func
std regholder1
ldd rightled2
std regholder2
jsr lsld_func
jsr lsrd_func
eora regholder1
std rightled2
ldd frontled1
jsr lsld_func
jsr lsld_func
std regholder1
ldd rightled1
std regholder3
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
eorb regholder1
std rightled1
ldd regholder2
jsr lsrd_func
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
jsr lsld_func
std regholder1
ldd backled2
std regholder2
jsr lsld_func
jsr lsrd_func
eora regholder1
std backled2
ldd regholder3
jsr lsld_func
jsr lsld_func
std regholder1
ldd backled1
std regholder3
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
eorb regholder1
std backled1
ldd regholder2
jsr lsrd_func
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
jsr lsld_func
std regholder1
ldd leftled2
std regholder2
jsr lsld_func
jsr lsrd_func
eora regholder1
std leftled2
ldd regholder3
jsr lsld_func
jsr lsld_func
std regholder1
ldd leftled1
std regholder3
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
eorb regholder1
std leftled1
ldd regholder2
jsr lsrd_func
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
jsr lsld_func
std regholder1
ldd frontled2
std regholder2
jsr lsld_func
jsr lsrd_func
eora regholder1
std frontled2
ldd regholder3
jsr lsld_func
jsr lsld_func
std regholder1
ldd frontled1
std regholder3
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
eorb regholder1
std frontled1
ldaa #$04
outcharBot brclr SCISR1,txdre,outcharBot
staa SCIDRL
inc paint
bset CRGINT,$80
clr pbF
donewithBot
rts
;***********************************************************************
;PressedFront
;
;
pressedFront ;the front side button
bclr CRGINT,$80
;rotate the side of the button
;aka theeasy part
movw #$0000,regholder1
movw #$0000,regholder2
ldd frontled1
std regholder1
ldd frontled2
std regholder2
ldd frontled1
jsr lsld_func
jsr lsld_func
ldab frontled2
std frontled1
ldd frontled2
jsr lsld_func
jsr lsld_func
ldab regholder1
std frontled2
movw #$0000,regholder1
movw #$0000,regholder2
movw #$0000,regholder3
movw #$0000,regholder4
;rotate the other sides
ldd bottomled2
std regholder3
ldd bottomled1
std regholder4
ldd topled1
jsr lsld_func
jsr lsld_func
std regholder1
ldd topled2
jsr lsrd_func
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
eora regholder1
std regholder1
ldd rightled1
std regholder2
jsr lsld_func
jsr lsld_func
jsr lsld_func
jsr lsrd_func
std rightled1
ldd regholder1
eorb rightled1
std rightled1
ldd bottomled1
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
std bottomled1
ldd regholder2
jsr lsrd_func
jsr lsrd_func
eora bottomled1
std bottomled1
ldd bottomled2
jsr lsld_func
jsr lsrd_func
std bottomled2
ldd regholder2
jsr lsrd_func
jsr lsld_func
jsr lsld_func
jsr lsld_func
std regholder2
ldd bottomled2
eora regholder2
std bottomled2
ldd regholder4
jsr lsld_func
jsr lsld_func
std regholder1
ldd regholder3
jsr lsrd_func
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
eora regholder1
std regholder1
ldd leftled2
std regholder2
jsr lsld_func
jsr lsld_func
jsr lsld_func
jsr lsrd_func
std leftled2
ldd regholder1
eorb leftled2
std leftled2
ldd topled1
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
std topled1
ldd regholder2
jsr lsrd_func
jsr lsrd_func
eora topled1
std topled1
ldd topled2
jsr lsld_func
jsr lsrd_func
std topled2
ldd regholder2
jsr lsrd_func
jsr lsld_func
jsr lsld_func
jsr lsld_func
std regholder2
ldd topled2
eora regholder2
std topled2
ldaa #$01
outcharFr brclr SCISR1,txdre,outcharFr
staa SCIDRL
inc paint
bset CRGINT,$80
clr pbB
donewithFr
rts
;***********************************************************************
;PressedBack
;
;
pressedBack ;the back side button
bclr CRGINT,$80
;rotate the side of the button
;aka theeasy part
movw #$0000,regholder1
movw #$0000,regholder2
movw #$0000,regholder3
movw #$0000,regholder4
ldd backled1
std regholder1
ldd backled2
std regholder2
ldd backled1
jsr lsld_func
jsr lsld_func
ldab backled2
std backled1
ldd backled2
jsr lsld_func
jsr lsld_func
ldab regholder1
std backled2
movw #$0000,regholder1
movw #$0000,regholder2
movw #$0000,regholder3
movw #$0000,regholder4
;rotate the other sides
ldd bottomled1
std regholder3
ldd bottomled2
std regholder4
ldd topled2
jsr lsld_func
jsr lsld_func
std regholder1
ldd topled1
jsr lsrd_func
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
eora regholder1
std regholder1
ldd leftled1
std regholder2
jsr lsld_func
jsr lsld_func
jsr lsld_func
jsr lsrd_func
std leftled1
ldd regholder1
eorb leftled1
std leftled1
ldd bottomled2
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
std bottomled2
ldd regholder2
jsr lsrd_func
jsr lsrd_func
eora bottomled2
std bottomled2
ldd bottomled1
jsr lsld_func
jsr lsrd_func
std bottomled1
ldd regholder2
jsr lsrd_func
jsr lsld_func
jsr lsld_func
jsr lsld_func
std regholder2
ldd bottomled1
eora regholder2
std bottomled1
ldd regholder4
jsr lsld_func
jsr lsld_func
std regholder1
ldd regholder3
jsr lsrd_func
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
eora regholder1
std regholder1
ldd rightled2
std regholder2
jsr lsld_func
jsr lsld_func
jsr lsld_func
jsr lsrd_func
std rightled2
ldd regholder1
eorb rightled2
std rightled2
ldd topled2
jsr lsrd_func
jsr lsrd_func
jsr lsld_func
jsr lsld_func
std topled2
ldd regholder2
jsr lsrd_func
jsr lsrd_func
eora topled2
std topled2
ldd topled1
jsr lsld_func
jsr lsrd_func
std topled1
ldd regholder2
jsr lsrd_func
jsr lsld_func
jsr lsld_func
jsr lsld_func
std regholder2
ldd topled1
eora regholder2
std topled1
ldaa #$02
outcharBk brclr SCISR1,txdre,outcharBk
staa SCIDRL
inc paint
bset CRGINT,$80
clr pbD
donewithBk
rts
;***********************************************************************
;Painter
;This is the main function that paints all our sides
;the based on the values in the driver registers
painting_solved
bclr CRGINT,$80
ldaa halfsec
lbeq done
clr halfsec
clr TCNT
clr TCNT+1
ldaa countdrivers
cmpa #$0D
lbhs donepainting
ldaa PTT
eora #$40
staa PTT
ldaa countdrivers
cmpa #$0C
lblo gohere1
ldaa countclk
cmpa #$01
lbne gohere1
jmp clearlights
gohere1
inc countclk
ldaa countclk
cmpa #$02
lbne done
clr countclk
ldaa countdrivers
cmpa #$00
lbne driver2
driver1
ldaa PTAD
anda #$F0
staa PTAD
ldaa setled
cmpa #$00
lbne temp1
inc setled
ldd rightled1
std temp
temp1
ldd temp
lsrd
std temp
lbcc gotozero1
jsr gotoone
jmp next11
gotozero1
jsr gotozero
next11
inc countlights
ldaa countlights
cmpa #$03
bne next12
clr countlights
inc countled
ldd temp
lsrd
std temp
next12
ldaa countled
cmpa #$04
lbeq clearlights
jmp done
driver2
ldaa countdrivers
cmpa #$01
lbne driver3
ldaa PTAD
anda #$F0
eora #$01
staa PTAD
ldaa setled
cmpa #$00
lbne temp2
inc setled
ldd rightled2
std temp
temp2
ldd temp
lsrd
std temp
lbcc gotozero2
jsr gotoone
jmp next21
gotozero2
jsr gotozero
next21
inc countlights
ldaa countlights
cmpa #$03
bne next22
clr countlights
inc countled
ldd temp
lsrd
std temp
next22
ldaa countled
cmpa #$04
lbeq clearlights
jmp done
driver3
ldaa countdrivers
cmpa #$02
lbne driver4
ldaa PTAD
anda #$F0
eora #$02
staa PTAD
ldaa setled
cmpa #$00
lbne temp3
inc setled
ldd frontled1
std temp
temp3
ldd temp
lsrd
std temp
lbcc gotozero3
jsr gotoone
jmp next31
gotozero3
jsr gotozero
next31
inc countlights
ldaa countlights
cmpa #$03
bne next32
clr countlights
inc countled
ldd temp
lsrd
std temp
next32
ldaa countled
cmpa #$04
lbeq clearlights
jmp done
driver4
ldaa countdrivers
cmpa #$03
lbne driver5
ldaa PTAD
anda #$F0
eora #$03
staa PTAD
ldaa setled
cmpa #$00
lbne temp4
inc setled
ldd frontled2
std temp
temp4
ldd temp
lsrd
std temp
lbcc gotozero4
jsr gotoone
jmp next41
gotozero4
jsr gotozero
next41
inc countlights
ldaa countlights
cmpa #$03
bne next42
clr countlights
inc countled
ldd temp
lsrd
std temp
next42
ldaa countled
cmpa #$04
lbeq clearlights
jmp done
driver5
ldaa countdrivers
cmpa #$04
lbne driver6
ldaa PTAD
anda #$F0
eora #$04
staa PTAD
ldaa setled
cmpa #$00
lbne temp5
inc setled
ldd leftled1
std temp
temp5
ldd temp
lsrd
std temp
lbcc gotozero5
jsr gotoone
jmp next51
gotozero5
jsr gotozero
next51
inc countlights
ldaa countlights
cmpa #$03
bne next52
clr countlights
inc countled
ldd temp
lsrd
std temp
next52
ldaa countled
cmpa #$04
lbeq clearlights
jmp done
driver6
ldaa countdrivers
cmpa #$05
lbne driver7
ldaa PTAD
anda #$F0
eora #$05
staa PTAD
ldaa setled
cmpa #$00
lbne temp6
inc setled
ldd leftled2
std temp
temp6
ldd temp
lsrd
std temp
lbcc gotozero6
jsr gotoone
jmp next61
gotozero6
jsr gotozero
next61
inc countlights
ldaa countlights
cmpa #$03
bne next62
clr countlights
inc countled
ldd temp
lsrd
std temp
next62
ldaa countled
cmpa #$04
lbeq clearlights
jmp done
driver7
ldaa countdrivers
cmpa #$06
lbne driver8
ldaa PTAD
anda #$F0
eora #$06
staa PTAD
ldaa setled
cmpa #$00
lbne temp7
inc setled
ldd backled1
std temp
temp7
ldd temp
lsrd
std temp
lbcc gotozero7
jsr gotoone
jmp next71
gotozero7
jsr gotozero
next71
inc countlights
ldaa countlights
cmpa #$03
bne next72
clr countlights
ldd temp
inc countled
lsrd
std temp
next72
ldaa countled
cmpa #$04
lbeq clearlights
jmp done
driver8
ldaa countdrivers
cmpa #$07
lbne driver9
ldaa PTAD
anda #$F0
eora #$07
staa PTAD
ldaa setled
cmpa #$00
lbne temp8
inc setled
ldd backled2
std temp
temp8
ldd temp
lsrd
std temp
lbcc gotozero8
jsr gotoone
jmp next81
gotozero8
jsr gotozero
next81
inc countlights
ldaa countlights
cmpa #$03
bne next82
clr countlights
inc countled
ldd temp
lsrd
std temp
next82
ldaa countled
cmpa #$04
lbeq clearlights
jmp done
driver9
ldaa countdrivers
cmpa #$08
lbne driverA
ldaa PTAD
anda #$F0
eora #$08
staa PTAD
ldaa setled
cmpa #$00
lbne temp9
inc setled
ldd topled1
std temp
temp9
ldd temp
lsrd
std temp
lbcc gotozero9
jsr gotoone
jmp next91
gotozero9
jsr gotozero
next91
inc countlights
ldaa countlights
cmpa #$03
bne next92
clr countlights
inc countled
ldd temp
lsrd
std temp
next92
ldaa countled
cmpa #$04
lbeq clearlights
jmp done
driverA
ldaa countdrivers
cmpa #$09
lbne driverB
ldaa PTAD
anda #$F0
eora #$09
staa PTAD
ldaa setled
cmpa #$00
lbne tempA
inc setled
ldd topled2
std temp
tempA
ldd temp
lsrd
std temp
lbcc gotozeroA
jsr gotoone
jmp nextA1
gotozeroA
jsr gotozero
nextA1
inc countlights
ldaa countlights
cmpa #$03
bne nextA2
clr countlights
inc countled
ldd temp
lsrd
std temp
nextA2
ldaa countled
cmpa #$04
lbeq clearlights
jmp done
driverB
ldaa countdrivers
cmpa #$0A
lbne driverC
ldaa PTAD
anda #$F0
eora #$0A
staa PTAD
ldaa setled
cmpa #$00
lbne tempB
inc setled
ldd bottomled1
std temp
tempB
ldd temp
lsrd
std temp
lbcc gotozeroB
jsr gotoone
jmp nextB1
gotozeroB
jsr gotozero
nextB1
inc countlights
ldaa countlights
cmpa #$03
bne nextB2
clr countlights
inc countled
ldd temp
lsrd
std temp
nextB2
ldaa countled
cmpa #$04
lbeq clearlights
jmp done
driverC
ldaa countdrivers
cmpa #$0B
lbne done
ldaa PTAD
anda #$F0
eora #$0B
staa PTAD
ldaa setled
cmpa #$00
lbne tempC
inc setled
ldd bottomled2
std temp
tempC
ldd temp
lsrd
std temp
lbcc gotozeroC
jsr gotoone
jmp nextC1
gotozeroC
jsr gotozero
nextC1
inc countlights
ldaa countlights
cmpa #$03
bne nextC2
clr countlights
inc countled
ldd temp
lsrd
std temp
nextC2
ldaa countled
cmpa #$04
lbeq clearlights
jmp done
clearlights
clr setled
clr countled
clr countlights
movw #$0000, temp
inc countdrivers
jmp done
donepainting
clr paint
clr setled
clr countled
clr countlights
clr countdrivers
movw #$0000, temp
ldaa PTAD
anda #$F0
eora #$0C
staa PTAD
bset CRGINT,$80
done
rts
;***********************************************************************
; reset state of cube
resetstate
movw #$0000, frontled1
movw #$0000, frontled2
movw #$0000, backled1
movw #$0000, backled2
movw #$0000, topled1
movw #$0000, topled2
movw #$0000, bottomled1
movw #$0000, bottomled2
movw #$0000, leftled1
movw #$0000, leftled2
movw #$0000, rightled1
movw #$0000, rightled2
clr paint
clr setled
clr countled
clr countlights
clr countdrivers
movw #$0000, temp
ldd frontled1
eorb YELLOW
jsr lsld_func
eorb YELLOW
jsr lsld_func
eorb YELLOW
jsr lsld_func
eorb YELLOW
std frontled1
ldd frontled2
eorb YELLOW
jsr lsld_func
eorb YELLOW
jsr lsld_func
eorb YELLOW
jsr lsld_func
eorb YELLOW
std frontled2
ldd backled1
eorb WHITE
jsr lsld_func
eorb WHITE
jsr lsld_func
eorb WHITE
jsr lsld_func
eorb WHITE
std backled1
ldd backled2
eorb WHITE
jsr lsld_func
eorb WHITE
jsr lsld_func
eorb WHITE
jsr lsld_func
eorb WHITE
std backled2
ldd topled1
eorb BLUE
jsr lsld_func
eorb BLUE
jsr lsld_func
eorb BLUE
jsr lsld_func
eorb BLUE
std topled1
ldd topled2
eorb BLUE
jsr lsld_func
eorb BLUE
jsr lsld_func
eorb BLUE
jsr lsld_func
eorb BLUE
std topled2
ldd bottomled1
eorb GREEN
jsr lsld_func
eorb GREEN
jsr lsld_func
eorb GREEN
jsr lsld_func
eorb GREEN
std bottomled1
ldd bottomled2
eorb GREEN
jsr lsld_func
eorb GREEN
jsr lsld_func
eorb GREEN
jsr lsld_func
eorb GREEN
std bottomled2
ldd leftled1
eorb RED
jsr lsld_func
eorb RED
jsr lsld_func
eorb RED
jsr lsld_func
eorb RED
std leftled1
ldd leftled2
eorb RED
jsr lsld_func
eorb RED
jsr lsld_func
eorb RED
jsr lsld_func
eorb RED
std leftled2
ldd rightled1
eorb MAGENTA
jsr lsld_func
eorb MAGENTA
jsr lsld_func
eorb MAGENTA
jsr lsld_func
eorb MAGENTA
std rightled1
ldd rightled2
eorb MAGENTA
jsr lsld_func
eorb MAGENTA
jsr lsld_func
eorb MAGENTA
jsr lsld_func
eorb MAGENTA
std rightled2
inc paint
reset1
jsr painting_solved
ldaa paint
cmpa #$00
bne reset1
rts
;***********************************************************************
; GotoZero sets output to zero
gotozero
ldaa PTT
anda #$80
cmpa #$80
bne done1
ldaa PTT
eora #$80
staa PTT
done1
rts
;***********************************************************************
; GotoOne sets output to one
gotoone
ldaa PTT
anda #$80
cmpa #$80
beq done2
ldaa PTT
eora #$80
staa PTT
done2
rts
;***********************************************************************
;
; RTI interrupt service routine
;
; Initialized for 2.048 ms interrupt rate
;
; Samples state of pushbuttons (PAD7 = left, PAD6 = right)
;
; If change in state from "high" to "low" detected, set pushbutton flag
; leftpb (for PAD7 H -> L), rghtpb (for PAD6 H -> L)
; Recall that pushbuttons are momentary contact closures to ground
;
; Also, increments 2-byte variable "random" each time interrupt occurs
; NOTE: Will need to truncate "random" to 12-bits to get a reasonable delay
;
rti_isr bset crgflg,$80
contin
ldaa PTT
anda #$3F
cmpa prevpb
beq rti_exit
staa prevpb
lsra
lbcs bpb
inc pbA
bpb lsra
lbcs cpb
inc pbB
cpb lsra
lbcs dpb
inc pbC
dpb lsra
lbcs epb
inc pbD
epb lsra
lbcs fpb
inc pbE
fpb lsra
bcs rti_exit
inc pbF
rti_exit rti
;***********************************************************************
; Left Shift function
lsld_func
lsld
lsld
lsld
lsld
rts
;***********************************************************************
; Right Shift function
lsrd_func
lsrd
lsrd
lsrd
lsrd
rts
;***********************************************************************
;
; TIM interrupt service routine
;
; Initialized for 1.00 ms interrupt rate
;
tim_isr bset TFLG1,$80
inc onecnt
ldaa onecnt
cmpa #!1
bne tim_exit
clr onecnt
inc halfsec
tim_exit rti
;***********************************************************************
;
; *** NOTE *** Add any other routines you deem necessary
;
;***********************************************************************
;
; Define 'where you want to go today' (reset and interrupt vectors)
;
; If get a "bad" interrupt, just return from it
BadInt rti
; ------------------ VECTOR TABLE --------------------
org $FF8A
fdb BadInt ;$FF8A: VREG LVI
fdb BadInt ;$FF8C: PWM emergency shutdown
fdb BadInt ;$FF8E: PortP
fdb BadInt ;$FF90: Reserved
fdb BadInt ;$FF92: Reserved
fdb BadInt ;$FF94: Reserved
fdb BadInt ;$FF96: Reserved
fdb BadInt ;$FF98: Reserved
fdb BadInt ;$FF9A: Reserved
fdb BadInt ;$FF9C: Reserved
fdb BadInt ;$FF9E: Reserved
fdb BadInt ;$FFA0: Reserved
fdb BadInt ;$FFA2: Reserved
fdb BadInt ;$FFA4: Reserved
fdb BadInt ;$FFA6: Reserved
fdb BadInt ;$FFA8: Reserved
fdb BadInt ;$FFAA: Reserved
fdb BadInt ;$FFAC: Reserved
fdb BadInt ;$FFAE: Reserved
fdb BadInt ;$FFB0: CAN transmit
fdb BadInt ;$FFB2: CAN receive
fdb BadInt ;$FFB4: CAN errors
fdb BadInt ;$FFB6: CAN wake-up
fdb BadInt ;$FFB8: FLASH
fdb BadInt ;$FFBA: Reserved
fdb BadInt ;$FFBC: Reserved
fdb BadInt ;$FFBE: Reserved
fdb BadInt ;$FFC0: Reserved
fdb BadInt ;$FFC2: Reserved
fdb BadInt ;$FFC4: CRG self-clock-mode
fdb BadInt ;$FFC6: CRG PLL Lock
fdb BadInt ;$FFC8: Reserved
fdb BadInt ;$FFCA: Reserved
fdb BadInt ;$FFCC: Reserved
fdb BadInt ;$FFCE: PORTJ
fdb BadInt ;$FFD0: Reserved
fdb BadInt ;$FFD2: ATD
fdb BadInt ;$FFD4: Reserved
fdb BadInt ;$FFD6: SCI Serial System
fdb BadInt ;$FFD8: SPI Serial Transfer Complete
fdb BadInt ;$FFDA: Pulse Accumulator Input Edge
fdb BadInt ;$FFDC: Pulse Accumulator Overflow
fdb BadInt ;$FFDE: Timer Overflow
fdb tim_isr ;$FFE0: Standard Timer Channel 7
fdb BadInt ;$FFE2: Standard Timer Channel 6
fdb BadInt ;$FFE4: Standard Timer Channel 5
fdb BadInt ;$FFE6: Standard Timer Channel 4
fdb BadInt ;$FFE8: Standard Timer Channel 3
fdb BadInt ;$FFEA: Standard Timer Channel 2
fdb BadInt ;$FFEC: Standard Timer Channel 1
fdb BadInt ;$FFEE: Standard Timer Channel 0
fdb rti_isr ;$FFF0: Real Time Interrupt (RTI)
fdb BadInt ;$FFF2: IRQ (External Pin or Parallel I/O) (IRQ)
fdb BadInt ;$FFF4: XIRQ (Pseudo Non-Maskable Interrupt) (XIRQ)
fdb BadInt ;$FFF6: Software Interrupt (SWI)
fdb BadInt ;$FFF8: Illegal Opcode Trap ()
fdb startup ;$FFFA: COP Failure (Reset) ()
fdb BadInt ;$FFFC: Clock Monitor Fail (Reset) ()
fdb startup ;$FFFE: /RESET
end
// Rubik's Cube simulator
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import .*;
import java.applet.Applet;
import java.lang.*;
import java.text.*;
import java.util.*;
public final class Cubie
extends java.applet.Applet implements ActionListener, ItemListener, Runnable
{
final int NUMGROUPS = 3;
final int NUMVIEWS = 4;
final int VIEWWIDTH = 300;
final int VIEWHEIGHT = 350;
Settings settings = new Settings();
int symType = 0;
int viewer = 0;
boolean checker = false;
Viewer cubeViewers[] = {
new Viewer3D(VIEWWIDTH ,VIEWHEIGHT,settings,this),
new ViewerDiag(VIEWWIDTH ,VIEWHEIGHT,settings,this),
new ViewerBox(VIEWWIDTH ,VIEWHEIGHT,settings,this),
new ViewerFlat(VIEWWIDTH ,VIEWHEIGHT,settings,this)
};
Panel rightPanel = new Panel();
//Button mixBut = new Button("Mix");
Button resetBut = new Button("Reset");
Button solveBut = new Button("Step");
Panel boxPanel = new Panel();
TabSet tabSet;
Panel tabPanel[] = { new Panel(),new Panel() };
CheckboxGroup cubeGroup = new CheckboxGroup();
Checkbox groupRadioBox[] = {
new Checkbox("Play",cubeGroup,false),
new Checkbox("Paint",cubeGroup,false),
new Checkbox("Help",cubeGroup,false)
};
Solver solvers[] = {
new SolverKociemba(this),
new SolverSquare(this),
new SolverSlice(this),
new SolverAntiSlice(this),
new SolverTwoGen(this)
};
Color colors[] = {
new Color(255,0,0), //unprepared
new Color(192,192,192), //prepared, ready, controls background color
new Color(0,255,0), //Running solver
new Color(255,255,255), // viewer background color
};
boolean solution=true;
boolean symTwoCol=false;
MoveSequence generator;
int seqPos=0;
boolean playFw=true;
boolean moveInProgress=false;
String simplify_solution = "";
String[] solution_char;
Vector solution_command = new Vector();
// applet control
boolean isPlaying=false;
boolean isSolved = true;
//TCI/IP control
static private boolean isapplet = true;
static private InetAddress arg_ip = null;
static private int arg_port = 0;
public tcpip gtp = null;;
InetAddress reader_ip = null;
int port = 10001;
public void init()
{
int i,d,x,y;
final int vw=VIEWWIDTH,vh=VIEWHEIGHT,gw=220,bw=gw/4,th=50,bh=20,bw2=75,bh2=16;
// build main applet panel
setLayout(null);
setBackground(colors[3]);
add(rightPanel);
add(boxPanel);
for( i=0; i ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- final maturity of ee savings bonds
- final maturity date for ee bonds
- calculate ee bond final value
- ee savings bonds final maturity
- final cost report nysed
- project final report template
- project final summary report template
- final grant report sample
- final grant report example
- final evaluation report example
- project management final report example
- project management final report template