- 10


add templ,periodl

adc temph,periodh

out OCR1AH,temph ; put the time of maching

out OCR1AL,templ

ldi flag,0b00000100

rcall WAITMATCH ; wait match

cbi PORTB,3 ;extinguish the diode

ldi flag,0

ret

WAIT0: ; wait falling

rcall RSTTIMER

cbi PORTB,4; init

mov timeh,periodh

mov timel,periodl

WT:

rcall SMALLPULSES1

sbrs flag,0

rjmp WT

ldi flag,0

ret

SMALLPULSES1:;forms the intermediate pulses

sbi PORTB,3 ; light the diode

ldi smallperiodl,low(SMALLPERIOD0); put Initial frequency for intermediate pulses for 0

ldi smallperiodh,high(SMALLPERIOD0)

add smalltl,smallperiodl

adc smallth,smallperiodh

out OCR1AH,smallth ; put the time of maching

out OCR1AL,smalltl

rcall WAITMATCH

sbrc flag,0

rjmp EX

cbi PORTB,3;extinguish the diode

ldi smallperiodl,low(SMALLPERIOD1); put Initial frequency for intermediate pulses for 1

ldi smallperiodh,high(SMALLPERIOD1)

add smalltl,smallperiodl

adc smallth,smallperiodh

out OCR1AH,smallth ; put the time of maching

out OCR1AL,smalltl

rcall WAITMATCH

EX:

ret

WAIT1: ; wait raising

in timel,TCNT1l; init

in timeh,TCNT1H

add timel,periodl

adc timeh,periodh

in smalltl, TCNT1l

in smallth, TCNT1H

W1:

rcall SMALLPULSES2

sbrs flag,0

rjmp W1

ldi flag,0

ret

SMALLPULSES2: ;forms the intermediate pulses

sbi PORTB,4 ; light the diode