• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Obtaining the internal clock of dsPIC microcontroller through TIMER capability

Not open for further replies.


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

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;

void main() {
(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! :)
Not open for further replies.

Latest threads

EE World Online Articles