#include P16F876A.INC
zaehler equ 0x70
code 0x00
null
NOP
clrf pclath ;programmspeicher seite0
clrf STATUS ;wähle bank0
goto weiter
reset
org 0x04
bcf portc,7 ;Reset-modus an
goto reset
weiter
movlw 0x00
movwf intcon ;interrrupts aus
movlw 0x00
movwf pir1 ;mögliche interrupts setzen
movwf PIR2 ;ebenfalls
movlw 0x01
movwf t1con ;timer1
movlw 0x00
movwf t2con ;Timer2
movlw 0x04
movwf ccp1con ;CCP1
movwf ccp2con ;ccp2
movlw 0x00
movwf sspcon ;serial port
movlw 0x80
movwf adcon0 ;ad-wandler

bsf status,rp0 ;bank 1
movlw 0x3f
movwf option_reg ;timer0 und portb
movlw 0x00
movwf pie1 ;interrupts setzen
movlw 0x00
movwf pie2 ;interrupts setzen
movlw 0x03
movwf pcon ;reset-merker
movlw 0x00
movwf cvrcon ;comparator aus
movlw 0x3f
movwf trisa ;porta=analoge eingänge
movlw 0xff
movwf trisb ;portb=TTL-eingänge
movlw 0x06
movwf trisc ;portc
movlw 0xf9
movwf pr2 ;Timer2 Periode
movlw 0x00
movwf sspstat ;serial port
movlw 0x00
movwf sspcon2
movlw 0x00
movwf txsta
movlw 0x00
movwf rcsta
movlw 0xc0
movwf adcon1 ;ad-wandler
bcf status,rp0 ;bank0
;---------------------------------------------------------
movlw 0x00
movwf intcon ;interrrupts aus


bsf portc,0 ;1 ausgeben

eins
decfsz zaehler,f
goto eins

bcf portc,0 ;0 ausgeben

zwei
decfsz zaehler,f
goto zwei

goto null

end