- This topic has 2 replies, 3 voices, and was last updated 12 years, 10 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
|
Microcontroller › PIC › PIC18f4520 Timer Interrupt
HI ..
I am using PIC18f4520 Microcontroller and want to genrate clock of 10ms.
Please guide me how to Calculate timer value for 10ms using timer0 Inerrupt of PIC18F4520
if you’re looking for guide, this guide is already good enough:
http://www.engineersgarage.com/embedded/pic-microcontroller-projects/timer-circuit
The basic idea is that the timer is a nothing but a counter which will generate an interrupt when it overflows, and the which increments its count each time a pulse received at the timer module. That pulse is derived from your main clock source, ie a the frequency of the clock will be a fraction of the main clock frequency, usually mainclock/4.
You know the main clock frequency, divide it by four, find the number of clocks/counts required. Subtrsct that number from the maximum count possible, and set that count value as base count