Joe, This is what I don't know how to do. I believe that I can do the=20 rest of it. At least I think I can, I think I can, I think I can. Thanks, rich! On 7/18/2014 3:42 AM, IVP wrote: >> Do I use a timer or do I setup a set of delay loops > The simplest way is to let the timer, eg TMR1, free-run and generate > interrupts which can be counted > > 1s at 20MHz crystal is 5,000,000 cycles. Using a 16-bit timer this > means 5,000,000 / 65,536 =3D 76 overflow interrupts > > Plus (5,000,000 - (76 x 65,536)) =3D 19,264 more cycles > > A RAM counter is incremented every interrupt, and at the 76th the > timer is loaded with - 19,264. The next interrupt is the 5,000,000 > count. It will actually be a few less than this as you have to account > for the time taken to load the value. > > You can also take off a few for the s/w to react to that 77th interrupt > and set/unset the pin > > If you used a 19.6608MHz then there would be no need for a load, > as (19,660,800 / 4) is exactly divisible by 65,536 =3D 75 interrupts > > Joe --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .