CH4 Review Questions Flashcards

1
Q

There are a total of _____ ports in the ATmega32.

A

4

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

True or False.

All of the ATmega32 ports have 8 pins.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

True or False.

Upon power-up, the I/O pins are configured as output ports.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Code a simple program to send 0x99 to Port B and Port C.

A

LDI R16, 0xFF

OUT DDRB, R16

OUT DDRC, R16

LDI R16, 0x99

OUT PORTB, R16

OUT PORTC, R16

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

To make Port B an output port, we must place ______ in register ______.

A

$FF, DDRB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

To make Port B an input port, we must place _____ in register ______.

A

$00, DDRB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

True or False.

We use a PORTx register to send data out to AVR pins.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

True or False.

We use PINx to bring data into the CPU from AVR pins.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

True or False.

The instruction “SBI PORTB, 1” makes pin PB1 HIGH while leaving other pins of PORTB unchanged, if bit 1 of the DDR bits is configured for output.

A

True.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Show one way to toggle the pin PB7 continuously using AVR instructions.

A

CBI DDRB, 7

H1: SBI PORTB, 7

CBI PORTB, 7

RJMP H1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Write instructions to get the status of PB2 and put it on PB0.

A

CBI DDRB, 2

SBI DDRB, 0

AGAIN: SBIS PINB, 2

RJMP OVER

SBI PORTB, 0

RJMP AGAIN

OVER: CBI PORTB, 0

RJMP AGAIN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Write instructions to toggle both bits of PD7 and PD0 continuously.

A

SBI DDRD, 0

SBI DDRD, 7

H2: SBI PORTD, 0

SBI PORTD, 7

CBI PORTD, 0

CBI PORTD, 7

RJMP H2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly