Continue to Site

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.

  • 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.

DSPIC Oscillator/Timer Questions.

Status
Not open for further replies.

variaseng

New Member
Hi, I would just like to ask about some things I'm confused about the timers/oscillators in the dsPIC. In one site I saw,

How does one calculate the period of interrupt requests? Let the internal clock be set to 10MHz. The period is 100ns. Since the clock is divided by 256 (prescaler reduces the clock 1:256) to form the timer clock, it follws that the the timer clock is 100*256=25600ns i.e. 25.6µs. At each 10000 clocks an interrupt is requestd, i.e. at each 256ms or approximately 4 times per second.

T = 10000*25.6µs = 256ms ~ ¼s.

I'm confused about what the internal clock here is. For example, I'm using a primary oscillator which is 8MHz. This is the Fosc, right? And Fcy = Fosc/4. But which is the internal clock that I should use for calculating the period of interrupt requests?

Thank you very much!
 
I'm confused about what the internal clock here is. For example, I'm using a primary oscillator which is 8MHz. This is the Fosc, right? And Fcy = Fosc/4. But which is the internal clock that I should use for calculating the period of interrupt requests?

Thank you very much!

Correct.

9.2 Timer Prescaler
The input clock (FOSC/4 or external clock) to the 16-bit
Timer has a prescale option of 1:1, 1:8, 1:64 and 1:256,
selected by control bits TCKPS<1:0> (T1CON<5:4>).

The input to the timer prescaler is FOSC/4. Therefore you should use Fcy to calculate timer periods.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top