Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:exercises:ui [2015/03/26 15:36] – created heikopikneren:exercises:ui [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
-~~PB~~+<pagebreak>
 ====== Exercises ====== ====== Exercises ======
  
-<note>Needs translation</note>+The goal is to write a program which is able to perform tasks described below.
  
-Eesmärgiks on koostada programm, mis täidab kirjeldatud ülesannet.+===== Warm up exercise =====
  
-===== Soojendusülesanne =====+  *By pressing S1 one LED is lit, pressing S2 two LEDs and S3 three LEDs lit.
  
-  * Nupu S1 vajutamisel süüdatakse üks LED, S2 vajutamisel kaks LED-i ja S3 vajutamisel kolm LED-i.+===== For beginners =====
  
-===== Algajale =====+  - 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 (S1) 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 countdowns seconds until green LED starts. 
 +  - 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. 
 +  - 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, which will be played when button is pressed. Change the piece of music should be instant when other button is pressed.
  
-  - Imiteeritakse ülekäiguraja autode valgusfoori tööd. Kuni pole vajutatud ühelegi nupule, põleb autodele roheline LED. Pärast suvalisele nupule vajutamist hakkab roheline kolmeks sekundiks vilkuma, seejärel süttib kolmeks sekundiks kollane ning kümneks sekundiks punane ja lõpuks jääb uuesti pidevalt põlema roheline LED, kuni toimub uus nupule vajutus.  
-  - Loendatakse nupuvajutusi. Tulemus kuvatakse LED-i vilkumistega. Pärast igat nupule vajutamist suureneb vilgutamiste arv ühe võrra. Valida võib suvalise nupu. LED-i vilgutamiseks kasutada alamfunktsiooni, mille parameetriks on vilkumiste arv. 
-  - Suvalises järjekorras esitatakse 7-segmendilisel indikaatoril kuueteistkümnendsüsteemi arve sagedusega 1 Hz.  
-  - Vajutades nuppu S1, aeglustub kõigi kolme LED-i vilkumine 2 korda, vajutades nuppu S3, sageneb vilkumine 2 korda, ja vajutades nuppu S2, määratakse vilkumise sageduseks 1 Hz. Ülesanne tuleb lahendada katkestuste abil (mitte tarkvaralise viitega). 
-  - Luuakse kolm lihtsat muusikalugu, mis mängitakse ette nupule vajutamise järel. Edasijõudnud võivad teha nii, et lugu saab vahetada (nupule vajutusel) ka poole loo pealt. 
  
 +===== For advanced =====
  
-===== Edasijõudnule =====+  - When pressing buttons in sequence S3 – S2 - S1, green LED will lit. All other combinations results red LED. Every button press a yellow LED will blink. 
 +  - 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).  
 +  - Light in circular sequence 6 outside segments on the 7-segment indicator with the period of 500 ms. 
 +  - Make a program where you can move “X” symbol around the screen. Use button S1 to move left, button S3 to move right and button S2 to change the row. 
 +  - Write a simple worm game on the graphic LCD. The width of the worm is 1 pixel and the length is 5 pixels. The worm can be made to turn either left or right using buttons. The worm must be able to avoid collision with the border of the screen (turning before). Bonus points are for ability of picking up the eggs and making the worm to grow. The simplest solution is to make the worm out of the letter “O”. 
 + 
 +===== Questions ===== 
 + 
 +  - What is the difference between operations”=” and”==” ? Give two examples to verify the statement. 
 +  - What is the difference between operations “|” and “||”? Give two examples to verify the statement. 
 +  - Write an expression using the equation “x = x + 1” twelve times. 
 +  - How an endless loop is written in C-programming language? Provide two different examples. 
 +  - What type of a variable do you choose in C–language to present positive values between 7 and 154? 
 +  - Witch register determines the direction of a port? Provide an example of configuring settings of ports’ input and output. 
 +  - What are the methods for eliminating the bouncing of the contacts and the false connections caused by flickering? Provide examples of solutions using both hardware and software. 
 +  - What is bit shift? Give a practical example with an explanation. 
 +  - 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. 
 +  - 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 it be adjusted if the number-indicator is controlled a)directly b)through the shift register 74HC595? 
 +  - 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's factor is 1024. 
 +  - 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.
  
