13 Oct 16:33
.nolist
.include "m16def.inc"
.list
.listmac
.device ATmega16
.cseg
.org 0x0000
jmp 0x0030
.org 0x0030
START:
ldi r16, 0x5F
out SPL, r16
ldi r17, 0x04
out SPH, r17
; ustawienie portu B jako wyjsciua
ldi r16, 0b00000001
out DDRB, r16
MAIN:
;bit startu
cbi PORTB, 0 ;1
call DELAY_104
sbi PORTB, 0 ;0
call DELAY_104
cbi PORTB, 0 ;0
call DELAY_104
cbi PORTB, 0 ;0
call DELAY_104
cbi PORTB, 0 ;0
call DELAY_104
sbi PORTB, 0 ;1
call DELAY_104
cbi PORTB, 0 ;0
call DELAY_104
cbi PORTB, 0 ;0
call DELAY_104
;bit stopu
sbi PORTB, 0 ;1
call DELAY_104
jmp PC
.org 0x0100
DELAY_104:
ldi r16, 137
// odliczanie w pętli
LOOP:
dec r16
brne LOOP
ret