Project Plan Rev. 0.1 Page 2

Project Bluebird

University of Portland / School of Engineering Phone 503 943 7314
5000 N. Willamette Blvd. Fax 503 943 7316
Portland, OR 97203-5798

Theory of Operations

Revision #: 1.0 Date: 02/15/05

Project Grey Wolf: CMOS Digital “Memory” Game

Contributors:

Lindsay Megyesi

Mason Tabata

Taya Campagna

Weston Kurisu

Approvals

Name / Date / Name / Date
√ / Dr. Lu / 02/10/05 / Dave Dunning
Dr. Lillevik

Insert checkmark (√) next to name and add the date when approved.

University of Portland School of Engineering Contact: m. tabata

Theory of Operations Rev. 1.0 Page 19

Project Grey Wolf

Revision History

Rev. / Date / Author / Reason for Changes
0.9 / 01/20/05 / L. Megyesi, M. Tabata, T. Campagna, W. Kurisu / Rough Draft
0.95 / 02/09/05 / L. Megyesi, M. Tabata, T. Campagna, W. Kurisu / Add more info
1.0 / 02/15/05 / L. Megyesi, M. Tabata, T. Campagna, W. Kurisu / Final Draft

University of Portland School of Engineering Contact: m. tabata

Theory of Operations Rev. 1.0 Page 19

Project Grey Wolf

Table of Contents

Summary 1

Introduction 2

Background 3

Technologies 3

MOSIS 3

Microcontroller 3

References 3

Architecture 4

General Description 4

LCD Screen 5

Microcontroller 5

MOSIS Chip 5

Input 5

Design Overview 6

MOSIS Chip 7

Turn Counter 7

MOSIS Chip Layouts 14

Microcontroller 16

Conclusions 19

University of Portland School of Engineering Contact: m. tabata

Theory of Operations Rev. 1.0 Page 19

Project Grey Wolf

List of Figures

Figure 1 Simple Block Diagram of Project Grey Wolf 4

Figure 2 System Block Diagram 6

Figure 3 Turn Counter Logic Schematic 8

Figure 4 BLT Version MOSIS Chip Layout 14

Figure 5 Hand Version MOSIS Chip Layout 15

Figure 6 Microcontroller Functional Path 16

Figure 7 Microcontroller Functional Path 17

University of Portland School of Engineering Contact: m. tabata

Theory of Operations Rev. 1.0 Page 19

Project Grey Wolf

Chapter / Summary
1

Project Grey Wolf is the creation of a digital version of the children’s game “Memory.” This is a game that involves matching pairs of cards that have been previously shuffled and laid face down in a matrix type setting. The user selects one card and then tries to find its matching pair. The idea behind the title of this game is that at each turn, the player can and should remember which picture is where, thus allowing them to select a matching pair if the other match is chosen later. The project includes MOSIS technology, as well as a microcontroller.

The architecture of project grey wolf is provided in Chapter 4 of this document. It includes a general overview of the project with a system block diagram to show the major components of the design.

The main portion of this document is in Chapter 5, the design overview, which describes the implementation of each component of the design more specifically. The details of the random number generator and turn counter in the MOSIS chip are explained as well as what goes on in the microcontroller.

University of Portland School of Engineering Contact: m. tabata

Theory of Operations Rev. 1.0 Page 19

Project Grey Wolf

Chapter / Introduction
2

The purpose of the Theory of Operations document is to provide a technical description of the design for the CMOS Digital “Memory” Game. It will serve as a reference for maintenance and supports as well as a starting point for future designs. Team Grey Wolf is responsible for all aspects of the CMOS Digital “Memory” Game including its design, implementation, and documentation. This document is intended for any university faculty, student, or other party interested in learning more about Project Grey Wolf and the technical aspects of the CMOS Digital “Memory” Game. This document is significant because it provides an organized, technical examination of the CMOS Digital “Memory” Game’s design.

The rest of this document includes the following chapters:

Background- a brief description of any information relevant to the project that will help further the reader’s understanding of the project

