This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:exercises:ui [2015/11/02 10:12] – raivo.sell | en:exercises:ui [2020/07/20 09:00] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ~~PB~~ | + | < |
====== Exercises ====== | ====== Exercises ====== | ||
Line 11: | Line 11: | ||
- This simulates standard traffic light for cars. | - This simulates standard traffic light for cars. | ||
- | - This simulates manually operated traffic light at pedestrian crossing. Until no button is pressed a green LED is lit for the cars. After pressing a button the green LED will start to blink for 3 seconds, this is followed by lighting the yellow LED for 3 seconds and red for 10 seconds, after this sequence a green LED is lit again. When red LED is on, the 7-segment display | + | - This simulates manually operated traffic light at pedestrian crossing. Until no button is pressed a green LED is lit for the cars. After pressing a button |
- This counts how many times the button is pressed. The result is displayed by blinking of the LEDs. After each pressing the number of blinking is increased by one. A random button can be selected. In order for the LED to blink a sub function must be used, with parameters set on the number of blinks. | - This counts how many times the button is pressed. The result is displayed by blinking of the LEDs. After each pressing the number of blinking is increased by one. A random button can be selected. In order for the LED to blink a sub function must be used, with parameters set on the number of blinks. | ||
- Present numbers in hexadecimal system randomly on the 7-segment display. The frequency is 1 Hz. | - Present numbers in hexadecimal system randomly on the 7-segment display. The frequency is 1 Hz. | ||
- Pressing button S1, the blinking speed of all three LEDs is slowed down two times. Pressing button S3, the blinking gets 2 times faster and pressing button S2 the frequency of the blinking will be set to 1 Hz. Using interrupt is required (do not use software delay). | - Pressing button S1, the blinking speed of all three LEDs is slowed down two times. Pressing button S3, the blinking gets 2 times faster and pressing button S2 the frequency of the blinking will be set to 1 Hz. Using interrupt is required (do not use software delay). | ||
- | - Create three piece of musics, | + | - Create three piece of musics, |
===== For advanced ===== | ===== For advanced ===== | ||
- | - For each of the three buttons | + | - When pressing |
- | - For each of the three buttons corresponds one LED which lights up when the button is pressed. For turning on or off, registers must be used and only one assigning operation (hint: use bit shifts). | + | |
- There is one button for each LED. The controller blinks LEDs randomly and the user has to repeat the same sequence. The sequence of blinks gets longer – one random LED is added with a new round. The sequence is controlled after each user. The time gap between each entry is two seconds. In case of an incorrect entry all LEDs blink three times. (The number of correct entries by the user may be displayed on a LCD screen). | - There is one button for each LED. The controller blinks LEDs randomly and the user has to repeat the same sequence. The sequence of blinks gets longer – one random LED is added with a new round. The sequence is controlled after each user. The time gap between each entry is two seconds. In case of an incorrect entry all LEDs blink three times. (The number of correct entries by the user may be displayed on a LCD screen). | ||
- | - The program | + | - Light in circular sequence 6 outside segments on the 7-segment indicator with the period of 500 ms. |
+ | - Make a program | ||
+ | - Write a simple worm game on the graphic LCD. The width of the worm is 1 pixel and the length | ||
===== Questions ===== | ===== Questions ===== | ||
Line 37: | Line 38: | ||
- Why are pull-up resistors used in switches? How is their resistance determined? | - Why are pull-up resistors used in switches? How is their resistance determined? | ||
- Calculate the resistance for regulating LED current, the voltage is 5 V, forward voltage of the LED is 2,7 V and the current is 30 mA. | - Calculate the resistance for regulating LED current, the voltage is 5 V, forward voltage of the LED is 2,7 V and the current is 30 mA. | ||
+ | - How many pins uses the 7-segment number-indicator (with point segment), if it is connected directly to the controller? How many pins would be needed if if were controlled through the shift register 74HC595? | ||
+ | - What determines the brightness of the 7-segment number-indicator? | ||
+ | - How can the numbers in decimal system be converted to binary system (to text) and vice versa? | ||
+ | - How is monochrome (black and white)LCD different from color LCD? | ||
+ | - How is software delay created? On which parameters depends the duration of the software delay? | ||
+ | - What makes us use hardware delay/timer with interruptions? | ||
+ | - Calculate the overflow interruption period for 8-bit timer, if the clock rate is 16 MHz and frequency divider' | ||
+ | - What can be done with the AVR timers besides counting time? | ||
+ | - Which is the longest duration of the interruptions in milliseconds which can be achieved with ATxmega128A1U micro-controller that work at the clock frequency of 32 MHz? Show the calculation formula. | ||
+ | - In case the processor is heavily loaded with an execution of a program (for example, it controls several motors and the values of several sensors at once), does this have an effect on the accuracy of the timer? Explain your answer. | ||
+ | |||
+ | |||
+ | |||
+ |