Hier hab ich mich jetzt mal rangesetzt und rumprobiert...

Mein STATUS RA ist sicher nicht richtig, weil ich mit Status ja nur die Status-Bits abfragen kann, oder irre ich mich da? Würde mich über meinungen und Verbesserungsvorschläge freuen!

Gruß Alex

Code:
 list P=16F84.inc

;	PORTA: 	0 - 
;		1 -
;		2 -	
;		3 -
;		4 -
;	PORTB:	0 LCD Display E
;		1 		
;		2 LCD Display RS
;		3 LCD Display R/W	
;		4-7 LCD Display D4 .. D7

#include <P16f84.INC>
 __CONFIG	_PWRTE_ON & _WDT_OFF & _XT_OSC



w_copy	Equ	0x20
s_copy	Equ	0x21
LcdDaten  Equ	0x22
LcdStatus Equ	0x23
loops	EQU	0x24
loops2	EQU	0x25

; Constanten festlegen

PORTControl	equ	PORTB		 
PORTData	equ	PORTB		         
LcdEnable	equ	0		 
LcdRw	equ	3		         
LcdRs	equ	2		         	
Ini_con Equ	B'00000000'	         
Ini_opt	Equ	B'00000010'	



Init	bsf     STATUS, RP0	 
	movlw   Ini_opt     	 
	movwf   OPTION_REG 
	movlw	B'11111000'	 
	movwf	TRISA		  
	movlw	B'00000000'	 
	movwf	TRISB
	bcf     STATUS, RP0	 
	clrf	PORTA		
	clrf	PORTB		
				
	movlw   Ini_con     	 
	movwf   INTCON   

	call	InitLCD	

InitLCD
	movlw	D'255'		 
	movwf	loops	
	call	WAIT		

	movlw	B'00110000'	 
	movwf	PORTB
	bsf	PORTB, LcdEnable
	nop	
	bcf	PORTB, LcdEnable
	
	movlw	D'50'		 
	movwf	loops
	call	WAIT
	
	movlw	B'00110000'	 
	call	Control8Bit
	movlw	B'00110000'	 
	call 	Control8Bit
	movlw	B'00100000'	 
	call 	Control8Bit

	movlw	B'00000001'	 
	call	OutLcdControl	
	movlw	B'00101000'	 
	call	OutLcdControl	
	movlw	B'00001000'	 
	call	OutLcdControl
	movlw	B'00000110'	 
	call	OutLcdControl
	movlw	B'00000011'	 
	call	OutLcdControl
	movlw	B'00001111'	 
	call	OutLcdControl
	return	

Control8Bit
	movwf	PORTB
	bsf	PORTB, LcdEnable
	nop
	bcf	PORTB, LcdEnable
	movlw	D'10'
	movwf	loops
	call 	WAIT
	return 

OutLcdControl
	movwf	LcdDaten
	call	LcdBusy
	movf	LcdDaten, w
	andlw	H'F0'
	movwf	PORTData		 
	bsf	PORTControl, LcdEnable
	nop
	bcf	PORTControl, LcdEnable	 
	swapf	LcdDaten, w
	andlw	H'F0'
	movwf	PORTData		 
	bsf	PORTControl, LcdEnable
	nop
	bcf	PORTControl, LcdEnable	 
	return

WAIT
top      movlw   .110            
         movwf   loops2
top2     nop                     
         nop
         nop
         nop
         nop
         nop
         decfsz  loops2, F       
         goto    top2            
                                 
         decfsz  loops, F        
         goto    top             
         retlw   0               

LcdBusy
	bsf	PORTA, 1	 
        bsf     STATUS, RP0	 
	movlw	B'11110000'
	iorwf   TRISB, f 
        bcf     STATUS, RP0
BusyLoop		
	bcf	PORTControl, LcdRs
	bsf	PORTControl, LcdRw	 
	bsf	PORTControl, LcdEnable
	nop
	movf	PORTData, w
	movwf	LcdStatus
	bcf	PORTControl, LcdEnable
	nop
	bsf	PORTControl, LcdEnable	
	nop
	bcf	PORTControl, LcdEnable
	btfsc	LcdStatus, 7	 
	goto	BusyLoop
	bcf	PORTControl, LcdRw
        bsf     STATUS, RP0	 
	movlw	B'00001111'
	andwf   TRISB, f    
        bcf     STATUS, RP0
	bcf	PORTA, 1	 
	return	

