Hoffe ist einigermassen Verständlich
gruss
Code:
;*-----------------------------------
;* MF **
;* Sion, den 2.November 2004 **
;* **
;* RS232 Protokoll lesen, synchro **
;*-----------------------------------
;------------------------------------
;-------------------PIC-Settings-----
list p=16f877
include "p16f877.inc"
;------------------------Variablen definieren---
;-----------------------------------------------
CBLOCK H'070'
w_temp:1
status_temp:1
counter:1
mes_count:1
start_za:1
compt:1
ENDC
;------------------------------------------------
org 00h
nop
goto init
;------------------------------------------------
;----------------------Routine Interruption-----
org 0x004
movwf w_temp
swapf STATUS,w
movwf status_temp
;----------Verzögerungstest, zur synchronisation-
nop
decfsz mes_count
goto left
;---------------------------------------
bsf PORTD,1
movlw D'28'
movwf mes_count
nop
nop
incf counter
movlw D'8'
subwf counter,w
banksel TRISC
btfss STATUS,2
goto left
banksel PORTC
bcf INTCON,5
clrf PORTD
call Time_out
clrf counter
BANKSEL TMR0
clrf TMR0
BANKSEL PORTD
movlw D'28'
movwf mes_count
;----------------------------------------
left
BANKSEL PORTD
clrf PORTD
;----------------------------------------
swapf status_temp,w
movwf STATUS
swapf w_temp,f
swapf w_temp,w
retfie
;------------------------------------------------------
;-----------------------Initialisieren-----------------
init
BANKSEL TRISC
movlw B'11111111'
movwf TRISC
movlw B'11111111'
movwf TRISB
movlw B'00000000'
movwf TRISD
movlw B'00000000'
movwf OPTION_REG
bsf OPTION_REG,3;
BANKSEL PORTD
clrf INTCON
movlw B'10000000'
movwf INTCON
clrf PORTC
clrf PORTD
clrf counter
clrf mes_count
movlw D'28'
movwf mes_count
BANKSEL TMR0
clrf TMR0
BANKSEL PORTD
;-----------------------------------------------
;------------------------Programme Principal----
Main
btfss INTCON,5
btfsc PORTC,7
goto Main
Timer_on
bcf INTCON,2
bsf INTCON,5
goto Main
;----------------------------------------------------
Time_out
movlw D'100'
movwf compt
loop
decfsz compt
goto loop
return
;----------------------------------------------------
END
Lesezeichen