bloodaxe писал(а):Спасибо за ответ. А как быть с переменными? Пишет-Location not valid.
.include "m64def.inc"
.def tmp = r16
.def eep_adr_h = r17
.def eep_adr_l = r18
.def speed_n = r19
.ORG $0000 ;reset
rjmp reset
; .ORG $0034 ;TC3A compare
; rjmp speed
.ORG $001E ;TC0 compare
rjmp to_eeprom
reset:
ldi tmp, HIGH(RAMEND)
out SPH, tmp
ldi tmp, LOW(RAMEND)
out SPL, tmp
;TC0 configuring
ldi tmp, (1<<WGM01) | (1<<CS00) | (1<<CS01) | (1<<CS02)
out TCCR0, tmp
ldi tmp, 255
out OCR0, tmp
;TC1 channel A configuring
ldi tmp, (1<<WGM10) | (0<<WGM11) | (1<<COM1A1) | (1<<COM1B1)
out TCCR1A, tmp
ldi tmp, 127
out OCR1AL, tmp
ldi tmp, 0x00
out OCR1AH,tmp
ldi tmp, (1<<WGM12) | (1<<CS11)
out TCCR1B, tmp
ldi tmp, 255
out OCR1BL, tmp
ldi tmp, 0x00
out OCR1BH,tmp
sbi DDRB, 5
sbi DDRB, 6
sbi DDRB, 7
ldi tmp, 0
out PORTB, tmp
;TC2 configurin
ldi tmp, (0<<WGM21) | (0<<WGM20) | (1<<CS22) | (1<<CS21) | (1<<CS20)
out TCCR2, tmp
cbi DDRD, 7
ldi tmp, 0x00
out PORTD, tmp
;TC3 channel A configuring
ldi tmp, 0x00
out TCCR3A, tmp
ldi tmp, (1<<WGM32) | (1<<CS32)
out TCCR3B, tmp
ldi tmp, 59
out OCR3AL, tmp
ldi tmp, 0x00
out OCR3AH,tmp
;other variables
ldi eep_adr_l, 0x00
ldi eep_adr_h, 0x00
;interrupts variables
ldi tmp, (1<<OCIE0)
out TIMSK, tmp
ldi tmp, (1<<OCIE3A)
out ETIMSK, tmp
SEI
start:
nop
rjmp start
speed:
in speed_n, TCNT2
; ldi speed_n, 55
SEI
rjmp start
to_eeprom:
SBIC EECR, EEWE
RJMP to_eeprom
CLI
OUT EEARL, eep_adr_h
OUT EEARH, eep_adr_l
OUT EEDR, speed_n
SBI EECR, EEMWE
SBI EECR, EEWE
SEI
NOP
ldi tmp, 255
sub tmp, eep_adr_l
breq inc_adress
inc eep_adr_l
rjmp start
inc_adress:
inc eep_adr_h
ldi eep_adr_l, 0x00
ldi tmp, 0x08
cpse tmp, eep_adr_h
rjmp start
CLI
ldi tmp, 0x00
out TCCR0, tmp
out TCCR1A, tmp
out TCCR1B, tmp
out TCCR2, tmp
out TIMSK, tmp
rjmp nnp
nnp:
nop
rjmp nnp
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 7