Oussama Belhenniche

In this project, a Media Center was implemented on MCB 1700 board with LPC1768 microcontroller onboard, an ARM Cortex-M3 processor clocked at 150MHz, 512Kb on-chip flash, joystick, and an LCD for graphical interface. The development was done using MDK (Microcontroller Development Kit) The graphical interphace was implemented on the LCD, with its functionality including:


MCB 1700 board

To keep track of the different functionalities selected by the user, a global variable page was created, page=0 being the home menu. The variable page will get updated based on the user’s choices. Along with the page number, a line, which is also a global variable that was created to track the user's selection from the options provided (Audio stream, Photos, Game) and display the selected option by calling its function. The crusor ">" was to help the user navigate the media center, and is controlled using the joystick on the board.


MC layout

After the user selects the “Audio Streaming” option from the media center’s homepage, a custome-made function will be called to start streaming audio via USB from the PC to the dev board. The USB was used to connect to the PC, and disconnect when signaled to exit from the player, it worked by disabling the NVIC (Nested Vectored Interrupt Controller) that was responsible for starting the stream. The potentiometer on the board was used as adjust the volume of the on-board speaker. Counter clockwise rotation of the pot increases the volume, whereas clockwise rotation to the pot decreases the volume.

This part of the Media Menter was the biggest in term of memory usage. The game that was implemented was a modified version of Highway Madness. The premise behind the game was that a user controls a car (with the joystick) and try to avoid other cars while also trying to get as many gold coins as possible, then those gold coins would be used to unlock more images from the Photo Gallery as a reward system.

First to set the environment (Highway and cars), stock photos of a three–line highways, and cars were edited so they can fit onto the LCD.



CPU-Car 1
CPU-Car 2
CPU-Car 3

User's car

Three lane highway
Gold coin


The cars were superimposed on the background (the three-lane highway). The user is resnponsible for controlling the purple car at the bottom while the CPU handles all other cars. The user can move the car up, down, left, and right by using the joystick. Each car had it own function. For collision detection, 3 variables: front_bumper,rear_bumper, and lane were created to represent the cars and move them around the LCD. If the user’s car front_bumper value is in between rear_bumper, and front_bumper of the CPU-controlled car and both cars are at the same lane, then a collision has occurred, and thus the game is over. As for the gold coin, it generates randomly on the screen with the help of the rand() function in C. The user’s score will be updated once the position of the gold coin is between the front_bumper, and rear_bumper of the user’s car, and have the same lane value.

This function is responsible for polling the joystick's value and responds accordingly. If the user pressed right on the joystick, the function will delete the user’s car in it current position and prints it on the right lane while also updating the values for the front_bumper, and rear_bumper.

Each time a CPU-controlled car function is called, the car is moved by 20px downwards towards the user’s car.

When collision between the user’s car and the gold coin is detected, a variable score will be incremented by one. After that the coin will be generated randomly on the LCD



All the afromentioned functions are put inside an infinite while loop

Highway madness


The code for the game is available below.