On 9/09/2011 2:53 PM, Josh Koffman wrote: > Ok, I've been doing some math, and I'd love a double check of my thinking= .. > > I'm working on an 18F1320, and I'm looking to use TMR2 and TMR3 for > servo stuff. The chip is running off the 8MHz internal oscillator. > > To generate the 20mS trigger, I'm looking at TMR2. If I setup the > prescale at 1:16 and the postscale at 1:10, then I think I should be > able to load the period register (PR2) with d'250' and get a 50Hz > interrupt. > > Once I've got that going (I won't be able to try it until tomorrow) > I'll be looking at TMR3 to generate the 1mS to 2mS variable pulse. If > I setup TMR3 in 16 bit mode, with a prescale of 1:8, I think I can get > an interrupt at 1mS if I preload the timer register with 65286, and an > interrupt at 2mS if I load with 65031. So I should be able to take my > control value (from whatever, analog pot, data in, etc), subtract it > from 65286, and away I go. > > Does that sound plausible? > That sounds pretty much what I did, but with timers 0 and 1. I was=20 using a PIC16F1934 running at 20MHz with DMX reception as well. David... --=20 ___________________________________________ David Duffy Audio Visual Devices P/L Unit 8, 10 Hook St, Capalaba 4157 Australia Ph: +61 7 38235717 Fax: +61 7 38234717 Our Web Site: www.audiovisualdevices.com.au ___________________________________________ --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .