# Obtaining the internal clock of dsPIC microcontroller through TIMER capability

Status
Not open for further replies.

#### variaseng

##### New Member
Hi, I am using dsPIC30f4011 microcontroller. I am trying to determine the internal clock of my microcontroller by using TIMERs.

Code:
void Timer2Int() org 0x20{
RF0_bit = ~RF0_bit;
IFS0 = IFS0 & 0xFFBF;
}

void initTMR2(void){
TMR2 = 0;
T2CONbits.TON = 0;
T2CONbits.TSIDL = 0;
T2CONbits.TGATE = 0;
T2CONbits.TCS = 0;
T2CONbits.TCKPS = 1;
PR2 = 1;
IFS0bits.T2IF = 0;
IEC0bits.T2IE = 1;
T2CONbits.TON = 1;
return;
}

void main() {
TRISF &= 0xFFFE;
initTMR2();
}
(I am using XT PLL x4 with 7.37 MHz as my external clock)

Basically, I am just trying to output a PWM signal that SHOULD correspond to the internal clock of my microcontroller. From computations, I should have an internal clock (Fcy) of 7.37MHz through using the PLL 4x. But when I check the frequency of the signal using a oscilloscope, I am only getting ~82kHz. Please tell me if I'm doing/assuming something wrong with my procedure. Thank you very much!

Status
Not open for further replies.