hi all,
I have just been caught out introducing PBPL into some older code, I have prepared an example which demonstates the observation.

This demo is on an 18F4520 PBP 2.5 MCSP 3.0.0.5.
Code:
define OSC 16


'---------------------------- debug defines  -----------------------------------

DEFINE DEBUG_REG PORTB 
DEFINE DEBUG_BIT 5
DEFINE DEBUG_BAUD 38400    
DEFINE DEBUG_MODE 0        
'-------------------------------------------------------------------------------




W0      var word
W1      var word(8)
Counter var byte
Index   var byte
Sum     Var word

Counter = 0
Sum = 0



Start:
w1[0] = 567
w1[1] = 568
w1[2] = 566
w1[3] = 566
w1[4] = 568
w1[5] = 586
w1[6] = 567
w1[7] = 567


w0 = w1[0]       'place first value of w1array into W0 to be able to compare against it  
for index = 1 to 7
    if w1[index] < (w0 - 2) or w1[index] > (w0 + 2) then
      
      debug #w1[index],"   Value out of range" ,10
           
    else
      Sum = Sum + w1[index]
      Counter = Counter + 1  
      debug #w1[index]," within range  ",10 
    endif
next index

pause 1000
goto start

END
If this code is compiled using PBP the IF...AND...THEN routine works perfectly, but if you compile with PBPL then it fails. Is it possible that there some additional fuses I should be setting when converting from PBP to PBPL?

I have found that using the AND/OR in an IF..THEN statement is very code hungry so I try not to use it that often. But I was not expecting this problem at all, took me quite a long time to find it and even then it did not occur to me it was associated with PBPL

Duncan