Code:
;
;QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
;QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
;Q Beginn der verwendeten Interrupt Service Routinen ( ISR )
;QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
;QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
;
;
;QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
; INTERRUPT REQUEST 0 INT0
;QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
;
_INT0addr:
sbi LED_PORT,led.ge ;LED-Gelb einschalten T E S T Z W E C K E #############################
cbi LED_PORT,led.ge ;LED-Gelb ausschalten T E S T Z W E C K E #############################
in s_sreg,SREG ;CPU-Statusregister sichern
;
;Pin Change Interrupt 0 -> PCI0 initialisieren
;
in ia,PCMSK ;Pin Change Mask Register laden und..
sbr ia,1<<PCINT0 ;..Pin Change Interrupt 0 auswaehlen
out PCMSK,ia ;..und Register ueberschreiben
in ia,GIMSK ;General Interrupt Masken Register laden und..
sbr ia,1<<PCIE ;..Pin Change Interruput 0 Freigabebit setzen..
out GIMSK,ia ;..INT0 Interrupt freigeben und..
ldi ia,1<<PCIF ;..Pin Change Interrupt Flag..
out GIFR,ia ;..loeschen
;
;INT0 Interrupt sperren
;
in ia,GIMSK ;General Interrupt Mask Register laden..
cbr ia,1<<INT0 ;..INT0 Interrupt sperren vorbereiten und..
out GIMSK,ia ;..ausfuehren..
;
;Systemtakt ( 4,8MHz ) durch 16 teilen ( 300kHz = 3,333µs )
;
ldi a,1<<CLKPCE ;Im Clock Prescaler Register Bit..
out CLKPR,a ;..Clock Prescaler Change Enable setzen..
ldi a,1<<CLKPS2 ;..Sicherheitsprozedur nun mit CLKPCE=0 und
out CLKPR,a ;..CLKPS[3:0] SYS-Takt aendern, abschliessen
_exit_INT0addr:
out SREG,s_sreg ;Statusregister restaurieren
sbi LED_PORT,led.ge ;LED-Gelb einschalten T E S T Z W E C K E #############################
cbi LED_PORT,led.ge ;LED-Gelb ausschalten T E S T Z W E C K E #############################
reti ;_INT0addr ISR verlassen
;
;QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
; PIN CHANGE INTERRUPT 0
;QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
;
_PCI0addr:
sbi LED_PORT,led.ge ;LED-Gelb einschalten T E S T Z W E C K E #############################
cbi LED_PORT,led.ge ;LED-Gelb ausschalten T E S T Z W E C K E #############################
sbi LED_PORT,led.ge ;LED-Gelb einschalten T E S T Z W E C K E #############################
cbi LED_PORT,led.ge ;LED-Gelb ausschalten T E S T Z W E C K E #############################
in s_sreg,SREG ;CPU-Statusregister sichern
;
;Timer0 ruecksetzen
;
clr ia
out TCNT0,ia
;
;Timer/Counter0 im Waveform Generation Mode 2 -> CTC betreiben
;und Compare Match A interrupt initialisieren
;
in ia,TIMSK0 ;Timer/Counter0 Masken Register laden und..
sbr ia,1<<OCIE0A ;..T/C0 Output Compare Match A Interrupt enabeln..
out TIMSK0,ia ;..und dies zurueckschreiben
ldi ia,1<<OCF0A ;Output Compare Flag 0 A..
out TIFR0,ia ;..im T/C0 Interrupt Flag Register loeschen
in ia,TCCR0A ;Timer/Counter0 Control Register A laden..
sbr ia,1<<WGM01 ;..Waveform Generations Mode 2 ( CTC ) einstellen..
out TCCR0A,ia ;..und
in ia,TCCR0B ;Timer/Counter0 Control Register B laden..
sbr ia,1<<CS00 ;..Timer0 mit 1:1 Teiler einstellen..
out TCCR0B,ia ;..und starten
;
;PCINT0 Interrupt sperren
;
in ia,GIMSK ;General Interrupt Masken Register laden und..
cbr ia,1<<PCIE ;..Pin Change Interruput 0 Freigabebit loeschen..
out GIMSK,ia ;..INT0 Interrupt freigeben und..
cbr flag_reg,1<<pdm ;Power-Down-Mode sperren
_exit_PCI0addr:
out SREG,s_sreg ;Statusregister restaurieren
sbi LED_PORT,led.ge ;LED-Gelb einschalten T E S T Z W E C K E #############################
cbi LED_PORT,led.ge ;LED-Gelb ausschalten T E S T Z W E C K E #############################
sbi LED_PORT,led.ge ;LED-Gelb einschalten T E S T Z W E C K E #############################
cbi LED_PORT,led.ge ;LED-Gelb ausschalten T E S T Z W E C K E #############################
reti ;_PCI0addr ISR verlassen
;
;QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
; Timer/Counter0 Compare Match A ISR ( Interrupt Service Routine )
;QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
;
_OC0Aaddr:
in s_sreg,SREG ;CPU-Statusregister sichern
sbi LED_PORT,led.pla ;LED-PLA einschalten T E S T Z W E C K E ##############################
cbi LED_PORT,led.pla ;LED-PLA ausschalten T E S T Z W E C K E ##############################
;
;CY800-Bits erfassen
;
sec ;High-Bit vorgeben
sbis CY800_PIN,cy800.data ;CY800 Signalpin = 1 ?..
clc ;..Nein -> Bit = 0 setzen
;
;Bits zusammenfassen
;
rol byte_0 ;Carry-Bit und weitere Bits links rotieren..
rol byte_1 ;Carry-Bit und weitere Bits links rotieren
rol byte_2 ;Carry-Bit und weitere Bits links rotieren..
dec bit_zlr ;Bitzaehler um eins verringern
brne _pla ;Alle 24 Bits erfasst? NEIN -> springen..
;
;Timer/Counter0 Compare Match A Interrupt sperren
;
_bits_erfasst:
in ia,TIMSK0 ;Timer/Counter0 Mask Register laden und..
cbr ia,1<<OCIE0A ;..T/C0 Output Compare Match A Interrupt..
out TIMSK0,ia ;...sperren
;
;CY800-Paket fertig FLAG setzen ( Vergleich in _main: veranlassen )
;
sbr flag_reg,1<<fertig ;CY800-Paket ( 24-Bits ) erfasst
_pla:
;
;Wert fuer den Timer0 CTC-Mode Compare Match speichern ( restlichen 23 Bits )
;
ldi ia,#ocr0a_rest ;Wert f. Timer0 CTC-Mode Compare Match A laden und..
out OCR0A,ia ;..ins Output Compare0 Match A Register schreiben
;
;Timer0 ruecksetzen
;
clr ia
out TCNT0,ia
_exit_OC0Aaddr:
out SREG,s_sreg ;Statusregister restaurieren
reti ;_OC0Aaddr ISR verlassen
Lesezeichen