Programming The AVR-Switches and SSD
Programming The AVR-Switches and SSD
CONTENTS
A review of Switches.
A review of SSD/LEDs.
A review of Ports.
Class exercise involving Switches and SSDs.
Multiplexing of SSD.
Exercise involving multiplexing SSD.
Switch Pressed
SWn 0V
Causes SWn to be pulled low
PINxn PORTx
7 7
6 6
5 5
4 4 DDRx register : Register for
PX3 3 3 designating pin input or
2 2 output
1 1 1 output
0 0
0 - input
7 6 5 4 3 2 1 0
DDRx
PD.0 PB.0
SW0
a
PB.1
b
PB.2
c
PB.3
d
8515 PB.4
e
SSD1
PB.5
f
PB.6
g
SW7 PD.7
SSD g f e d c b a
0 0 1 1 1 1 1 1 3F
Connected to PORTB 1 0 0 0 0 1 1 0 06
PORTB Configured as 2 1 0 1 1 0 1 1 5B
3 1 0 0 1 1 1 1 4F
0utput 4 1 1 0 0 1 1 0 66
will be required. 8 1 1 1 1 1 1 1 7F
9 1 1 0 1 1 1 1 6F
ldi Temp, 5
Ret
Sensor 1 PB.7
E
Entry Sensor PD.2 PB.0 a E a
PB.1 b b
PB.2 c c
PB.3 d d
Sensor 2 e SSD0
PB.4 e SSD1
PD.3 8515
Exit
PB.5 f f
PB.6 g g
Figure B3.1