Mps_ch04 - Io Ports in Avr
Mps_ch04 - Io Ports in Avr
Chapter 4
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Topics
AVR pin out
I/O Port Programming
I/O Bit manipulation
programming
Simple Digital Input/Output
devices
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
ATmega16/mega32 pinout
1. Vital Pins:
40 PIN DIP
1. Power (XCK/T0) PB0 1 40 PA0 (ADC0)
VCC +5 V
(T1) PB1
(INT2/AIN0) PB2
2
3
39
38
PA1 (ADC1)
PA2 (ADC2)
Ground (OC0/AIN1) PB3 4 MEGA32 37 PA3 (ADC3)
(SS) PB4 5 36 PA4 (ADC4)
2. Crystal (MOSI) PB5 6 35 PA5 (ADC5)
(MISO) PB6 7 34 PA6 (ADC6)
XTAL1 +5 V (SCK) PB7 8 33 PA7 (ADC7)
+5 V
XTAL2 RESET
VCC
9
10
32
31
AREF
AGND
3. Reset GND
XTAL2
11
12
30
29
AVCC
PC7 (TOSC2)
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Register Addresses for ATmega32 Ports
IO SRAM
Port Usage
Address Address
PORTA $1B $3B Output
DDRA $1A $3A Direction
PINA $19 $39 Input
PORTB $18 $38 Output
DDRB $17 $37 Direction
PINB $16 $36 Input
PORTC $15 $35 Output
DDRC $14 $34 Direction
PINC $13 $33 Input
PORTD $12 $32 Output
DDRD $11 $31 Direction
PIND $10 $30 Input
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Topics
AVR pin out
I/O Port Programming
I/O Bit manipulation
programming
Simple Digital Input/Output
devices
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
The structure of IO pins
Mega32/Mega16
(XCK/T0) PB0 0 00 00 0 PA0 (ADC0)
(T1) PB1 1 11 11 1 PA1 (ADC1)
(INT2/AIN0) PB2 2 22 22 2 PA2 (ADC2)
(OC0/AIN1) PB3 3 33 33 3 PA3 (ADC3)
(SS) PB4 4 44 44 4 PA4 (ADC4)
DDRx:
(MOSI) PB5 5
7 565 5 4 3 5 25 51 0
PA5 (ADC5)
PORTx:
(MISO) PB6 6
7 666 5 4 3 6 26 61 0
PA6 (ADC6)
(SCK) PB7 PINx: 7
7 767 5 4 3 7 27 71 0
PA7 (ADC7)
DDRA
DDRB
PINB
PORTB
RESET PORTA AREF
PINA
Px7 Px6 Px5 Px4 Px3 Px2 Px1 Px0
VCC AGND
GND AVCC
XTAL2 PC7 (TOSC2)
XTAL1 PC6 (TOSC1)
(RXD) PD0 PC5 (TDI)
DDRx
(TXD) PD1 PC4 (TDO) 0 11
DDRx
PORTx 0
PORTx
(INT0) PD2 PC3 (TMS)
DDRx.n 0 high impedance
high impedance Out
Out00
(INT1) PD3 PC20(TCK)
(OC1B) PD4 PORTx.n 11(SDA)pull-up
PC1 pull-up Out
Out11
(OC1A) PD5 PC0 (SCL)
(ICP) PD6 PINx.n PD7 (OC2)
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 1
Write a program that makes all the pins of
PORTA one.
Mega32/Mega16
(XCK/T0) PB0 PA0 (ADC0)
(T1) PB1 PA1 (ADC1)
(INT2/AIN0) PB2 PA2 (ADC2)
(OC0/AIN1) PB3 PA3 (ADC3)
(SS) PB4 PA4 (ADC4)
DDRA: 1 1 1 1 1 1 1 1 (MOSI) PB5 PA5 (ADC5)
(MISO) PB6 PA6 (ADC6)
PORTA: 1 1 1 1 1 1 1 1 (SCK) PB7
PINA
PA7 (ADC7)
PORTB
DDRB
PINB
RESET DDRA AREF
PORTA
VCC AGND
PORTC
GND DDRC AVCC
PINC
XTAL2 PC7 (TOSC2)
XTAL1 PC6 (TOSC1)
(RXD) PD0 PC5 (TDI)
DDRx
00 11
DDRx
PORTx
PORTx
00 high
highimpedance
impedance
Out
Out0 0
11 pull-up
pull-up Out
Out1 1
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 2
The following code will toggle all 8 bits of
Port B forever with some time delay
between “on” and “off” states:
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 3
A 7-segment is connected to PORTA.
Display 1 on the 7-segment.
DDRC: 1 1 1 1 1 1 1 1
PORTC: 0 0 0 0 0 1 1 0
ATmega32 0
5 1
.INCLUDE “M32DEF.INC” 8 6
PORTC
LDI R20,0x06 ;R20 = 00000110 (binary) 4 2
OUT PORTC,R20 ;PORTC = R20
3
LDI R20,0xFF ;R20 = 11111111 (binary)
DDRx
OUT DDRC,R20 ;DDRC = R20 00 11
DDRx
PORTx
L1: RJMP L1 PORTx
00 high
highimpedance
impedance
Out
Out0 0
11 pull-up
pull-up Out
Out1 1
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 4
A 7-segment is connected to PORTA.
Display 3 on the 7-segment.
DDR: 1 1 1 1 1 1 1 1
PORTC: 0 1 0 0 1 1 1 1
ATmega32 0
5 1
.INCLUDE “M32DEF.INC” 8 6
PORTC
LDI R20,0x4F ;R20 = 01001111 (binary) 4 2
OUT PORTC,R20 ;PORTC = R20
3
LDI R20,0xFF ;R20 = 11111111 (binary)
DDRx
OUT DDRC,R20 ;DDRC = R20 00 11
DDRx
PORTx
L1: RJMP L1 PORTx
00 high
highimpedance
impedance
Out
Out0 0
11 pull-up
pull-up Out
Out1 1
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 5: Input
The following code gets the data present at the pins of port
C and sends it to port B indefinitely, after adding the value
5 to it:
.INCLUDE "M32DEF.INC"
LDI R16,0x00 ;R16 = 00000000 (binary)
OUT DDRC,R16 ;make Port C an input port
LDI R16,0xFF ;R16 = 11111111 (binary)
OUT DDRB,R16 ;make Port B an output port(1 for
Out)
L2: IN R16,PINC ;read data from Port C and put in
R16
LDI R17,5
ADD R16,R17 ;add 5 to it
OUT PORTB,R16 ;send it to Port B
RJMP L2 ;continue forever
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Pull-up resistor
vcc
1 = Close
PORTx.n 0 = Open
pin n of
port x PINx.n
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
The structure of I/O pins
RDx
PUD
P
DATA BUS
Q D
DDRxn
Q WR DDRxn
CLK
RESET
DDRx.n
RRx
OUTPUT
PORTx.n
Pxn Q D
PORTxn
Sleep WR PORTxn
Q CLK
PINx.n INPUT
RESET
SYNCHRONIZER
D Q D Q
PINxn
L Q Q RPx
N
RESET RESET
CLKI/O
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Out 0
RDx
PUD
P
1 1 DATA BUS
Q D 0
DDRxn
Q WR DDRxn
CLK
RESET
RRx
0 0 0 0
Pxn Q D
PORTxn
Sleep WR PORTxn
Q CLK
RESET
SYNCHRONIZER
D Q D Q
PINxn
L Q Q RPx
N
RESET RESET
CLKI/O
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Out 1
RDx
PUD
P
1 1 DATA BUS
Q D 0
DDRxn
Q WR DDRxn
CLK
RESET
RRx
1 1 1 1
Pxn Q D
PORTxn
Sleep WR PORTxn
Q CLK
RESET
SYNCHRONIZER
D Q D Q
PINxn
L Q Q RPx
N
RESET RESET
CLKI/O
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 6
Write a program that continuously sends out to
Port C the alternating values of 0x55 and 0xAA.
.INCLUDE "M32DEF.INC"
LDI R16,0xFF ;R16 = 11111111
(binary)
OUT DDRC,R16 ;make Port C an output
port
L1: LDI R16,0x55 ;R16 = 0x55
OUT PORTC,R16 ;put 0x55 on Port C
pins
LDI R16,0xAA ;R16 = 0xAA
OUT PORTC,R16 ;put 0xAA on Port C
pins
RJMP L1
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
The structure of IO pins
DDRx
00 11
DDRx
PORTx
PORTx
00 high
highimpedance
impedance
Out
Out0 0
RDx
PUD
11 pull-up
pull-up Out
Out1 1 P
DATA BUS
Q D
DDRxn
Q WR DDRxn
CLK
RESET
RRx
Pxn Q D
PORTxn
Sleep WR PORTxn
Q CLK
RESET
SYNCHRONIZER
D Q D Q
PINxn
L Q Q RPx
N
RESET RESET
CLKI/O
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Input (Tri-state vs. pull up)
RDx
PUD
P
0 0 DATA BUS
Q D
DDRxn
Pull-up WR DDRxn
Q CLK
Resistor
RESET
0 RRx
0
Pxn Q D
PORTxn
WR PORTxn
Q CLK
Sleep RESET
SYNCHRONIZER
0 0 0 0 0
0 D Q D Q
PINxn RPx
N L Q Q
RESET RESET
CLKI/O
The represents how the content of PORTx register affects the pull-up resistor;
while the shows how a data can be read from a pin
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 7
40 PIN DIP
port B. (MOSI)
(MISO) PB6
PB5 6
7
35
34
PA5 (ADC5)
PA6 (ADC6)
(SCK) PB7 8 33 PA7 (ADC7)
RESET 9 32 AREF
VCC 10 31 AGND
.INCLUDE “M32DEF.INC” GND 11 30 AVCC
XTAL2 12 29 PC7 (TOSC2)
LDI R20,0 ;R20 = 00000000 (binary) XTAL1 13 28 PC6 (TOSC1)
(RXD) PD0 14 27 PC5 (TDI)
DDRx
00 11
DDRx
RJMP L1 PORTx
PORTx
00 high
highimpedance
impedance
Out
Out0 0
11 pull-up
pull-up Out
Out1 1
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Synchronizer delay
Example: Port A is configured first as an input port by writing all Os to
register DDRA, and then data is received from Port A and saved in a
RAM location:
.INCLUDE "M32DEF.INC"
.EQU MYTEMP 0x100 ;save it here
LDI R16, 0x00 ;R16 = 00000000 (binary)
OUT DDRA,R16 ;make Port A an input port (0 for In)
NOP ;synchronizer delay
IN R16,PINA ;move from pins of Port A to R16
STS MYTEMP,R16 ;save it in MYTEMP
The input circuit of the AVR has a delay of 1 clock cycle. In
other words, the PIN register represents the data that was
present at the pins one clock ago. In the above code, when the
instruction "IN R16, PINA" is executed, the PINA register contains the
data, which was present at the pins one clock before. That is why the
NOP is put before the "IN R16, PINA" instruction. (If the NOP is
omitted, the read data is the data of the pins when the port was
output.)
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 8 (1/2)
Write a test program for the AVR chip to toggle all the bits of
PORTB, PORTC, and PORTD every 1/4 of a second. Assume a
crystal frequency of 1 MHz.
Solution:
LDI R16, 0xFF
.INCLUDE "M32DEF.INC" OUT DDRB, R16
LDI R16, HIGH(RAMEND) OUT DDRC, R16
OUT SPH, R16 OUT DDRD, R16
LDI R16, LOW(RAMEND) LDI R16, 0x55
L3:
OUT SPL, R16 ;initialize stack pointer
OUT PORTB, R16
OUT PORTC, Rl6
OUT PORTD, Rl6
CALL DELAY
COM R16
RJMP L3
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 8 (2/2)
;---------------1/4 SECOND DELAY
DELAY:
LDI R21, 200
D1: LDI R22, 250
D2: NOP
NOP
DEC R22
BRNE D2
DEC R21
BRNE D1
RET
Calculations:
1/1MHz =1 s 1 MC = 1 s
Delay = 200 x 250 x 5 x 1 s = 250,000 s (If we include
the overhead, we will have 250,608 us.)
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Topics
AVR pin out
I/O port programming
I/O Bit manipulation
programming
Simple Digital Input/Output
devices
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
SBI and CBI instructions
SBI (Set Bit in IO register)
SBI A,b ; I/O(A,b) ← 1 where 0 ≤ A ≤ 31, 0 ≤ b ≤ 7
SBI ioReg, bit ;ioReg.bit 1
Examples:
SBI PORTD,0 ;PORTD.0 = 1
SBI DDRC,5 ;DDRC.5 = 1
CBI (Clear Bit in IO register)
CBI A,b ; I/O(A,b) ← 0 where 0 ≤ A ≤ 31, 0 ≤ b ≤ 7
CBI ioReg, bit ;ioReg.bit 0
Examples:
CBI PORTD,0 ;PORTD.0 = 0
CBI DDRC,5 ;DDRC.5 = 0
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example
Write a program that toggles PORTA.4
continuously.
.INCLUDE “M32DEF.INC”
SBI DDRA,4
L1: SBI PORTA,4
CBI PORTA,4
RJMP L1
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 4-2
An LED is connected to each pin of Port D. Write a
program to turn on each LED from pin D0 to pin D7.
Call a delay module before turning on the next LED.
.INCLUDE "M32DEF.INC"
LDI R20, 0xFF
OUT DDRD, R20 ;make PORTD an output port
SBI PORTD,0 ;set bit PD0
CALL DELAY ;delay before next one
SBI PORTD,1 ;turn on PD1
CALL DELAY ;delay before next one
SBI PORTD,2 ;turn on PD2
CALL DELAY
SBI PORTD,3
CALL DELAY
SBI PORTD,4
CALL DELAY
SBI PORTD,5
CALL DELAY
SBI PORTD,6
CALL DELAY
SBI PORTD,7
CALL DELAY
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 4-3 (1/3)
Write the following programs:
(a) Create a square wave of 50% duty cycle on bit 0 of Port
C.
(b) Create a square wave of 66% duty cycle on bit 3 of Port
C.
duty cycle = 50% (TON = TOFF)
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 4-3 (2/3)
Solution: (a)
.INCLUDE "M32DEF. INC“
LDI R20, HIGH(RAMEND)
OUT SPH, R20
LDI R20, LOW (RAMEND)
OUT SPL, R20 ;initialize stack pointer
SBI DDRC, 0 ;set bit 0 of DDRC (PCO = Output)
HERE:
SBI PORTC, 0 ;set to HIGH PCO (PCO = 1)
CALL DELAY ;call the delay subroutine
CBI PORTC, 0 ; PCO = 0
CALL DELAY
RJMP HERE ; keep doing it
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 4-3 (3/3)
Solution: (b)
.INCLUDE "M32DEF. INC“
LDI R20, HIGH(RAMEND)
OUT SPH, R20
LDI R20, LOW (RAMEND)
OUT SPL, R20 ;initialize stack pointer
SBI DDRC, 3 ;set bit 3 of DDRC (PC3 = out)
HERE:
SBI PORTC, 3 ;set to HIGH PC3 (PC3 = 1)
CALL DELAY ;call the delay subroutine
CALL DELAY ;call the delay subroutine
CBI PORTC, 3 ;PC3 = 0
CALL DELAY
RJMP HERE ;keep doing it
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
SBIC and SBIS
SBIC (Skip if Bit in IO register Cleared)
SBIC A,b ; 0 ≤ A ≤ 31, 0 ≤ b ≤ 7
SBIC ioReg, bit ; if (ioReg.bit = 0) skip next
instruction
Example:
SBIC PORTD,0 ;skip next instruction if PORTD.0=0
INC R20
LDI R19,0x23
.INCLUDE "M32DEF.INC"
CBI DDRB, 2;make PB2 an input
SBI PORTB,2
LDI R16, 0xFF
OUT DDRC, R16 ;make Port C an output port
SBI DDRD, 3;make PD3 an output
AGAIN: SBIS PINB, 2 ;Skip if Bit PB2 is HIGH
RJMP AGAIN ;keep checking if LOW
LDI R16, 0x45
OUT PORTC, R16 ;write 0x45 to port C
SBI PORTD, 3 ;set bit PD3 (H-to-L)
CBI PORTD, 3 ;clear bit PD3
HERE: RJMP HERE
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 4-5 (1/2)
Assume that bit PB3 is an input and represents the
condition of a door alarm. If it goes LOW, it means that the
door is open. Monitor the bit continuously. Whenever it goes
LOW, send a HIGH-to-LOW pulse to port PCS to turn on a
buzzer.
Solution:
.INCLUDE "M32DEF. INC"
CBI DDRB, 3 ;make PB3 an input
SBI DDRC, 5 ;make PC5 an output
HERE: SBIC PINB, 3 ;keep monitoring PB3 for
HIGH
RJMP HERE ;stay in the loop
SBI PORTC, 5 ; make PC5 HIGH
CBI PORTC, 5 ;make PC5 LOW for H-to-
L
AVR Microcontroller and EmbeddedRJMP HERE
System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 4-5 (2/2)
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 4-8
VCC
A switch is connected to pin PB0 4.7k AVR
and an LED to pin PB7. Write a PB0
Switch
program to get the status of SW PB7
and send it to the LED. 270
LED
.INCLUDE "M32DEF.INC"
CBI DDRB,0 ;make PB0 an input
SBI DDRB,7 ;make PB7 an output
AGAIN: SBIC PINB,0 ;skip next if PB0 is clear
RJMP OVER ;(JMP is OK too)
CBI PORTB,7
RJMP AGAIN ;we can use JMP too
OVER: SBI PORTB,7
RJMP AGAIN ;we can use JMP too
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Topics
AVR pin out
I/O port programming
I/O Bit manipulation
programming
Simple Digital Input/Output
devices
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Input Mechanisms in Software
Polling
Main loop checks each I/O device periodically.
If input is ready, processor initiates
communication.
Interrupts
External hardware alerts the processor that input is
ready.
Processor suspends what it is doing.
Processor invokes an interrupt service routine
(ISR).
ISR interacts with the application concurrently.
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Polling
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Interrupts
Interrupt Service Routine (ISR)
Short subroutine that handles the interrupt
Interrupt!
Context switch
Processor executes task code Run Interrupt Service Routine
Resume
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Input devices: switches and push buttons
Notes:
• SPST = Single Pole Single-Throw; DPST = Double Pole Single-Throw
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Switches and push buttons
Common types of switches
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Output devices: LEDs
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 1: Whenever we press and hold the push
button “Test” then LED is ON; otherwise LED is OFF
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 2: It is similar to example 1 but with
different hardware
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Example 3: Whenever there is a falling edge on
PB0 then LED is toggled.
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Seven-Segment LED Display
Note:
• dp or DP (decimal point); CC = Common Cathode; CA = Common Anode
• The required current per segment varies from about 2 mA (very small displays) to
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Interfacing LED array
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights