Microprocessors Laboratory - Exercises page

UFSC/LISHA - Author: Hugo Marcondes, Wolfram Stacklies and Thiago Leao Moreira

Light Keyboard

This exercise aims at making clear the differences between the typical architectures for cyclic-executive-based embedded systems: round-robin, round-robin with interrupts and function queue scheduling. The basic idea is to associate leds and keys in such a way that a led is on when the corresponding key is pressed (for some time).

Architeture I: Round-Robin

This implementation was made on file roundrobin.c, and doesn't make use of interrupts.

Architeture II: Round-Robin with Interrupts

To make things more interesting, we will now wait for a button to be pressed for at least 4 seconds before turning on the corresponding led. This is more easily achievable with another software architecture: round-robin with interrupts.

Interrupt Handling
For learn and get experience handling interrupts, the exercise generalinterrupts.c was made. It's simple associate the INT0 with turning on the leds, and the INT1 with turning off.

Timer Operation
Again, to learn and get experience with the timer interrupt manipulation, the exercise 16sectimer.c was made. It enable the timer0 counter overflow interrupt. This causes, with the configuration that we use a rate of ~15 interrupts per second. Using a static varible to count the numbers of interrupts, we can wait until 16 seconds have past (~229 interrupts), to invert the leds signals. A example using the 16bit-Timer was made, the implementation is on file 16sectimer_with_16b_timer.c

The final One
The file roundrobin_interrupts.c is the implementation of the light keyboard with interrupts. So when you press one button for 4 seconds, the corresponding led will be turned on.

This implementation use polling on switchs due a hardware limitance for using general interrupts. You can assign only one switch for each general interrupt. In fact, the general external interrupt pin on microprocessor is shared with port D bits 2 and 3. Using polling on switch in fact turns the things a bit more interesting, because you need a extra logical to detect when a switch was pressed or release.

Anyway, following Dr. Guto suggestion, we made a new version using only interrupts for the timing and for the switchs. This implementation is on the file roundrobin_fullinterrupts.c

The file avr_defs.h was made according to the specification , defining the commom I/O space register addresses and interrupt vector definitions.
Warning: Undefined array key "PATH_TRANSLATED" in /var/www/intranet/teaching/esl/ine5349-2004-1/work/g7/index.php on line 25

Warning: opendir(/exercise02): Failed to open directory: No such file or directory in /var/www/intranet/teaching/esl/ine5349-2004-1/work/g7/index.php on line 26