Published:2011/8/17 21:03:00 Author:Phyllis From:SeekIC
By Andy&Rose Morrell
This version of Solitaire is played with an array of LEDs instead of pegs, with a microcontroller behind the scenes to check if you’re any good at playing. As you’ll soon find, the game is challenging and addictive!
This project is a fine instance of a microcontroller and its resident software slashing component count when implementing a logic circuit, as well as providing yet an another answer to the perennial "great-but-what-do-you-do-with-it?" question from outsiders and newbies when discussing those multi-legged beasts commonly known as microcontrollers.
The design is based on the Atmel AT90S2313 microcontroller which was selected for its low cost, speed, number of I/O lines and ease of programming in assembly code using free tools.
The hardware
If you think of a microcontroller acting like a black box and sitting between input and output devices like switches and LEDs, then the circuit diagram in Figure 1 is nothing special. It does, however, contain a few ingenious solutions when it comes to marrying software to hardware that’s to remain as simple and reproducible as possible. The AT90S2313 micro, IC1, runs at a clock frequency of 4 MHz obtained with the aid of quartz crystal XI. The two 22-pF capacitors serve as parallel load devices for the oscillator/crystal configuration (note that the oscillator is on board the AT micro).
Output devices controlled by the AT90 micro comprise active buzzer Bzl, LEDs D1-D33 mimicking the playing field and LED D34 to confirm that the move has been performed. The buzzer sounds in response to the microcontroller software activating the PD3, PD4 and PD5 lines at the same time. This condition is signaled by NAND gate IC2.B, with IC2.A acting as an inverter only. A similar arrangement but without logic inversion is used for LED D34, which lights when PDO, PD1 and PD2 are logic High at the same time. Here. IC2.C is the responsible NAND gate.
All Port lines PDO through PD6 are applied to the inputs of an ULN2803 driver IC. Note the inverting action of this IC — it will pull the commoned cathodes of the LED sets low in response to a high level on the port lines. The anodes of the LEDs are connected to port lines PBO through PB7 via 220-ohm current limiting resistors. In this way, each individual LED in the playing area can be turned on an off using just 15 control lines instead of... right, 33! The process is called multiplexing. Here, it relies on software. As to input devices, a number of PB on IC1 lines are also connected to switches, requiring them to act as inputs as well as outputs — in a controlled manner, of course! Pushbutton activity is detected on port line PB7 which is exclusively an input.
Switches S1-S4 are the cursor (direction) controls, while S6, S7 and S8 act as the SELECT, CANCEL and STALEMATE controls.
The microcontroller is reset at power-on by a brief logic Low level obtained from network R10-C3. The circuit does not have a voltage regulator and is powered directly from a 3-volts supply made from two series connected 1.5-V dry batteries.
Reprinted Url Of This Article: http://www.seekic.com/blog/project_solutions/2011/08/17/PLAY_SOLITAIRE_packed_in_an_AT90S_micro__(1).html
Print this Page | Comments | Reading(1139)
Author:Ecco Reading(33516)
Author:Ecco Reading(3534)
Author:Ecco Reading(3250)
Author:Ecco Reading(3816)
Author:Ecco Reading(5341)
Author:Ecco Reading(3318)
Author:Ecco Reading(3474)
Author:Ecco Reading(3620)
Author:Ecco Reading(4017)
Author:Ecco Reading(3819)
Author:Ecco Reading(3760)
Author:Ecco Reading(3790)
Author:Ecco Reading(6103)
Author:Ecco Reading(3778)
Author:Ecco Reading(4587)