Quote Originally Posted by Bruce View Post
The USART RX pin should definitely idle high, but this routine has some major issues;
Code:
BEGIN: 
   For K = 240 TO 240  ' <-- BIG problem here
    teller = teller + 1   
    ADRESS = K
    AANTAL = 1 
    buffero(K) = teller  ' <-- there is no buffero(240)
    GoSub WEGSCHRIJVEN
    PauseUs 200
    ADRESS = K
    AANTAL = 1 
    GoSub OPHALEN 
    IF OK = 1 Then
     lcdbufO(K) = bufferi(K) ' <-- same issue here
     LCDBUFI(K) = BUFFERO(K) ' <-- and here
     GoSub LCD 
     OK = 0
    GoTo HIER1
    EndIF
   LCDBUFO(K) = 0
   LCDBUFI(K) = 0
   GoSub LCD
HIER1:  Next
K = 240, but your largest array variables are only 6 bytes. I.E. buffero(0) to buffero(5) would be the last byte available in your buffero array.
I tried to change the For K = 240 TO 240 to For K = 0 TO 5 , but it does not make any difference.

The chip still keeps running VERY slow (like 25 seconds startup time) when I'm using the HSERIN command.

---------------------

The RS232 schematic is ok, I'm using the same for other PCB's with 16f887 and 16f882 chips where it works fine.
----------------------

Also changing the bit TRISG<2> = 1 does not solve this problem.

Any more suggestions?