Today I started to build a project with a variant of PIC I never used before, 16F876A, but since its the little brother of my old fauvorite pic 16F877A I didnt think it would be any problems..

HOWEVER..

I got LCD-problems, and they are so strange. ..To boil it down I wrote a short test program..

Code:
@ DEVICE PIC16F876A,HS_OSC,LVP_OFF,WDT_OFF,PROTECT_OFF

DEFINE OSC 20	' Lets work at 20 MHz

'	DEFINE LCD_DREG	PORTA				' Set LCD Data port
'	DEFINE LCD_DBIT	0						' Set starting Data bit (0 or 4) if 4-bit bus
'	DEFINE LCD_RSREG	PORTA			' Set LCD Register Select port
'	DEFINE LCD_RSBIT	4					' Set LCD Register Select bit
'	DEFINE LCD_EREG	PORTB				' Set LCD Enable port
'	DEFINE LCD_EBIT	3						' Set LCD Enable bit
'	DEFINE LCD_BITS	4						' Set LCD bus size (4 or 8 bits)
'	DEFINE LCD_LINES	2					' Set number of lines on LCD
'	DEFINE LCD_COMMANDUS	1500	' Set command delay time in us
'	DEFINE LCD_DATAUS	44				' Set data delay time in us

 
pause 2000	' Gracetime for the LCD

Main:

	toggle PORTB.5
	LCDOUT $FE, 1, "Hello"
	LCDOUT $FE, $C0, "World"
	pause 2000
	LCDOUT $FE, 1, "1234567890123456"
	pause 500
	LCDOUT $FE, 1, "ABCDEFGHIJKLMNOP"
	pause 500
	LCDOUT $FE, 1, "abcdefghijklmnop"
	pause 500
	
	goto main:
	
End
..The result is:

First the display says

Hello
World

..Waits 2 seconds and then

34567890123456
waits .5 sec
CDEFGHIJKLMNOP
waits .5 sec
cdefghijklmnop
waits .5 sec
llo
World

..and then continue..

Why is it eating the two leading chars ? ..I tried the display on another breadboard with an
16F877A, works perfectly fine..

I tried to add all defines, and tweak some values (currently commented out in the code), no difference.

Any ideas ?