Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:exercises:digi [2010/02/12 12:22] raivo.sellen:exercises:digi [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== digital i/o exercises ======+====== Exercises ======
  
-The goal is to make a program witch is able to perform specified task.+The goal is to write a program which is able to perform tasks described below.
  
 ===== 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 =====
  
-  - It simulates traffic light when the button is pressed. Until no button is pressed the yellow light is blinking (traffic light in night mode). After pressing a random button the traffic light starts working in everyday mode, lighting yellow, then red and before continuing again yellow +  - 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 secondsthis is followed by lighting the yellow LED for 3 seconds and red for 10 seconds, after this sequence a green LED is lit again 
-  - Counts how many times the button is pressed. The pressing is considered as ended after the button is released. The result is displayed is binary code on LED-s. Maximum result when using three LED-s is 7(23-1). Green is 1. bit, yellow 2. bit and red 3. bit. +  - 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 2. bit and red 3. bit. 
-  - By pressing switch S1, LED1 and LED3 are lighted, pressing S2 yellow LED is lighted, pressing S3 all LED-s are switched off. This operation must be done by changing directly values of corresponding registers (without using the library of the home lab). +  - By pressing switch S1, LED1 and LED3 are lit; pressing S2 yellow LED is lit, pressing S3 all LEDs are switched off. This operation must be done by directly changing the values of corresponding registers (without using the library of the HomeLab). 
-  - Counts how many times the button is pressed. The result is displayed by blinking LED-s. After every press the number of blinking is raised by one. Random button may be selected. Blinking the LED sub function witch’s parameter is the number of blinks must be used.+  - 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.
   - When pushing button S1, red LED will blink “SOS” in Morse. By pressing S2, yellow LED blinks “CQD” and by pressing S3, green will blink “OK”.    - When pushing button S1, red LED will blink “SOS” in Morse. By pressing S2, yellow LED blinks “CQD” and by pressing S3, green will blink “OK”. 
  
 ===== For advanced ===== ===== For advanced =====
  
-  - For each button of three corresponds one LED witch lights when the button is pressed. To turn on or turn off registers must be used and only one assigning operation (hint: use bit shifts). +  - For each of the three buttons corresponds one LED which lights up when the button is pressed. For turning on or offregisters must be used and only one assigning operation (hint: use bit shifts). 
-  - When pressing the buttons in following sequence: S3-S2-S1, green LED is lighted. If other combinations are used only yellow will blink confirming that the button is pressed. +  - 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 LED-s randomly and the user has to repeat that sequence. The sequence of blinks is longer each time – one random LED is added. After the user has had his turn his turn is controlled whether it was correct. The time gap between each entry is two seconds. In case of incorrect entry all LED-s are blinked three times. (The number of correct entries by the user may be displayed on a LCD).  +  - 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 roundThe 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 measures time for reaction. When a random LED is lighted, the user has to press the corresponding button. The time when the LED is lighted is random, but at least 100 ms. The result is displayed on a LCD in milliseconds. The value of the buttons can not be read with the function that filters flickering because it results an extra delay.+  - The program measures time for reaction. random LED is lit and the user has to press the corresponding button as fast as possible. The time when the LED is lit is random, but not less than 100 ms. the result is displayed on a LCD screen in milliseconds. The value of the buttons cannot be read with filtering function for the flickering, since this will cause an extra delay.
  
 ===== Questions ===== ===== Questions =====
  
-  - What is different between operations ”=” and ”==” ? Give two examples to prove that +  - What is the difference between operations”=” and”==” ? Give two examples to verify the statement. 
-  - What is different between operations “|” and “||”? Give two examples to prove that+  - What is the difference between operations “|” and “||”? Give two examples to verify the statement
-  - Write an expression in witch you use equation “x = x + 1” twelve times. +  - Write an expression using the equation “x = x + 1” twelve times. 
-  - How an endless loop is written in C programming language? +  - How an endless loop is written in C-programming language? Provide two different examples. 
-  - What type of a variable do you choose is C – language to present positive numbers between 7 and 154? +  - 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? Give an example of a port setting input and output. +  - Witch register determines the direction of a port? Provide an example of configuring settings of ports’ input and output. 
-  - What methods can be used to prevent flickering? Give examples of methods using hardware and software.+  - 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.   - What is bit shift? Give a practical example with an explanation.
-  - For what are //pull-up//-resistors used by 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.
en/exercises/digi.1265977368.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