Architecture- explains the architecture of the CMOS Digital “Memory” Game

Design Overview- explains the design of the CMOS Digital “Memory” Game using flow charts and state diagrams.

Conclusion- provides an overview of this document highlighting significant points of the project and any conclusions derived from this document

University of Portland School of Engineering Contact: m. tabata

Theory of Operations Rev. 1.0 Page 19

Project Grey Wolf

Chapter / Background
3

The Milton Bradley Company created the original children’s game “Memory”. This particular company focuses on jigsaw puzzles, new games and new educational materials. When playing the game children learn about taking turns and matchmaking as they try to make pairs of elated elephants, panting puppies, smiling suns, and other familiar objects. Played alone, Original Memory is a quiet activity for developing concentration and memory. With more players, it's even more of a memory challenge to remember where the cards have already been turned over; the youngest player always goes first.

Our project is a digitally controlled version of this game designed for a single user, which uses symbols instead of pictures. Several key aspects of the design are integrated onto a MOSIS chip, which will handle random placement of the cards, and a PIC18F452 microcontroller, which is used to interface the various components as well as manage and process signals.

Technologies

MOSIS

MOSIS technology has become widely used since 1981 for agencies such as commercial firms, government, research and educational facilities. Designing MOSIS chips has become a frequent and successful technology used at the University of Portland.

Microcontroller

Microcontrollers are “low-cost means of putting intelligence into a product.” (Peatman vii)

References

http://toys.americandiscounthosting.com/tbt-B00000IWDD-ToyOriginalMemory.shtm

http://www.mosis.org/about/whatis.html

Peatman, John B., Embedded Design with the PIC18F452 Microcontroller, Pearson Education, INC., New Jersey, 200

Chapter / Architecture
4

Figure 1 Simple Block Diagram of Project Grey Wolf

LCD Screen

Displays the matrix of cards and serves as the primary visual user interface. It interacts solely with the microcontroller, which controls what is displayed at all times.

Microcontroller

The microcontroller interacts with all components of our design and processes all inputs. It provides all clock signals for the random number generator and the 0-99 counter and relays the Reset and New Game signals to the MOSIS chip. It also controls the Card 1 and Card 2 indicators. The microcontroller receives the 5-bit number generated in the MOSIS chip and sets up a table to keep track of symbol locations.

MOSIS Chip

The MOSIS chip receives all of its clock signals from the microcontroller as well as the Reset and New Game signals. It supplies the 5-bit random numbers to the microcontroller and outputs the values for the turn counter to the seven-segment displays.

Input

The inputs include four push buttons, labeled Reset, New Game, Card 1 Set, and Card 2 Set. There are also two additional rotary knob switches that control the matrix locations. All inputs go to the microcontroller.

General Description

Project Grey Wolf is implemented using a MOSIS digital chip as well as a PIC18F452 microcontroller. The MOSIS chip is responsible for generating the random locations and sending those values to the microcontroller, which takes this information and sets up a 5x4 matrix of pairs, which are displayed on the LCD Screen. The MOSIS chip is also responsible for keeping track of the number of turns a player takes. It displays this value using two seven-segment displays. The microcontroller takes in the locations, which consist of a hexadecimal number from A to D indicating the row, and a numerical value from 1 to 5 indicating the column. Locations are chosen using two rotary knob switches. Two seven-segment displays present the selected location to the user. Two LEDs, representing Card 1 and Card 2, are used to indicate which Card the user is selecting. From the inputs, the microcontroller determines which location in the matrix to examine. This happens twice, one time for each location selected in a turn. Once both symbols have been acquired, they are compared. This result lets the microcontroller know whether to keep the symbols revealed or to conceal them. Three push-button switches are included in the design. When pressed, the first switch (Card 1 Set) lets the microcontroller know that the first location has been selected and that it can reveal the symbol at that location and retain its value. The second switch (Card 2 Set), when pressed, indicates the microcontroller that the second location has been selected, resulting in the microcontroller revealing the symbol at that location and retaining its value for processing. Once both symbols are acquired, the comparison function is triggered. This signal also triggers the turn counter in the MOSIS chip. The third switch is called “New Game.” When pressed, it will cause the entire system to reset and start a new game. The final product will be a functional single user game that people can enjoy in the future.

