Hello all. In MpLab and XC 8 you have to use: TMR1IE =3D 0 or 1; to control the=20 TMR enable bit. TMR1IE_bit will not work. Thanks, rich! On 7/21/2014 11:45 AM, Allen Mulvey wrote: > Richard, > > I think you are pretty much there. > > while(count <=3D time * 10) should be while(count <( time * 10)) > You are starting from zero so you do not want to include 10. I usually us= e > the parentheses to make sure the multiplication is performed before the > comparison. You can check the order of precedence in the help file to see= if > it is really necessary. With multiplication, it probably isn't. (A single > semicolon ';' can be used in place of the two braces '{}') > > I would also turn off the timer while it is being reset and possible any > time it is not in use. > This will do it: > void delay(int time) > { > TMR1IE_bit =3D 0; // stop timer > resettimer(); > count =3D 0; > TMR1IF_bit =3D 1; // start timer > while(count <=3D time * 10) > { > } > return; > } > > > Regarding your earlier question, you do not directly access the ISR. You > merely turn it on or off with the interrupt enable bit. When enabled it r= uns > independently in the background. You just monitor the variables that it > affects, as you are doing with count. > > Allen > --=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 .