This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:exercises:digi [2010/02/07 08:45] – priitj | en:exercises:digi [2020/07/20 09:00] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Exercises ====== | ====== Exercises ====== | ||
- | The goal is to make a program | + | The goal is to write a program |
===== Warm up exercise ===== | ===== Warm up exercise ===== | ||
- | *If pressing S1 it one LED is lighted, pressing S2 two LED-s and S3 three LED-s. | + | *By pressing S1 one LED is lit, pressing S2 two LEDs and S3 three LEDs lit. |
===== For beginners ===== | ===== For beginners ===== | ||
- | - Imiteerib nupule vajutades valgusfoori tööd. Kuni pole vajutatud ühelegi nupule, vilgub kollane (valgusfoor öörežiimis). Pärast suvalisele nupule vajutamist alustab foor tööd tavarežiimis, süüdates kollase, seejärel punase ja enne edasivilgutamist uuesti kollase. | + | - 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 random 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. |
- | - Loendab nupuvajutusi. Vajutus loetakse lõppenuks alles siis, kui nupp vabastatakse. Tulemus kuvatakse kahendkoodis LED-idel. Maksimaalne tulemus kolmel LED-il on 7(2< | + | - This counts how many times the button is pressed. Only the full release of the button will complete the pressing. The result is displayed in binary code on LEDs. Maximum result for three LEDs is 7(23-1). Green marks 1. bit, yellow |
- | - Vajutades nupule | + | - By pressing switch |
- | - Loendab nupuvajutusi. Tulemus kuvatakse LED vilkumistega. Peale igat nupule vajutamist suureneb vilgutamiste arv ühe võrra. Võib valida suvalise nupu. LED vilgutamiseks kasutada alamfunktsiooni, mille parameetriks | + | - 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. |
- | - Vajutades nupule | + | - When pushing button |
- | ===== Edasijõudnule | + | ===== For advanced |
- | - Igale nupule kolmest vastab üks LED, mis süttib nuppu all hoides. Süütamiseks või kustutamiseks tuleb kasutada registreid ja teha võib seda ainult ühe omistamistehtega | + | - 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 |
- | - Vajutades nuppe järjekorras S3 – S2 - S1, süttib roheline | + | - 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). |
- | - 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 | + | - 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 |
- | - Programm mõõdab reaktsiooniaega. Suvalise | + | - The program measures time for reaction. A random |
- | ===== Kordamisküsimused | + | ===== Questions |
- | - Mis on tehete "=" ja "==" erinevus? Esitage selle erinevuse tõestuseks kaks näidet. | + | - What is the difference between operations”=” and”==” ? Give two examples to verify the statement. |
- | - Mis on tehete "|" ja "||" erinevus? Esitage selle erinevuse tõestuseks kaks näidet. | + | - What is the difference between operations “|” and “||”? Give two examples to verify the statement. |
- | - Kirjutage avaldis, milles kasutate võrrandit "x = x + 1" kaksteist korda. | + | - Write an expression using the equation “x = x + 1” twelve times. |
- | - Kuidas kirjutate | + | - How an endless loop is written in C-programming language? Provide two different examples. |
- | - Millist tüüpi muutuja valite | + | - What type of a variable do you choose in C–language to present positive values between |
- | - Milline | + | - Witch register |
- | - Milliste meetoditega saab elimineerida nupu värelust? Tooge näiteid riistvaralise ja tarkvaralise lahenduse kohta. | + | - 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. |
- | - Mida tähendab termin bitinihutus? Tooge praktiline näide koos seletusega. | + | - What is bit shift? Give a practical example with an explanation. |
- | - Miks kasutatakse lülitite juures //pull-up//-takistit? Mille järgi määratakse selle takistus? | + | - Why are pull-up |
- | - Arvutage | + | - Calculate the resistance for regulating |