; Source created with Parsic Version 3.x

; at              : 16.01.2000 15:57:05


; Project File    : E:\DATEN\DELPHI\PARSIC\INTERNET\BSP\ANSATZ1.PIC

; Project Version : 1.0.11

; Created         : 14.03.1999 21:12:00

; Last change     : 10.06.1999 22:30:00

	PROCESSOR 16C84

	INCLUDE P16C84.INC

	RADIX DEC


	__IDLOCS H'0100'

	__CONFIG _CP_OFF & _PWRTE_ON & _WDT_ON & _XT_OSC

; Diverses

ZERO	EQU Z	; ZERO-Flag
CARRY	 EQU C	; CARRY-Flag


; Variable

S0	= 12	; located in Bank 0, 1
RAM	= 13	; located in Bank 0, 1

	ERRORLEVEL -302	; disable warning (Bankswitching)
	ERRORLEVEL -306	; disable warning (Pageswitching)

;****************************************
;Programmanfang
;****************************************

	ORG 0

	CLRF STATUS	; switch to RAM-Bank 0
	MOVLW HIGH SYS_INIT	; set ROM-Bank
	MOVWF PCLATH
	GOTO SYS_INIT

;****************************************
; Subroutines
;****************************************


;****************************************
; Tables
;****************************************

	RETURN

;****************************************
;Initialisierung
;****************************************


SYS_INIT

	MOVLW B'00000000'
	MOVWF INTCON

; Ausgangs-Pegel setzen, bevor die Richtung gesetzt wird

	BCF STATUS,RP0	; Bank 0
	MOVLW B'00000000'
	MOVWF PORTA

	MOVLW B'00000000'
	MOVWF PORTB

	MOVLW 15
	BSF STATUS,RP0	; Bank 1
	MOVWF OPTION_REG


; Richtung setzen

	MOVLW B'11111111'
	MOVWF TRISA

	MOVLW B'11111111'
	MOVWF TRISB

; init var

	CLRF S0


;**********************************
;******* Haupt-Programm ***********
;**********************************

MAIN

	CLRWDT

;***************************************************
; RS-FLIP-FLOP -> RS1
;***************************************************

	BCF STATUS,RP0	; Bank 0
	BTFSS PORTB,0
	GOTO LABEL_RS1_RESET
	BTFSS S0,0
	GOTO LABEL_RS1_ENDE
	BSF S0,1	; Ausgang setzen
	GOTO LABEL_RS1_ENDE
LABEL_RS1_RESET
	BCF S0,1	; Ausgang zurücksetzen
LABEL_RS1_ENDE

;***************************************************
; UND - Gatter -> UG1
;***************************************************

LABEL_UG1_1
	BTFSC S0,1
	GOTO LABEL_UG1_FALSE
LABEL_UG1_2
	BCF STATUS,RP0	; Bank 0
	BTFSS PORTB,0
	GOTO LABEL_UG1_FALSE

LABEL_UG1_TRUE
	BSF S0,0
	GOTO LABEL_UG1_ENDE
LABEL_UG1_FALSE
	BCF S0,0
LABEL_UG1_ENDE
;****************************************


	GOTO MAIN


	END

