Suljettu

Write some Software

P.1

Embedded Software Autumn 2016

Project – Memory Game

Random number generator. Touch sense input. Debouncing. Memory game.

Introduction

Random number generation is important in many applications, such as cryptography, engineering simulations (e.g Monte Carlo analysis), and gaming. A pseudorandom number generator is an algorithm for generating a sequence of numbers whose statistical properties approximate real sequences of random numbers. However, the generated sequence is not truly random, because it is completely determined by a relatively small set of initial values, and the generated sequence is periodic. The K70 has a Random Number Generator hardware module which introduces true randomness into the generation of a sequence of 32-bit numbers. Refer to Chapter 37 of Freescale’s K70 Sub-Family Reference Manual for more information.

Capacitive touch sensing has become one of the de-facto technologies for user input in a Human-Machine Interface (HMI). The K70’s Touch Sense Input (TSI) module is able to drive touch sensing electrodes (or capacitors, created by flat conductive areas) and has logic that automatically scans, measures and outputs the results, and generates interrupt signals to the CPU. Refer to Chapter 60 of Freescale’s K70 Sub-Family Reference Manual for more information.

Debouncing is necessary for all styles of pushbuttons, switches and TSIs due to mechanical and electrical noise. A simple way to debounce an input in software is to accumulate a number of consecutive stable values.

Objectives

1. To generate random numbers.

2. To implement a touch sensitive interface.

3. To debounce switch operations.

4. To create a real-time, reactive and multi-threaded application.

P.2

Embedded Software Autumn 2016

Equipment

 1 TWR-K70F120M-KIT – UTS

 1 USB cable – UTS

 Freescale Kinetis Design Studio

Safety

This is a Category A laboratory experiment. Please adhere to the Category A

safety guidelines (issued separately).

Cat. A lab

P.3

Embedded Software Autumn 2016

Software Requirements

1. A hardware abstraction layer (HAL) is to be written for the random number generator (RNG). The HAL should support initialization of the RNG and the generation of 32-bit random numbers.

2. A hardware abstraction layer (HAL) is to be written for the Touch Sense Input (TSI) module. The HAL should support the setting up of the TSI module, self-calibration, “baseline tracking” and interrupts. Refer to the Tower schematics ([url removed, login to view]) to determine how the electrodes, which surround the LEDs, have been set up, and to determine appropriate ports and pins to manipulate on the K70.

The following parameters should be used for setting up the TSI module:

Parameter

Value

Number of Consecutive Scans Per Electrode

10

Electrode Oscillator Prescaler

4

Ref OSC Charge Current

32 μA

External OSC Charge Current

18 μA

Scan Period Modulus

10

Active Mode Clock Source

LPO

Active Mode Prescaler Divider Value

2

Note: There is a mask set erratum “e2638: TSI: The counter registers are not immediately updated after the EOSF bit is set” available for you to read in KINETIS_4N96B.pdf. This is a hardware fault and you will have to implement the workaround.

3. A general debounce module should be written that can debounce any type of digital input (TSI, pushbutton, switch, etc.). It should be used to debounce the TSI.

P.4

Embedded Software Autumn 2016

4. In the main program, three different modes of using the TSI are required:

 Default: The LEDs behave as they did in Lab 5.

 Touch Toggle: If SW1 is pressed the program should enter a mode where a touch of a TSI electrode toggles the corresponding LED. The LEDs should initially be off. If no touch input has occurred for 5 seconds, the mode returns to the default.

 Memory Game: If SW2 is pressed the program should enter a mode where it mimics the popular Simon game. In this game, the Tower will flash (for 1 second) a random sequence of LEDs, starting with a length of one. It then waits for the user to touch the corresponding LEDs (i.e. the corresponding TSI electrodes) in sequence (within 2 seconds for each LED). If the user is successful, it will add an additional random LED to the sequence, up to a limit of length 32. If an incorrect sequence is input by the user, or they take too long, or they reach a sequence length of 32, all the LEDS will blink rapidly and the game will reset (after 2 seconds). You are to record the high score (the number of LEDs in the sequence when the game ends) in Flash memory. The high score will then be available for interrogation via the TowerPC interface. If a game ends after the first LED, due only to the absence of a touch after 2 seconds, the main program returns to the default mode.

5. No header files have been specified – it’s time to make your own!

6. Extra commands of the Tower serial protocol to be implemented are:

Tower to PC

PC to Tower

0x0E Game – High Score

0x0E Game – High Score

7. TortoiseSVN must be used for version control.

Taidot: Sulautetut ohjelmistot

Näytä lisää: the algorithm design manual pdf, the algorithm design manual, statistical algorithm, software to generate create your own numbers, score time length, random no generation in c, p. n. g. engineering, monte design, mechanical engineering game, mechanical design software, logic algorithm, length of a score, led generation, lab support, introduction of algorithm, how to write a simple algorithm, how to make sequence, how to make an algorithm, how to make algorithm program, how to make algorithm

Tietoa työnantajasta:
( 0 arvostelua ) Australia

Projektin tunnus: #10826510

3 freelanceria on tarjonnut keskimäärin %project_bid_stats_avg_sub_26% %project_currencyDetails_sign_sub_27% tähän työhön

$315 AUD 3 päivässä
(10 arvostelua)
5.1
RexChris

Dear You, I am really interested to work on this project, I can start the work now , and can provide the best services from my end. Please come on chat to discuss more about the project. Thanks!

$155 AUD 3 päivässä
(0 arvostelua)
0.0
raju1121

Hey, In your project description, I observe that it needs an expertise in embedded domain to implement this. It can be implemented in C or C++ depending upon your requirement(that is not mentioned in the project de Lisää

$133 AUD 7 päivässä
(0 arvostelua)
0.0