• Non ci sono risultati.

AA 2012/2013

N/A
N/A
Protected

Academic year: 2021

Condividi "AA 2012/2013"

Copied!
6
0
0

Testo completo

(1)

SISTEMI EMBEDDED AA 2012/2013

Programming the DE2 Basic Computer:

playing with parallel ports

(2)

Putting into practice (1)

• Create a new “Nios II Application and BSP from Template” using DE2_Basic_Computer as target Nios processor (nios_system.sopcinfo)

• Update DE2_Basic_Computer_Starter_Kit

• Start coding from the template

seven_segments_template.c available on the course webpage

• Basically, the template provides 2 functions:

• HexToSevenSeg() showing a 4-hex digit number on a 4x 7-seg display

• Wait_ms() generating a delay w/ ms resolution using a for loop to let the time pass

(3)

Putting into practice (2)

• Write a program that shows on the 7-seg display HEX3-HEX0 the sizes in number of bytes of long long, long, short and char integer data types

• Do they match with the fixed-size integer type definitions in alt_types.h?

(4)

Putting into practice (3a)

• Write a program that turns on a single green led

among LEDG7-LEDG0 and makes the position of the on-LED rotate with a period of around

500 ms. Make the activation and direction of the

rotation controllable by the pushbuttons KEY3-KEY1, as follows:

• KEY2 stops rotation, KEY3 and KEY1 activate rotation clockwise and counterclockwise respectively

• The program must be sensitive to the edges originated by the pressure of the pushbuttons KEY3-KEY1

(5)

Putting into practice (3b)

• Hints:

• Recognize pushbutton activations through the EVENT register of the relevant Parallel Port

• Store the LEDG7-LEDG0 status on a 8-bit unsigned variable

• Use <<, >> for left and right rotation (be careful to manage the all-zero situation)

• Use a finite state machine (Moore model) to:

• update the rotation state according to the KEY3-KEY1 events

• generate the new LEDG7-LEDG0 status through a switch instruction that scans the rotation state

• Use the Wait_ms() function to generate the rotation period

• What does it happen if the LEDG7-LEDG0 status is stored in a signed variable?

(6)

Putting into practice (4)

• Fast click game:

• Detect which of KEY1 and KEY3 is pressed first after the turning on of one of the GREEN LEDS

• Make the interval time between two consecutive switching on of the LED random

• Make also the GREEN LED position random

• Signal which KEY has been pressed first using two different RED LEDs

• Display the number of times KEY3 has been pressed first on HEX3-HEX2 and KEY1 on HEX1-HEX0

• Use one SLIDER to start/stop the game and reset the scoring

Riferimenti

Documenti correlati

Weizsäcker per tutta la vita ha cercato di realizzare un suo progetto che era quello di modificare lo statuto epistemologico della medicina, trasformandola in una scienza

On the contrary, disturbed systems clearly differentiate from dynamically regular ones (lower panel) for the presence of a more substantial amount of radial non-thermal motions

Finally, Figure 4 shows the color-stellar mass diagram for cluster members, highlighting that, as expected, optically blue galaxies are typically restricted to low stellar masses,

In una società come la milanese, nella quale erano rimasti attivi elementi 'tradizionali', costituiti da persone e famiglie residenti in città o in essa da tempo immigrati,

In view of these premises, the present work investigated the antibacte- rial activity of a cationic porphyrin against two Gram- positive and two Gram-negative multidrug-resistant

Mi riferisco alla pluralità delle Medicine – Convenzionale, Complementari, Tradizionali – ed al loro fecondo interscambio, alla valutazione della loro efficacia e appropriatezza,

In this paper, we prove that the Stable Harbourne Conjecture and the Stable Harbourne– Huneke Conjecture hold for ideals defining the Complement of a Steiner Configuration of points

Fu a partire da questo perimetro concettuale che si discusse sulla utilità di adottare una legge che disciplinasse il potere di inchiesta parlamentare. A