Quote Originally Posted by Melanie View Post
Check your code. You may have a jump back from your ISR instead of a RESUME. You might have a jump out of a subroutine instead of a RETURN. Whole heaps of minor things like this which are easily missed can cause your program to crash unexpectedly.

If you run out of RAM, the Compiler will tell you at compile time that you've used up all you're allocated, so it leads me to suspect you're doing something illegal in your code...

Since you're using arrays a typical mistake is to allocate say 64 bytes of RAM for an array...

MyArray var Byte (64)

... and then trying to modify MyArray(64) forgetting that the legal count is from 0-63, and byte numbered 64 (which you can access) does not belong to your array.

CHeck IF/THEN statements that access arrays are counting within the legal limit and not accessing bytes outside the defined array.

On the plus side, I have code that uses large amount of RAM on various 16F and 18F parts without issues (though not on that particular chip you've mentioned).


Thanks for the reply

I've stripped back everything from the code to just the ISR (assembly) and the code which checks for a 1 second epoch (flag is set during ISR)

I can add lots more vars now, so presumably something is wrong with my structuring which I'll have to work on by reintroducing the other subr's one at a time, but at least that's a start.

I'm also using both pwm output channels independently of one another, a 2 x 16 lcd display and a rotary encoder so I've missed a step of something out I reckon !

Best Wishes
Chris