Thanks for your comment, I have ditched the timer, I ran out of space, I am trying to build the board single sided with through hole components. Also after some thinking about it the fixed pulses aren't what I need any way... I have gone through your math and I think I understand it. After reading the data sheet, it would appear that when I start the timer, I need to write '2' into the timer as it won't increment for 2 cycles after being set. Is there anything bad going to happen when I switch interrupts on and off, and switch the edge for my interrupt/RB0 (I'd like to determine when the trigger is released) I know there are some things that can cause a device reset... > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU] On Behalf Of Jinx > Sent: Saturday, January 17, 2004 8:13 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [EE]: Help with first time circuit > > > > The 555 is for giving 60Hz without any complicated divisors. I had > > thought of doing it in software, but I chose to go the other way. > > To get an "exact but average" 60Hz with a 20MHz isn't too > difficult but there are easier ways > > 60Hz = 83333(recurring)us period = (83333+83333+83334)/3, > which could be done using a cycle of 3 timing loops > > However, if you change to a hex value crystal something close > to your 20MHz (18.432MHz or 19.6608MHz) it becomes quite simple > > (18432000/4) / 256 = 18000 TMR0 IRQs / sec = 150 per 1/2 cycle > > Similarly 19.6608 -> 160 IRQs / 1/2 cycle > > Allow TMR0 to free-run and have an interrupt to bump a RAM counter > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > -- 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