28905 Parallax Inc, 28905 Datasheet - Page 7

no-image

28905

Manufacturer Part Number
28905
Description
Interface Modules & Development Tools AVRSimon Game Kit
Manufacturer
Parallax Inc
Datasheet

Specifications of 28905

Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Firmware
AVRSimon combines a number of basic microcontroller
functions, such as reading switch inputs and turning LEDs
on and off, with more complicated ones, such as using sleep
modes to extend battery life and playing sounds, which
makes it a great platform to learn about microcontrollers
and embedded programming.
From the highest level view, the operation of the AVRSimon
firmware is straightforward.
Upon power-up, the hardware is initialized within the aptly
named hardware_init() function, which brings the system
into a known state. The function configures the I/O pins
(LED pins as outputs, switch pins as inputs), sets up the
timers (Timer 0 is used for tone generation and Timer 1 for
timeout counting used during gameplay), and enables the
Pin Change Interrupt.
Then, simon_config() is called, which sets the gameplay
mode based on the combination of pushbuttons SW1-SW4
held down during power-up. If no buttons are pressed
during power-up, then the game will play in the normal
mode. Other modes include no sound mode, fast mode, no
LED mode, and reverse mode, and serve as an additional
challenge for advanced users. Details of each special mode
are discussed in the How to Play section.
After all configuration is complete, we move into the core simon_game() routine. Immediately after
entering simon_game(), the system is configured to enter a low-power sleep mode and to awake on a
button press from any of the four buttons. Sleep mode is attained by calling a specific sequence of
functions/macros, which define the type of sleep mode we want to enter, configuring the interrupts, and
then going to sleep:
Sleep mode conserves a significant amount of power by shutting down all unused modules of the
microcontroller and only keeping the absolute essential features awake. In our selected Power-Down
Mode (SLEEP_MODE_PWR_DOWN), all clocks and oscillators are disabled, all peripheral modules are
turned off, and the only ways to awaken the device are via specific resets (external, watchdog, or brown
out), serial interface or INT0 external interrupts, or a Pin Change Interrupt generated on specific port
pins when the level changes from low to high or high to low. Fore more details of sleep mode
implementations, see http://www.nongnu.org/avr-libc/user-manual/group__avr__sleep.html.
With AVRSimon, when a button press is detected via the Pin Change Interrupt on Port B 0, 1, 3, or 4
(corresponding to SW3, SW1, SW4, SW2, respectively) the system springs to life and begins the game.
Copyright © Parallax Inc.
// prepare to go to sleep/idle mode...
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
cli();
sleep_enable();
sei();
sleep_cpu();
// go to sleep here to save power
AVRSimon Game Kit (#28905)
v1.0 3/22/2010 Page 7 of 10

Related parts for 28905