45 lines
721 B
Plaintext
45 lines
721 B
Plaintext
; lecture de la liaison série
|
|
|
|
.equ RAMEND = 0x21FF
|
|
.equ SPH = 0x3E
|
|
.equ SPL = 0x3D
|
|
|
|
.equ UBRR0H = 0x00C5
|
|
.equ UBRR0L = 0x00C4
|
|
.equ UCSR0A = 0x00C0
|
|
.equ UCSR0B = 0x00C1
|
|
.equ UCSR0C = 0x00C2
|
|
.equ UDR0 = 0x00C6
|
|
|
|
.org 0x0000
|
|
; Vecteur RESET
|
|
jmp debut
|
|
|
|
.org 0x0080
|
|
debut:
|
|
; initialisation du pointeur de pile
|
|
ldi r28,low(RAMEND)
|
|
ldi r29,high(RAMEND)
|
|
out SPL, r28
|
|
out SPH, r29
|
|
|
|
UBRR0H <- 3
|
|
UBRR0L <- 64
|
|
UCSR0A <- 0b00000110
|
|
UCSR0B <- 0b00011000
|
|
UCSR0C <- 0b00000110
|
|
|
|
boucle:
|
|
; attend qu'un caractère arrive
|
|
si (UCSR0a & 0x80) == 0 saut boucle
|
|
|
|
R20 <- UDR0
|
|
|
|
si R20 == 'a' alors R20 <- 'A'
|
|
si R20 == 'e' alors R20 <- 'E'
|
|
|
|
UDR0 <- R20
|
|
|
|
saut boucle
|
|
|