Robert, Now I have more question for you. How did you think about it or How did you start calculating it or How did you come up with 4.9152 mhz Did you try each crystal frequency's one by one or Have you done any similar project. Thanks for your time and effort Andre -----Original Message----- Andre Abelian wrote: > Using less then 360 steps will be more difficult to control > I rather use 512 steps then I am making my work harder. > I couldn't understand how did you get 60hz more explanation > Will appreciate. OOPS. Missed the /10. 4.9152 Mhz/32/10/256=60Hz or more explicitly 4.9152/4/8/10/256 =60.0000Hz CLKOUT ^ Prescaler^ TMR0 ^^ Table length ^^^ 4.9152 MHz /4 =CLKOUT =1.2288 MHZ. 1.2288Mhz with TMR0 1:8 is 153600 Hz tick rate. TMR0 /10 gives 15360 Hz interrupt rate. Step through 256 values =60.000 Hz loop. Obviously you can juggle the prescaler/divisor as you wish. E.G. 1:8/10 1:4/20 1:2/40 Higher scaler rate is probably better for jitter. Lots of discussion in the archives about how to reload TMR0 without loosing tics (time). And if you divide by 96 instead of 80 you get 50Hz for free. E.G. 1:8/12 1:4/24 1:2/48 9.8304 Mhz is also a common crystal, and not that far from 8Mhz if you need the higher clock speed. Gives you 512 steps with above divisors. 7.3728 Mhz would also work perfectly. 7.3728 Mhz /4/2/60/256 =60Hz /4/2/72/256 =50Hz And if you really want to stay close to 360 steps try 400 steps. 6.144 Mhz /4/2/32/400 =60.000 Now you know why we have such odd-ball crystal frequencies readily available. And once again we see why it is better to tell us the context of a problem rather than just asking for a solution to a very narrow question. There are many ways to skin a cat... Robert > -----Original Message----- > > Why not use 256 steps? It makes your lookup table easier to implement as > well. > I rather doubt that you will notice a 1 degree vs 1.4 degree step > difference. > Or make it 512 steps and you still get 'nice' numbers with common > crystals. > > 4.9152Mhz (common) /32/256 =60.00000Hz -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics