This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:exercises:digi [2010/02/22 21:47] – Helen | en:exercises:digi [2020/07/20 09:00] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
- | 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 ===== | ||
- | - 1. 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. | + | - 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. |
- | - 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 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. |
- | - 3. 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 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). |
- | - 4. 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. |
- | - 5. 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 ===== | ||
Line 24: | Line 24: | ||
===== Questions ===== | ===== Questions ===== | ||
- | - What is different | + | - What is the difference |
- | - What is different | + | - What is the difference |
- | - Write an expression | + | - Write an expression |
- | - How an endless loop is written in C programming language? | + | - How an endless loop is written in C-programming language? |
- | - What type of a variable do you choose | + | - What type of a variable do you choose |
- | - Witch register determines the direction of a port? Give an example of a port setting | + | - Witch register determines the direction of a port? Provide |
- | - What methods | + | - What are the methods |
- 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. |