An LED Target-PracTIce Game Uses the MAXQ2000 and MAX7312
Abstract: This applicaTIon note is an LED target-pracTIce game. The game demonstrates the capabiliTIes of the MAXQ2000 microcontroller (MAXQ20 core) and the MAX7312 port expander. All the firmware required to interface the two devices is provided.
Hardware Overview
The MAX7312 EV kit consists of the MAX7312, the MAXQ2000 microcontroller, all required passive components, and a proven PCB layout. The MAX7312 EV kit schematics are shown in Figures 1 and 2.
For more information on the MAXQ2000 microcontroller, please order the MAXQ2000 EV kit. The MAXQ2000 EV kit contains a complete set of software, hardware, sample code, and documentation needed to start designing with MAXQ2000. Schematics for the MAXQ2000 EV kit are available in the data sheet.
More detailed image (PDF, 256kB)
Figure 1. The MAX7312EV kit schematic, one of two schematics.
More detailed image (PDF, 292kB)
Figure 2. MAX7312EV kit schematic, second of two schematics.
Firmware OverviewThe example firmware program (see below) communicates to the MAX7312 by bit-banging an I²C interface on the MAXQ2000's general-purpose input/output (GPIO) ports. The MAXQ2000's 20MHz system clock allows the bit-banged I²C interface to run at up to 400kHz. The user modifies the maxqi2c.h header file to select the speed of the I²C interface and which GPIO ports will be used as SDA and SCL. Please refer to application note 3588, "Software I²C Driver for the MAXQ2000 Microcontroller," for more information.
Once the MAX7312 EV kit is powered on, the MAXQ2000 automatically detects the I²C address of the MAX7312. The program then starts to configure the MAX7312's port 1 GPIOs to create the LED lights' rolling effect. The port 2 GPIOs 8 and 9 are configured as input ports, and the firmware reads the states of the pushbuttons through those ports.
The game challenges the player to press a pushbutton when the red and green LED scrolling lights meet at the center. If the button is pressed when the LEDs meet, then MAXQ2000 microcontroller will detect it and all LEDs will flash indicating that the user wins the game.
Table 1 shows all of the I²C operations that are needed for this game application.
Table 1. I²C Operations
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)