James. Your are correct. That is a typing mistake. It should be TMR1ON =3D 0= =20 or 1; //for off or on. My brain slipped. Sorry about that. So does this=20 work? Will this reset the timer to the proper values so that I can=20 always know that the timer will rollover at 100mS? Thanks, rich! //Global variables int count =3D 0; void main(void) { PORTA =3D 0; // Turn porta off TRISA =3D 255; // Set Porta as all inputs PORTC =3D 2; // Set RC1 to RC5 high TRISC =3D 193; // Start with DP1 on, the rest of portc is=20 inputs CMCON0 =3D 7; // Turn off Comparators ANSEL =3D 16; // Set RC0/AN4 as analog // Define commands int DP =3D 1; int Reset =3D 33 + DP; int GateOn =3D 17 + DP; int GateOff =3D DP; while (1 =3D=3D 1) // Loop forever { PORTC =3D Reset; // Clear the Display PORTC =3D GateOn; // Start counting delay(1); // Count the frequency for one second =3D HZ PORTC =3D GateOff; delay(15); // Display the frequency for 15 seconds } } // End NewControlCode.c void delay(int time) { int limit =3D time * 10 + 1; TMR1ON =3D 0; TMR1IE =3D 0; //PIR1bits.TMR1IE =3D 0; resettimer(); count =3D 0; //PIR1bits.TMR1IE =3D 0; TMR1IE =3D 1; TMR1ON =3D 1; while(count < limit) { } return; } void resettimer(void) { TMR1H =3D 0x0B; TMR1L =3D 0xDC; } //Timer1 //Prescaler 1:8; TMR1 Preload =3D 3036; Actual Interrupt Time : 100 ms //Place/Copy this part in declaration section void InitTimer1(){ T1CON =3D 0x31; PIR1bits.TMR1IF =3D 0; TMR1H =3D 0x0B; TMR1L =3D 0xDC; TMR1IE =3D 1; INTCON =3D 0xC0; } void Interrupt(){ if (PIR1bits.TMR1IF){ PIR1bits.TMR1IF =3D 0; TMR1H =3D 0x0B; TMR1L =3D 0xDC; count++; } } On 7/21/2014 11:47 PM, James Cameron wrote: > On Mon, Jul 21, 2014 at 11:28:41PM -0500, Richard R. Pope wrote: >> In MpLab with XC8 the timer on and off control is called TMRxON, >> where x is the timer number. > Nearly. Only for Timer 1 and 2, not for Timer 0. > >> So for my program to turn timer1 on or off >> the instruction is: >> TMR1ON =3D 0; //The timer is off >> TMR1OFF =3D 1; //The timer is on. >> This is in the 16f684 datasheet. I thought I would let everyone know. > No, there's no such thing as TMR1OFF. Use TMR1ON instead. > > Look at the diagram in Figure 6-1 of the PIC16F684 datasheet, and > you'll see how TMR1ON is used to "gate" the clock that increments > TMR1. > > So with TMR1ON low (0) no clock gets to the counter. > --=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 .