Page 1 of 1

Component Macros that disable INT

Posted: Mon Oct 12, 2009 1:09 am
by Ron
Hi,

Can you tell me what component macros disable Interrupts please.

I was trying to go through the "C" code for my program and it looks like writing to eeprom disables INT.

I also use I2C, SPI and RS232 in my programs as well. I did not find anything else that disabled the INT in my program.

It would be nice to have a published list of what disables the INTs.

In my case I want to use TMR0 to count in 10ms increments, but if the component macros I use disable TMR0 then the timing will not be accurate.

Thank you,

Ron

Re: Component Macros that disable INT

Posted: Mon Oct 12, 2009 8:22 am
by Benj
Hello Ron

The EEPROM component does disable interrupts but it has to to ensure a correct EEPROM write. If the interrupt is disabled for a couple of microseconds then it shouldn't effect any of the timer interrupts etc as these will still be triggered even if the event itself was missed. As the timer counter is always counting the next interrupt after will be back in synch with the event. I will try and generate a list of components that do things with interrupts.

Re: Component Macros that disable INT

Posted: Fri Oct 23, 2009 12:19 am
by Ron
Hello Ben,

I have been trying to get TMR0 to work accurately with very little luck. I believe I have traced it to EEPROM READs. I read 15 eeprom addresses with every logic solve of the project. My project has no loops that tie up the program for extended period of time (other than the eeprom read loop logic). Timed logic such as a Delay command simply counts down to zero based on 10ms system ticks (TMR0 logic). Example: Use enters .30 for a Pause, I count down 30 of the TMR0 10ms "ticks". Think of my code solving more like a typical PLC Ladder Logic (Siemens, Mitsubishi, GE, AB) the logic goes through each scan top to bottom, when loop back to the top of the flowchart 15 more eeprom addresses are read and the logic is solved. I do a Pause command (like Delay) and set it to 200 seconds. It times out in about 212 seconds based on my TMR0 settings. If I change my code so it only reads 3 eeprom addresses each scan, the 200 second pause is reduced to about 198 seconds.

If I only have the TMR0 logic in a project by itself it appears to be fine but I want to test this further to confirm.

Could reading so many eeprom addresses on each scan really affect TMR0 so dramatically?

Thank you,

Ron

Re: Component Macros that disable INT

Posted: Fri Oct 23, 2009 8:05 am
by Benj
Hello Ron

The EEPROM read function should not effect the interrupts. It does not touch any of the interrupt control registers. Therefore it seems strange that the EEPROM reads would be effecting your timing so much. What are you doing in your interrupt routine is there a lot of code in there or is it fairly minimal?