Re: how to determine the difference between 60 / 50 hz in C

From: Las (e.flag_at_rainbow.net)
Date: 12/29/03


Date: Sun, 28 Dec 2003 20:30:05 -0500

My problem was more elementary than I had first figured. The system crystal
runs at 12MHz divided down to 1.5MHz. From there the prescaler which is set
to 63 (a down counter) gives me a clock value of 42us. With this and a timer
set to 255, the timer will be deincremented each 42us to give me a value of
198 for 60Hz and 238 for 50Hz. The area I was having difficulty
understanding was the value of the clock. 12MHz = .0000000833333333 per
cycle; and this being divided down to the counter value of 42us. After the
light bulb went on, everything else was easier.....thanks everyone for your
help......



Relevant Pages

  • Re: To find value for 8051 Timers to program in MODE 2
    ... I have an issue regarding the Timers of the controller ... > TIMER registers. ... there is a prescaler between the clock and the counter. ... prescaler and counter interoperation is in the datasheet. ...
    (comp.arch.embedded)
  • Re: [patch 00/21] hrtimer - High-resolution timer subsystem
    ... Right now the primary function of the state is to tell whether the timer ... > Of course if you consider the possibility of including high resolution ... problem requires solving problems in the clock abstraction first, ...
    (Linux-Kernel)
  • Re: [PATCH] ktimers subsystem 2.6.14-rc2-kt5
    ... > a clock with a better resolution. ... > resolution than the physical clock has. ... reaches this count the timer is expired. ... OTOH We could also do this at the timer interrupt: ...
    (Linux-Kernel)
  • Re: [patch 04/19] Add a framework to manage clock event devices.
    ... Architectures register their clock event devices, ... The functionality is assigned via an event handler to avoid ... It's basically limited to only one global and one per cpu timer, ...
    (Linux-Kernel)
  • Re: [RFC][PATCH] new timeofday core subsystem (v.A0)
    ... >>Still need some way to do user timers that are tightly pegged to the clock. ... > nothing to peg or tie the timer with. ... > caused latency caused by the interrupt programming. ... >>adjust it for drift over time. ...
    (Linux-Kernel)