Студопедия.Орг Главная | Случайная страница | Контакты | Мы поможем в написании вашей работы!  
 

Out portb,temp ;output to portb



Clr temp

sbr temp,(1<<PB4);set PB4

Out DDRB,temp; Set port B(4) as output

;***** рарешить использование XRAM(MCUCR |= 0xc0 -- SRE=1, SRW = 0 без ВСТАВКИ ТАКТА ОЖИДАНИЯ)

In temp,low(MCUCR);read MCUCR

sbr temp,(1<<SRE);set SRE

cbr temp,(1<<SRW);clear SRW

Out low(MCUCR),temp;output to MCUCR

Rcall SetLed

CopyBlock:

;***** ROM -> SRAM

ldi ZH,high(F_TABLE*2)

ldi ZL,low(F_TABLE*2);

Ldi YH,high(BLOCK1)

Ldi YL,low(BLOCK1);

Ldi flashsize,SIZE

Rcall flash2ram;

;***** SRAM -> XRAM

Ldi ZH,high(BLOCK1)

Ldi ZL,low(BLOCK1);

Ldi YH,high(BLOCK2);

Ldi YL,low(BLOCK2);

Ldi ramsize,SIZE

Rcall ram2ram;

; ldi ZH,high(F_TABLE*2);

; ldi ZL,low(F_TABLE*2);

; ldi YH,high(BLOCK2);

; ldi YL,low(BLOCK2);

; ldi ramsize,SIZE

; clr temp1

; rcall cmpromram

; or temp1,temp1

;Cont1:

; breq Cont

Rcall SetLed

Rcall delay_

Rcall ClearLed

Rcall delay_

; dec temp1

; rjmp Cont1

;Cont:

Rjmp CopyBlock

forever:rjmp forever

SetLed:

Push temp

In temp,PORTB;read PORTB latch

sbr temp,(1<<PB4);set PB4

Out PORTB,temp;output to PORTB

Pop temp

Ret

ClearLed:

Push temp

In temp,PORTB;read PORTB latch

cbr temp,(1<<PB4);clear PB4

Out PORTB,temp;output to PORTB

Pop temp

Ret

;Пауза

delay_:

Push temp

In temp,SREG;Cохранить системные регистр

Push temp;Сохранить его в стеке

Ldi temp,0x10

dell0: clr temp2

dell1: dec temp2

Brne dell1

Dec temp

Brne dell0

Pop temp

Out SREG,temp;Все вернуть

Pop temp

Ret

flash2ram:

Push ZH

Push ZL

Push YH





Дата публикования: 2015-09-18; Прочитано: 216 | Нарушение авторского права страницы | Мы поможем в написании вашей работы!



studopedia.org - Студопедия.Орг - 2014-2024 год. Студопедия не является автором материалов, которые размещены. Но предоставляет возможность бесплатного использования (0.006 с)...