|
|
View previous topic :: View next topic |
Author |
Message |
[email protected]
Joined: 24 Mar 2010 Posts: 24
|
firmware crash upon adding single opcode |
Posted: Sun Jul 21, 2013 2:55 am |
|
|
Hi,
I am using 18F25K22 with compiler PCH V4.118.
My code is stable and working good.
Today i had to add a small while loop to sample a "signal1" input every 1ms:
Code: |
while(local_counter < 1000)
{
local_counter++;
if (input(signal1) == 0)
return (1); //error
Delay_ms(1);
}
|
The code is located within a 3rd level nested function.
The new code compiles well, but firmware does strange things: i2c communication does not work. The funny thing is that the additional code has nothing to do with i2c routines.
BTW, i commented all the additional code and left only with Delay_ms(1); and error still shows. commented the Delay_ms(1); as well, and problem gone.
How can 1 single Delay_ms(1) command affect all the code?????
Please help!
Gil _________________ Gil F. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Sun Jul 21, 2013 3:07 am |
|
|
First, obvious one. Are you using a delay anywhere inside interrupt routines?. If so (unless you have some errors turned off), you might now be getting 'interrupt disabled to prevent re-entrancy' as a warning, and every interrupt would be delayed for the 1mSec.
Second, at the top of the listing, what does the stack usage say?. You talk about the routine being '3rd level', but if interrupts then call other routines, and perhaps you have high priority also enabled, you may well be running out of stack.
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|