OutLcdDaten
	bsf	PORTA, 2	 
	movwf	LcdDaten
	call	LcdBusy
	movf	LcdDaten, w
	andlw	H'F0'
	movwf	PORTData		 
	bsf	PORTControl, LcdRs	 
	bsf	PORTControl, LcdEnable	 
	nop
	bcf	PORTControl, LcdEnable	 	
	swapf	LcdDaten, w
	andlw	H'F0'
	movwf	PORTData		 
	bsf	PORTControl, LcdRs	 
	bsf	PORTControl, LcdEnable
	nop
	bcf	PORTControl, LcdEnable	 
	bcf	PORTControl, LcdRs	 
	bcf	PORTA, 2	 
	return

	end		
 
Bereit

        movlw	'B'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'e'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'r'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'e'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'i'
	movwf	LcdDaten
	call	OutLcdDaten
        movlw   't'
        goto Main

Main 
        BTFSC  STATUS, RA0  
        goto   Alarm1
        btfsc  Status, RA1
        goto   Alarm2
        btfsc  Status, RA2
        goto   Alarm3
        btfsc  Status, RA3
        goto   Alarm4
        btfsc  Status, RA4
        goto   Alarm5
        goto Main

Alarm1
        goto clrdisplay
        movlw	'A'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'l'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'a'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'r'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'm'
	movwf	LcdDaten
	call	OutLcdDaten
        movlw   '1'
        movwf	LcdDaten
        call	OutLcdDaten
        Goto check1

Alarm2
        goto clrdisplay
        movlw	'A'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'l'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'a'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'r'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'm'
	movwf	LcdDaten
	call	OutLcdDaten
        movlw   '2'
        movwf	LcdDaten
        call	OutLcdDaten
        Goto check2

Alarm3
        goto clrdisplay
        movlw	'A'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'l'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'a'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'r'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'm'
	movwf	LcdDaten
	call	OutLcdDaten
        movlw   '3'
        movwf	LcdDaten
        call	OutLcdDaten
        Goto check3

Alarm4
        goto clrdisplay
        movlw	'A'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'l'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'a'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'r'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'm'
	movwf	LcdDaten
	call	OutLcdDaten
        movlw   '4'
        movwf	LcdDaten
        call	OutLcdDaten
        Goto check4

Alarm5
        goto clrdisplay
        movlw	'A'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'l'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'a'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'r'
	movwf	LcdDaten
	call	OutLcdDaten
	movlw	'm'
	movwf	LcdDaten
	call	OutLcdDaten
        movlw   '5'
        movwf	LcdDaten
        call	OutLcdDaten
        Goto check5

check1
        btfsc Status, RA0
        goto check1
        clrdisplay
        goto Main
        
check2
        btfsc Status, RA1
        goto check2
        clrdisplay
        goto Main

check3
        btfsc Status, RA2
        goto check3
        clrdislay
        goto Main

check4
        btfsc Status, RA3
        goto check4
        clrdisplay
        Goto Main

check5
        btfsc Status, RA4
        goto check5
        clrdisplay
        Goto Main 

clrdisplay

        movlw	D'255'		 
	movwf	loops	
	call	WAIT		

	movlw	B'00110000'	 
	movwf	PORTB
	bsf	PORTB, LcdE
	nop	
	bcf	PORTB, LcdE
	
	movlw	D'50'		 
	movwf	loops
	call	WAIT
	
	movlw	B'00110000'	 
	call	Control8Bit
	movlw	B'00110000'	 
	call 	Control8Bit
	movlw	B'00100000'	 
	call 	Control8Bit

	movlw	B'00000001'	 
	call	OutLcdControl	
	movlw	B'00101000'	 
	call	OutLcdControl	
	movlw	B'00001000'	 
	call	OutLcdControl
	movlw	B'00000110'	 
	call	OutLcdControl
	movlw	B'00000011'	 
	call	OutLcdControl
	movlw	B'00001111'	 
	call	OutLcdControl
	return