University of Portland School of Engineering Contact: m. tabata

Theory of Operations Rev. 1.0 Page 19

Project Grey Wolf

Chapter / Design Overview
5

Figure 2 System Block Diagram

Figure 2 shows the system block diagram for the CMOS Digital “Memory” Game. The three major components are the LCD Screen, the Microcontroller, and the MOSIS Chip. Interaction between parts is shown by directional arrows. For example, the signal to assert the Card 1 Indicator is sent from the Microcontroller, to the LED. In general, this diagram portrays a high level view of the system components and their interactions.

MOSIS Chip

The MOSIS Chip consists of two main components. One of the components is the turn counter, which counts from 0-99 and keeps track of the number of turns a player takes. The other component is the random number generator, which creates the random layout of cards on the LCD screen.

Turn Counter

The turn counter is made up of two cascaded 0-9 counters, which have the following State Table:

Present State / Next State
y3y2y1y0 / Y3Y2Y1Y0
0000 / 0001
0001 / 0010
0010 / 0011
0011 / 0100
0100 / 0101
0101 / 0110
0110 / 0111
0111 / 1000
1000 / 1001
1001 / 0000
1010 / xxxx
1011 / xxxx
1100 / xxxx
1101 / xxxx
1110 / xxxx
1111 / xxxx

The first counter is controlled by the input CLK2. The second input is controlled by the outputs of the first 0-9 Counter. Output Y0 and Y3 are ANDed together and sent as data into a D-FF, which is controlled by the CLK2. The output from this D-FF becomes the CLK for the second 0-9 Counter. The following figure shows how this is implemented.

Figure 3 Turn Counter Logic Schematic

Random Number Generator

The Random Number Generator (RNG) is controlled by two clock signals and two user controlled inputs. One clock signal (CLK) makes the RNG run, and the other clock signal (X) retrieves the random numbers from the RNG. The two user controlled inputs come from the New Game button and Reset button, both of which force the D-flip flops in the RNG to a known state (0). The RNG will produce a random sequence of numbers to represent locations of each “card” in the game. Since there is only a 5x4 matrix of cards, 10 pairs of cards are required so that a total of 20 different locations are needed. Therefore, the basis of the RNG is a 0-19 counter. Each number represents a different card location.

To ensure that the sequence is random enough so as not to be easily predictable by users, there is a twist to the next state logic in the RNG. When the clock signal (X) is LOW, the RNG counts normally and nothing goes to the outputs. However, when X goes HIGH, whatever number the counter is at gets sent to the outputs. Then instead of going to the next number in normal counting sequence, the counter jumps to another number and continues counting normally from that number. The state transition sequence while X is HIGH is as follows: 0, 1, 3, 6, 10, 15, 2, 9, 17, 7, 16, 5, 12, 18, 4, 8, 11, 13, 19, 14, 0, etc. So for example, if the counter is currently at 15 and X goes from LOW to HIGH, 15 will be sent to the outputs and the counter will resume counting normally from 2 to 3 assuming that X is driven LOW before CLK changes to HIGH. In the event that X remains HIGH, the counter will continue to jump from 2 to 9 and from 9 to 17 until X becomes LOW.

The RNG will keep counting and jumping until either the New Game or Reset button becomes activated, forcing it back to state 0. To make sure that there are no duplicate numbers used for card locations, the microcontroller will have an algorithm for keeping track of what numbers have already been used, and it will discard duplicate locations until each of the 20 cards have been assigned a different location. The following figures are the logic implementation of each bit, with Q0 being the most significant. These five schematics were integrated into one circuit. In this larger circuit, two layers of D-flip flops were added to each output. The first layer was controlled by CLK and the second by X.

Figure 4 Q0 Logic Schematic

Figure 5 Q1 Logic Schematic

Figure 6 Q2 Logic Schematic