Sunday, July 19, 2009

PIC Microcontroller Timer Calculation

Here's some guide for PIC Microcontroller Timer Calculation.

Login to PIC microcontroller timer juggle sheet calculation, calculator, and answer your needs?

If so, then you need tools to automate the process.

Calculations

Normally, you should be on the final outcome, which, in general, the clock or measure during a period. It is quite difficult, first find the information of the file, splitter and then postscalers etc.

PIC timer 0: Calculation Example

A typical example for the calculations to create a break 18ms repeat rate on PIC timer 0th

Selecting a divider report include 1:128 time interrupt (with fosc / 4 or 4 MHz / 4 = 1 MHz) and exceeded the speed of Timer 0th

1 / (1MHz/128/256) = 32.768ms

It is clear that you need more, but you can cut them into overflow on the starting point (the interruption). To do this, you need the period of the clock input of 0, is:

1 / (1MHz/128) = 128us

It's time for the timer to 0 IE

256 * 128us = 32.768ms

Thus, by manipulating the point of overflowing, you can set the period of interruption. Time is 18ms if some calculations:

18ms/128us = 140625 (next Integer value of 141)

The number of account, after the interruption of the generator. To use, timer 0, he is responsible for the following:

TMR0 = 256-143 / / 141 but loses 2 Timer 0 to load.

From that time every 128us of Timer 0 and it is exceeding the 141 (or 18ms)

141 * 128us = 18ms

TCL, scripts for PIC clock calculation

Each time you into a PIC timer you have to do this type of calculations and equipment in each timer is different and you face the fight against interruptions.

To make the process, you can simply three online (free) with modules script Tcl (Tool Command Language). You work in a fashion similar to a Java applet.

Each of these scripts is based on the characteristics of each and allows you to clock divider, or create a value with postscaler regulator. Thus, it is easy to experiment with different values, such that the result is immediately on the Web (the frequency and the remainder of each part of the timer, for example, after the divider, the register after postscaler) .

The calculation is trivial that the sliders around, until you PIC clock time and then adjust the timer value to the house on the right answer.

Thus, you can do, even if the type of operation (all without a computer in sight), for example, "I need a frequency of 15ms.

2 clock hours of the next I could be 15,136 (a 1 minute test) - perhaps I will try to clock 1 - Ah, precision 15ms (took 30 seconds for testing purposes). Simply select with Timer 0 - this 15.040ms (a ~ 30 second test).

Of course, you can also clock (internal or external quartz) as well.

No comments:

Post a Comment

Bookmark and Share