View Full Version : OWIN fails with PBP2.47 but OK with 2.43

- 22nd August 2007, 12:52
With PBP 2.47 we found that the OWIN command resets the PIC during the OWIN command execution. This does not happen with our older revision 2.43.
The PIC is a 16F876.

In particular, while executing this command:

owin onewireio,0,[str BUF\13]

Where BUF VAR byte [8]

The defines used are:

DEFINE OSC 16 ' If 4MHz is used the the max baud rate is 2400.
INCLUDE "modedefs.bas"
DEFINE ONINT_USED 0 ' 1 for bootloader, 0 no
DEFINE CHAR_PACING 100 ' delay between serial characters
ADCON1 = 7 'Disable ADC . port A in normal mode
RCSTA.7=1 'If HSEROUT is used
DEFINE HSER_RCSTA 90h ' Set receive register to receiver enabled
DEFINE HSER_TXSTA 20h ' Set transmit register to transmitter enabled
DEFINE HSER_SPBRG 25 'Set SPBRG directly (normally set by HSER_BAUD)
DEFINE HSER_BAUD 9600 ' Set baud rate
DEFINE SHIFT_PAUSEUS 50 'delay for Shift in and out clock at high
define HSER_CLROERR 1 ' to avoid hangs due to buffer overrun

The bug is the same if the assembler compilation is done using MPLAP or the PBP included compiler.
Some one has a clue or solution for this ?. It is not nice having to switch PBP compiler revisions depending on the PIC being used.


Darrel Taylor
- 22nd August 2007, 14:47
owin onewireio,0,[str BUF\13]

Where BUF VAR byte [8]

It's receiving 13 bytes into an 8 byte array.
That will overwrite other RAM locations, possibly causing unpredictable results.

- 24th August 2007, 11:26
You are right. I can't believe what I did.....
I changed the array size to 14 and now it compiles OK with all the versions we have.

Thanks a lot !