question

Thread Starter

4ndr3c03lh0

Joined Jun 3, 2010
7
Wanted to implement a driver hits the car park ..
Have to present on Port A (bits 0 to 3) the number of seats available in the park (originally 9).
She also has two traffic lights to control the entrance: red in PA1 and green in PA0 .. When the park is full the traffic light turns red, but while there are free places the green traffic light is lit..
 

Thread Starter

4ndr3c03lh0

Joined Jun 3, 2010
7
This is the code that I've done:

.include"8515def.inc"

.org $0000
rjmp inicio
.org $0001
rjmp atint0
.org$ 0002
rjmp atint1
.org $0007
rjmp attim0
.org $0009
rjmp atps

inicio:
ldi r16, low(ramend)
out spl, r16
ldi r16, high(ramend)
out sph, r16
ldi r16, 0x80
out ddra, r16
ldi r16, 0x0C
out portd, r16
swap r16
out gimsk, r16
ldi r16, 0x0E
out mcucr, r16
ldi r16, 0
out tcnt0, r16
ldi r16, 0x05
out tccr0, r16
ldi r16, 0x02
out timsk, r16
ldi r16, 51
out ubbr, r16
ldi r16, 0x88
out ucr, r16
ldi r17, 94
ldi r18,0x09
ldi r19, 0x00
sei

atint1:
rcall ENTRAOUSAI

RETI

ENTRAOUSAI:
dec r18
cpse r18, r19
rjmp VERDE
rjmp VERMELHO


VERDE:
out porta, r18
sbi porta, 4

VERMELHO:
out porta, r18
sbi porta, 5
 
Top