kar2on
Member level 1
4ms interrupt with pic
I seem to be having a problem generating interrupts at specified intervals. I use interrupt for sampling the ADC, on a PIC 18f452 microcontroller. I'm currently using mikroC , I've set the settings to 4Mhz Clock and under XT mode.
The hardware oscillator is a 4Mhz crystal.
Anyone know how I generate a 4ms Interrupt(250Hz). I've set the INTCON register to 0xA0 and the T0CON register to 0x80, Anyone know what TMROH and TMROL should be.
I've figured out that 4Mhz crystal oscillator has 1Mhz internal clock. So roughly about 4Mhz oscillation through a 1/2 prescaler , gives me 2Mhz oscilation.
This require 4ms*2Mhz gives me 8000 cycles. oxFFFF-8000 = E06F...
can anyone concur this result?
I seem to be having a problem generating interrupts at specified intervals. I use interrupt for sampling the ADC, on a PIC 18f452 microcontroller. I'm currently using mikroC , I've set the settings to 4Mhz Clock and under XT mode.
The hardware oscillator is a 4Mhz crystal.
Anyone know how I generate a 4ms Interrupt(250Hz). I've set the INTCON register to 0xA0 and the T0CON register to 0x80, Anyone know what TMROH and TMROL should be.
I've figured out that 4Mhz crystal oscillator has 1Mhz internal clock. So roughly about 4Mhz oscillation through a 1/2 prescaler , gives me 2Mhz oscilation.
This require 4ms*2Mhz gives me 8000 cycles. oxFFFF-8000 = E06F...
can anyone concur this result?