A Touchscreen Chinese Chess App Using Atmega

A Touchscreen Chinese Chess App

With the increasing popularity of smartphones and tablet computers, touchscreen has become one of the most common user interfaces encountered today. The idea of this project came from some apps on the smart phone. It is very interesting to play a virtual Chinese chess on the mobile phone. People can take them everywhere and play it whenever they want. So we decided to build the electronic Chinese Chess game in our project. Meanwhile, LCD touch screen is a very popular thing used in electronic products, and doing the project will give us experience in utilizing a set of devices that is popular in modern devices. So in our final project, we designed a Chinese chess game application on touchscreen. Users can play Chinese chess on it. In addition, they can set the background as they like. Meanwhile, this project will also provide ECE4760 course a library for initializing and developing LCD touch screens of the same configuration for reference.

A Touchscreen Chinese Chess App
The Chinese Chess Game App on Touchscreen

High Level Design

Rationale

It is quite meaningful for us to do this project. On one hand, with the increasing popularity of touch-screen mobile phones and tablet PCs, touch screen becomes more and more important in our lives. It is much more convenient and flexible than the traditional keyboard. On the other hand, Chinese Chess is a traditional Chinese intellectual game which can be dating back to Warring States Period in China. This old game can help people to improve their consciousness ability, thinking ability and add much fun to our life.

Logical structure

At the high level, our project mainly consists of two parts: the ATmega1284p microcontroller, the LCD touch screen. Atmega1284p is the main control part. When user presses on the screen, the signal will be sent to the MCU and some movements would be made. Also the MCU will control what is shown on the LCD screen and the state mode, based on the screen interrupt.

The connection between MCU and touch screen needs a LCD driver and an ADC chip. They are already on the touch screen board.

And we use putty to show that it’s which player’s turn to make a movement.

Hardware/Software tradeoffs

The hardware part of our project is not very complex. We soldered our Atmega1284p MCU and the LCD touch screen together. The LCD touch screen consists of two chips, SSD1289 LCD control chip and ADS7843 touch panel controller chip.

For the software part, the tricky part is to drive the LCD touch screen to work. Based on the driver code of similar lcd touch screen but of different configurations as ours, we read the datasheet of SSD1289 LCD control chip carefully, and changed the driver code so that it can be used to drive our LCD, and made it work. The other main part is to implement Chinese chess game rules, we defined a structure to store the chessmen’s information, so it is not that difficult. Another fussy part is to debounce each touch and adjust coordinates of touched points, because of the size limitation of the touch screen, we requires a high resolution, so the coordinates adjustment part is important. We figured a way out to debounce each touch with the help of a timer and adjust the coordinates by Putty.

Standards and Patents

Our design uses the SPI(serial peripheral interface) to realize the communication of touchpanel and AVR. Devices communicate in master/slave mode where the master device initiates the data frame.

Leave a Comment

Your email address will not be published. Required fields are marked *