If you compile nothing but your variables, you'll see that PBP creates arrayPVal var word[7] first, followed immediately by TR var word[7].
If your code does something like arrayPVal[7] = 10, then you're writing outside the bounds of your array arrayPVal, and accessing TR[0].
PBP does not perform bounds checking when accessing arrays.
arrayPVal var word[7] ' = arrayPVal[0] to arrayPVal[6]
TR var word[7] ' = TR[0] to TR[6]
With PBP allocating RAM for arrayPVal followed immediately by TR, then arrayPVal[7] = 0 will actually clear TR[0]. You will not get an error at compile time, but you will not be working on the array element you think you are.
I.E. you would then be corrupting the low byte in TR[0], which would simulate your problem.
Bookmarks