-  - Vajutades nuppe järjekorras S3 – S2 - S1, süttib roheline LED. Kõigi teiste kombinatsioonide korral süttib punane LED. Iga nupuvajutuse korral vilgatab kollane LED, mis kinnitab nupule vajutust. 
-  - Igale LED-ile vastab üks nupp. Kontroller vilgutab LED-e suvaliselt ja kasutaja peab nuppe vajutades sama jada kordama. Vilkumiste jada läheb iga korraga järjest pikemaks, lisades eelnevale jadale uue suvalise LED-i. Pärast iga kasutaja sisestuskorda kontrollitakse, kas sisestus oli õige. Sisestuste vahe on kaks sekundit. Vale sisestuse korral vilgutatakse kõiki tulesid korraga kolm korda. (Mängija õigete sisestuste arvu võib kuvada LCD ekraanil.)  
-  - 7-segmendilisel indikaatoril pannakse 500 ms perioodiga ringiratast kordamööda põlema välised 6 segmenti. 
-  - Graafilisel LCD-l näidatakse sümbolit "X", mida saab nuppudega liigutada. Nupp S1 liigutab vasakule, S3 paremale ja S2 vahetab rida. 
-  - Lihtne ussimäng graafilisel LCD ekraanil. Ussi laius on 1 piksel, pikkus 5 pikslit. Ussi saab nuppudega vasakule või paremale pöörama panna. Uss peab suutma vältida kokkupõrget ekraani servaga (enne seda ära keerama). Boonuspunktid munade korjamise võimaluse ja järjest pikeneva ussi eest. Ülesande lihtsam lahendus on uss teha "O" tähtedest. 
  
-~~PB~~ 
  
-===== Kordamisküsimused ===== 
  
-  - Mis on tehete "=" ja "==" erinevus? Esitage selle erinevuse tõestuseks kaks näidet. 
-  - Mis on tehete "|" ja "||" erinevus? Esitage selle erinevuse tõestuseks kaks näidet. 
-  - Kirjutage avaldis, milles kasutate võrrandit "x = x + 1" kaksteist korda. 
-  - Kuidas kirjutate C-keeles lõputu tsükli? Esitage kaks erinevat varianti. 
-  - Millist tüüpi muutuja valite C-keeles, et esitada positiivseid arve vahemikus 7 kuni 154? 
-  - Milline register määrab ära pordi suuna? Tooge pordi näide sisendi ja väljundi seadistamise kohta. 
-  - Milliste meetoditega saab elimineerida lüliti kontaktide põrkumisest tekkivaid väärlülitusi? Tooge näiteid riistvaralise ja tarkvaralise lahenduse kohta. 
-  - Mida tähendab termin bitinihutus? Tooge praktiline näide koos seletusega. 
-  - Miks kasutatakse lülitite juures //pull-up// takistit? Mille järgi määratakse selle takistus? 
-  - Arvutage LED-i voolu piirava takisti väärtus, kui toitepinge on 5 V, LED-i päripinge 2,7 V ja vool 30 mA. 
-  - Mitu viiku kasutab 7-segmendiline numbernäidik (koos punktisegmendiga), kui see on ühendatud mikrokontrolleriga otse? Mitu viiku on vaja, kui numbernäidikut juhitakse läbi  nihkeregistri 74HC595? 
-  - Mis määrab 7-segmendilise numbernäidiku heleduse? Kuidas seda reguleerida, kui numbernäidikut juhitakse otse ja läbi nihkeregistri 74HC595? 
-  - Kuidas teisendada kümnendsüsteemi arvu kahendsüsteemi arvuks (tekstikujul) ja vastupidi? 
-  - Mille poolest erineb monokromaatiline (must-valge) ja värviline LCD ekraan? 
-  - Kuidas tekitada tarkvaraline viide? Millistest parameetritest tarkvaralise viite kestus sõltub? 
-  - Mis sunnib kasutama riistvaralist taimerit koos katkestusega? 
-  - Arvutage 8-bitise taimeri ületäitumise katkestuse periood, kui taktsagedus on 16 MHz ja sagedusjaguri tegur 1024. 
-  - Mida saab AVR taimeritega veel teha peale aja loendamise? 
-  - Milline on suurim katkestuste ajaline täpsus millisekundites, mida on võimalik saavutada ATxmega128A1U mikrokontrolleriga, mis töötab 32 MHz taktsagedusel? Näidake arvutusvalem. 
-  - Kui protsessor on tugevalt koormatud programmi täitmisega (näiteks juhib mitut mootorit ja kontrollib pidevalt paljude andurite väärtusi), siis kas see mõjutab taimeri aja mõõtmise täpsust? Selgitage oma vastust. 
en/exercises/ui.1427384177.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0