Вы находитесь на странице: 1из 1

CENG380 Assignment 3

1. What is the value of DDRC if C4 and C1 are inputs and all the other
pins of are outputs? (20 points)

DDRC=0xED
2. Write an AVR assembly program to copy the contents of PINB to PORTA
100 times (40 points)
.org 0x00
LDI R20, 0xFF 4 points
OUT DDRB , R20 4 points
LDI R20, 0x00 4 point
OUT DDRA, R20 4 points
LDI R16, 100 4 points
Loop: IN R20, PINB 4 points
OUT PORTA, R20 4 points
DEC R16 8 points
BRNE Loop 4 points

3. Write an AVR assembly program to clear D7 if B3 is set and to set D7 if


B3 is equal to 0 (40 points)
.org 0x00
SBI DDRD, 7 8 points
CBI DDRB, 3 8 points
Loop: SBIC PORTB, 3 8 points
JMP next
SBI PORTD , 7 8 points
JMP Loop
next: CBI PORTD, 7 8 points
JMP Loop