FlowchartDiagram
Init, stack ports
& interupt
Nop, Do nothing
timer0_int
Main loop do
nothing wait
for interupt
set r16 to 1
flag for led
of is set
set r16 to 0
upadet leds
return
Labb 4.1
Labb 4.2
Set up, stack
ports, interupts
turn leds off
Waits for interupts
and turn leds on to
let clock "update
them"
timer0_int
Turn leds on
Button 0
interupt
Value to
high? (255)
add 12 to lamp
variable
OCR0A = lamp
Return
Return
Button 2
interupt
Value to low
(3)
return
remove 12 from
lamp variable
OCR0A = lamp
return
Setup ports &
Variables
Labb 4.4
Initialize
USART
New
character?
Using RXC1
Read char,
UDR1 & write to
portB
Setup ports &
Variables
Labb 4.3
Initialize
USART
New
character?
Using RXC1
Read char,
UDR1 & write to
portB
Is buffer
empty?,
UDRE1
Char to outpur
register
Labb 4.5
Setup ports &
Variables2
Initialize
USART
Main loop
Do nothing
wait for
interupt
RX TX interupt
New
character?
Using
RXC12
Read char,
UDR1 & write to
portB2
Is buffer
empty?,
UDRE12
Char to outpur
register2
Return
yes
No
Yes
Yes
yes
No
No
Yes
No
Yes
No
Yes
No2
Yes2
No2
Yes2