Msp67U

【LiChuang Development Board】Fanfan’s Game Console

 
Overview

# Game console based on Lichuang Liangshan School
This is my first contact with single-chip microcomputer. Through the introduction of my friends, I got to know Jiali Chuang EDA and Lichuang Liangshan School development board, and designed my own game console with my friends. Although most of them were referenced to the official game console expansion board and the design plan of my friends, I was still excited when the game console was completed and successfully opened games such as Mario and MapleStory. As a girl, I didn’t have much interest in electronic products before. This time, it brought me a new and different experience.
### 1. Display screen
! [screen.jpg] Referring to the official design, a 1.69-inch high-resolution color screen was selected as the display screen of the game console. The frame of this display screen looks good, very much like the screen of a watch, and the display quality is very high. It uses SPI drive and the peripheral circuit design is simple.
! [screen circuit.png] Since the resolution and color of the display screen are relatively high, hardware SPI is needed to achieve high-speed refresh control.
## 2. The joystick
needs to control the direction when playing games. I remember that the previous game consoles all had cross keys, but this time the joystick was used for control, and the experience was better.
The joystick is a potentiometer with a sliding resistor inside. Its resistance value varies according to the position of the joystick. The position of the joystick can be obtained by collecting and analyzing the voltage value using the ADC of the microcontroller.
![joystick circuit.png] Therefore, two ADC channels are needed to collect the voltage of the x and y axes of the joystick.
### 3. The vibration motor
is behind the joystick, and a vibration motor is used to provide vibration feedback to make the operation experience more sensible.
![vibration motor.png] The strength of the motor vibration can be controlled by using the timer of the Liangshan School microcontroller to output PWM waves.
The principle of PWM is to set the duty cycle of the waveform, so that the output voltage value changes, and the driving ability of the motor also changes.
### 4. Storage chip
In order to save data after the game is turned off, an EEPROM chip is used to save the data after power failure. It can not only record historical game play records, but also save the setting parameters of the game console.
Although a large number of MCUs currently have a certain capacity of EEPROM integrated inside, EEPROM chips are still widely used in various electronic products for reasons such as safety and no restrictions.
The game console expansion board is equipped with 24c02. The circuit is very simple and uses iic communication. It only needs two io for communication and supports multi-address settings.
![EEPROM circuit.png] ### 5. Game console code`int
main(void)
{
//Initialize
systick_config();
usart0_init();
adc_config();
adc_bat_init();
key_init();
led_init();
ui_main_set_init(); //Power-off setting
ui_main_lcd_init(); //Logo display at power-on
keywav_init(ui_set.volume_class);
Dac_Init();
motro_gpio_config();
key_timeinit(600*50); //Key audio frequency
rtctime_init();
//SRAM initialization
exmc_synchronous_dynamic_ram_init(EXMC_SDRAM_DEVICE0);
my_mem_init(SRAMIN);
my_mem_init(SRAMEX);
my_mem_init(SRAMCCM);
//File system
exfuns_init(); //Apply for memory for fatfs related variables
sd_fatfs_init(); //sd fatfs initialization
spi_fatfs_init(); //spi flash fatfs+font initialization
//display English without font
if(ui_ram.language==0 && fat_ram.word_stock==0) ui_ram.language=1;
///Small icons display on the main interface
rtc_init_show();
///All large icons on the main interface are displayed
ui_main_init_show();

while(1)
{
//Main interface selection
ui_adckey.now_adckey = five_way_key_scan();
if( ui_adckey.last_adckey != ui_adckey.now_adckey)
{
ui_adckey.last_adckey = ui_adckey.now_adckey;
if(ui_adckey.last_adckey == adckey_null) continue;
key_wav_motor();//Key sound vibration
//Loop switching//
if(ui_ram.now_app & 0xf0) ui_ram.now_app &= 0x0f;
//else ui_ram.now_app |= 0x10;
//if(ui_ram.now_app & 0x0f) ui_ram.now_app &= 0xf0;
//else ui_ram.now_app |= 0x01;
//Cannot cycle through and select up and down at the same
timeif(ui_adckey.last_adckey & adckey_up) ui_ram.now_app &= 0x0f;
else if(ui_adckey.last_adckey & adckey_down) ui_ram.now_app |= 0x10;
else;
if(ui_adckey.last_adckey & adckey_left) ui_ram.now_app &= 0xf0;
else if(ui_adckey.last_adckey & adckey_right) ui_ram.now_app |= 0x01;
else;
}
//Select change
displayui_main_last_show();
///Confirm to enter the functionui_key.now_key
= get_key_val();
if(ui_key.last_key != ui_key.now_key)
{
ui_key.last_key = ui_key.now_key;
if(ui_key.last_key == key_null) continue;
if(ui_key.last_key & key_exit) continue;
key_wav_motor();//Key sound vibration
//Enter function
switch(ui_ram.last_app)
{
case game_start:
game_start_main();//Start game
break;
case game_last:
game_last_main();//Last game
break;
case game_manage:
game_manage_main();//Manage game
break;
case game_set:
game_set_main();//Game settings
break;
default:
break;
}
}
//Small icon display
rtc_last_show();
delay_1ms(10);
}
}`
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-14 09:54:07

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号