OBJECTIVE: To interface seven-segment to the AVR trainer. REFERENCES: Mazidi and Naimi, “The AVR Microcontroller and Embedded Systems,” Chapters 4, 6, and Section 17-3. MATERIALS: AVR trainer Atmel Studio or any other AVR assembler Two 7-segments Two transistors Two resistors ACTIVITY 1 a) Connect a common cathode 7-segment directly to PORTD. AVR PORTx.0 PORTx.1 PORTx.2 PORTx.3 PORTx.4 PORTx.5 PORTx.6 PORTx.7 A B C D E F G DP Common Cathod 100 b) Write the following program in the AVR Studio and then build and download it to the trainer board. This program displays 7 on the 7-segment. LDI OUT LDI OUT HERE: RJMP R20, 0xFF DDRD, R20 R20, 0b00000111 PORTD, R20 HERE ACTIVITY 2 Modify the previous program to display 9 on the 7-segment. ACTIVITY 3 Using look-up table write a subroutine that displays the contents of R21 on the 7-segment. ACTIVITY 4 (ADVANCED) a) Now connect two 7-segments to the same port of AVR, as shown below. PORTx.0 PORTx.1 PORTx.2 PORTx.3 PORTx.4 PORTx.5 PORTx.6 PORTx.7 AVR A B C D E F G DP A B C D E F G DP Common Cathod Common Cathod PORTB.0 PORTB.1 100 100 b) Display 23 by scanning on the 7-segments. … L1: LDI CALL LDI OUT CALL R20,2 DISPLAY_ON_7SEGMENT R16,0x01 PORTB, R16 DELAY_10ms ;wait for a while LDI R20,3 CALL DISPLAY_ON_7SEGMENT LDI R16,0x02 OUT PORTB, R16 CALL DELAY_10ms ;wait for a while RJMP L1