
	list p=16F628 ; list directive to define processor
#include p16F628.inc ; processor specific variable definitions

	errorlevel -302 ; suppress message 302 from list file 
	__config _HS_OSC &_CP_OFF &_WDT_OFF &_MCLRE_OFF &_BODEN_OFF &_LVP_OFF

		CBLOCK	0x20
		T1
		T2
		T3
		ENDC
		
			;LCD handshake lines
LCD_E		Equ	.4

		org	0x0000

Initialise	
		clrf	PORTA
		clrf	PORTB



SetPorts	
		bsf 	STATUS,		RP0	;select bank 1
		movlw	0x00			;make all pins outputs
		movwf	TRISB
		bcf 	STATUS,		RP0		
		bsf		PORTB, LCD_E
		bcf 	PORTB, LCD_E

inicializalas
		call 	delay
		movlw   b'00000011'
		movwf 	PORTB
		call enter
		call 	delay
		movlw   b'00000011'
		movwf 	PORTB
		call enter		
		call 	delay
		movlw   b'00000011'
		movwf 	PORTB
		call enter
		call 	delay
		movlw 	b'00000010'
		movwf 	PORTB
		call enter
		call 	delay		
		movlw 	b'00000010'	
		movwf 	PORTB
		call enter
		call 	delay
		movlw	b'00001000'		;2 sor, 5x7 pontos kijelzo beallitasa
		movwf 	PORTB
		call enter
		call 	delay
		movlw 	b'00000000'		;elso fél
		movwf 	PORTB
		call enter
		call 	delay
		movlw 	b'00001000'		;második fél
		movwf 	PORTB
		call enter
		call 	delay		
		movlw 	b'00000000'		;elso fél
		movwf 	PORTB
		call enter
		call 	delay
		movlw 	b'00000001'		;második fél
		movwf 	PORTB
		call enter
		call 	delay
		movlw 	b'00000000'		;elso fél
		movwf 	PORTB
		call 	enter
		call 	delay
		movlw 	b'00000110'		;második fél
		movwf 	PORTB
		call 	enter
		call 	delay
		movlw	b'00000000'		;elso fél
		movwf 	PORTB
		call 	enter
		call 	delay
		movlw 	b'00001000'		;második fél	
		movwf 	PORTB
		call 	enter
		call 	delay
		
pbetu	movlw 	b'00000101'
		movwf	PORTB
		call 	enter
		call 	delay
		movlw	b'00000000'
		movwf	PORTB
		call 	enter
		call 	delay
		goto 	pbetu

enter
		bsf	PORTB, LCD_E
		nop
		bcf PORTB, LCD_E
		return




delay	movlw 	0xFF
		movwf 	T1
delay2	movlw 	0xFF
		movwf 	T2
		nop
		nop
		nop
		nop
		nop
		nop
		nop
		nop
		nop
		nop
		nop	
		nop
		nop
		decfsz 	T2, f
		goto 	delay2
		decfsz	T1, f
		goto delay
		return

		end