PICAXE-18X & Philips EE: A "personalized" dice


Introduction

A dice is an example of a useful application that can be implemented in many ways. Here we present our work on a "personal" one, that greets you with a welcome message after power-up. The basic concept can be adjusted in many ways, and as such it may be a nice and attractive example idea for a class project.


Hardware & Software Methods

We use our Philips EE (Electronic Experimentation) system for prototyping. A 7-segment display is directly driven (through 470 ohm resistors) by the PICAXE-18X using all 8 outputs (including the decimal point). When the system is powered up a personal message appears on the display, after which the dice starts to roll. The dice can be tossed again by pressing a switch connected to input 7 (active high). When a button is pressed a sequence of numbers show up (6-4-2 etc.) or (5-3-1 etc.), with each subsequent number shown longer. The decimal point blinks to indicate the final number. After a while the number disappears in order to reduce power consumption, but pressing the button will result in a new toss.

The actual representation of the characters and numbers depends on the wiring of the PICAXE with the display, and on the type of display (common cathode or common anode). Therefore the program opens with a set of SYMBOL declarations to get the proper display of characters and numbers.

This program was designed and written almost completely by Joost (I was not allowed to make any comments until the program was finished, I only made some adjustments for the welcome message and programmed the tossed number to disappear after a while), it was his first relatively large program (and consequently the programming style could be better; this code is not well-suited for porting) and it ran almost immediately from the start. We have used this design for playing games in my family for several times; as it proved to be fascinating to Joost's younger brothers Bart and Pieter.

Code:


Comments/Suggestions

An attractive yet simple application like this may be very appropriate for a classroom project, as only a very limited number of components is required. A basic functional program could be provided (better programmed than ours), and students could adapt parts of it (e.g. the message part, tossing speed, displaying options, alternatives for random number generation) in order to get an impression of how it works in a limited amount of time.

 

Contact me