thank's Darrel
Remark:
In my next code if I load TMR1H with a high value code work fine
Main:
TMR1H = %11111111
pause 1
----------------------------
but if I reduce the value in TMR1H code don't work
display is OFF
Main:
TMR1H = %10111111
pause 1
-------------------------------
if I want use this value "TMR1H = %10111111"
I must write "pause 20" and not "pause 1"
an idea ???????
No, I have no idea what you are doing.
If you're using a timer, why do you need pauses?
What frequency are you trying to run the timer at?
What frequency is your primary oscillator?
What PIC are you using?
<br>
DT
I use one 16F877 MCU to 20 Mhz
TMR1 produce an interrupt every 0,4 µSec
for to drive four 7 segment displays (prescaler:1)
My board developpement is EasyPic4
If I write not a Pause after TMR1H %11111111
then the displays don't work
At 4Mhz, each instruction takes 1 uSec to execute.
At 20Mhz, each instruciton takes .2 uSec to execute.
When you take in to account the fact that each jump/return to/from the interrupt handler takes at minimum 4 instructions cycles (2 for the jump into the int handler, 2 for the RETFIE after the handler), which happens to be .8uSec, you have less than ZERO time to do anything.
Even at 40Mhz, you're still at ZERO time left over.
At 48Mhz, you might get one instruction in here and there...
And even at 64Mhz, you probably won't get more than one or two instructions done between interrupts.
I think it is better to post the details of your project so that you could get a decent help. And the .4usec to drive a LED display, to me seems too little time.
Ioannis
Thank's for your explanation it's clear now
I reduced the value preloaded in TMR1
and he works fine without "pause"
Bookmarks