Allen, Would you take a look at my reply to Jan-Erik? I think I finally=20 understand it. The timer just keeps running forever and it generates an=20 interrupt every time it rolls over. In this case that is every 100ms. So=20 all I have to do is have a variable that keeps track of those=20 interrupts. Ten counts =3D a second. I'm just staying in a loop for that=20 one second. When I get back I turn the gate off. I then reenter the loop=20 for 15 seconds. When that time is up I go back and reset the display.=20 Since I am using a variable to change the number of seconds I can now=20 use the ADC to supply a number for the delay loop to adjust how long=20 between display updates. That is it isn't it?? Thanks, rich! On 7/19/2014 3:29 PM, Allen Mulvey wrote: > Richard, > > I would do something like this (again in MikroC): > > // declare a couple of global variables > // the scope must make them persist in both Interrupt and main > Char counter, second_flg =3D0; > > //Timer1 > --=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 .