cipi-cips
Member level 4
- Joined
- Jun 30, 2008
- Messages
- 76
- Helped
- 2
- Reputation
- 4
- Reaction score
- 1
- Trophy points
- 1,288
- Activity points
- 1,867
Can someone explain me how to calculate interrupt time for timers in PIC
for example I have PIC 18F4550 and external oscillator of 20Mhz
from "googling" i found out this:
20Mhz oscillator kicks up 18f4550 to freq. of 48Mhz
now I divide 48Mhz with 4 (cause of 4 cycles per 1 instruction) I get 12mega instruction per cycle.
Now I divide this 12M/ins with prescaler (I will take 1:4), so it is 3000000
now I divide this 3000000 with 65535 (16 bit timer) and it is 45,777
when I use formula for frequency and apply it to 45,777
1/45,777 = 0,021 = 21ms
Is this correct or not, cause when I put .hex file in proteus and try to simulate it On Oscilloscope this interrupt doesnt ocur every 21ms.
Thx
for example I have PIC 18F4550 and external oscillator of 20Mhz
from "googling" i found out this:
20Mhz oscillator kicks up 18f4550 to freq. of 48Mhz
now I divide 48Mhz with 4 (cause of 4 cycles per 1 instruction) I get 12mega instruction per cycle.
Now I divide this 12M/ins with prescaler (I will take 1:4), so it is 3000000
now I divide this 3000000 with 65535 (16 bit timer) and it is 45,777
when I use formula for frequency and apply it to 45,777
1/45,777 = 0,021 = 21ms
Is this correct or not, cause when I put .hex file in proteus and try to simulate it On Oscilloscope this interrupt doesnt ocur every 21ms.
Thx