Thanks, I didn't know how long the ISR really was.
Now we know this, there are a couple of possible solutions..
make the timer longer to 6 or 8 mSec, restart and reload the timer after the ISR or make the ISR less long.
I tried to restart the timer after the ISR(above post) but that didn't work.. Suprisingly did it work somehow when the end of the ISR was 'resume loop'. Then was the program able to make a I2C-read from the RTC and update the var's.
So, the first possible solution is to make longer the timer to let's say 8mSec and afther that reduce the length of the ISR and posible to set the timer back to 2mS.
The ISR is doing a lot of work every time and that is not necessary do execute every time. The lookup for segments is not deeded everytime but can be executed in the program somewhere else and 1 in the 10 times of shiftout is also very acurate(I'm not placing it in a nucear powerplant...) So the only thing left for the ISR to do is shiftout the segmentsdata.
I had problems with var's I did change at the mainloop. He didn't update them by the shiftout.
So, when I place this T2CON = %00000010 is the presale to 1:16 and is the timer about 8mSec, right? Then it have to work anyway?
about the schematic: a ds1307 is connected to A0 & A1. the two 74HC595 are placed at B0 & B1. The pushbuttons for the menu are at port A2, A3 & A7. All including external pullups. For the 7segmentsdisplays are resistors added. The 7segmentsdisplays are Common Cathode and connected with a BC557C to the GND. The PIC16f628 is working at it's internal oscillator. And a smal capacitor of 0,1uF added from V+ to GND near the IC's. So, it's all very basic and there isn't more to tell about the schematic.
Can you also measure how long it takes for a I2C-read and write? Because, when I delete it from the mainloop the ISR can use other var's from the loop...
Bookmarks