Allen, I try this and it won't compile. I have also tried it with=20 prototypes and I receive the same error messages. I fix one problem and=20 end up with more. Well I'm getting there. All of the help has been=20 greatly appreciated. Thanks, rich! Here are the error messages: Error [195]=20 R:\Programming\PicPrograms\Pic-Controller\NewControlCode.c; 54.12=20 expression syntax Error [195]=20 R:\Programming\PicPrograms\Pic-Controller\NewControlCode.c; 57.12=20 expression syntax Error [195]=20 R:\Programming\PicPrograms\Pic-Controller\NewControlCode.c; 62.16=20 expression syntax Error [194]=20 R:\Programming\PicPrograms\Pic-Controller\NewControlCode.c; 63.21 ")"=20 expected Error [285]=20 R:\Programming\PicPrograms\Pic-Controller\NewControlCode.c; 68.1 no=20 identifier in declaration Warning [374]=20 R:\Programming\PicPrograms\Pic-Controller\NewControlCode.c; 68.1 missing=20 basic type; int assumed Error [314]=20 R:\Programming\PicPrograms\Pic-Controller\NewControlCode.c; 68.1 ";"=20 expected (908) exit status =3D 1 I get these messages with the code from the timer calculator. Please=20 help me? Thanks, rich! On 7/18/2014 9:40 AM, Allen Mulvey wrote: > MikroElektronika has a free Timer Calculator that you can use to get the > code to set up your timer. I don't understand why anyone would want to us= e a > PWM when the timer is so easy and quite accurate. Check this out: > http://www.libstock.com/projects/view/398/timer-calculator > > I use it all the time. For a PIC16 Timer1 you can get 100ms from this cod= e: > > //Timer1 > //Prescaler 1:8; TMR1 Preload =3D 3036; Actual Interrupt Time : 100 ms > =20 > //Place/Copy this part in declaration section > void InitTimer1(){ > T1CON =3D 0x31; > TMR1IF_bit =3D 0; > TMR1H =3D 0x0B; > TMR1L =3D 0xDC; > TMR1IE_bit =3D 1; > INTCON =3D 0xC0; > } > =20 > void Interrupt(){ > if (TMR1IF_bit){ > TMR1IF_bit =3D 0; > TMR1H =3D 0x0B; > TMR1L =3D 0xDC; > //Enter your code here > } > } > > Enable the interrupt. Turn on your pin. Count 10 interrupts. Turn off pin= .. > Turn off and reset timer. Start over when necessary. > > You may need to make minor adjustments (TMR1L) for the time to actually t= urn > the pin on and off. > > Allen > This is the complete code: // Includes go here #include // Prototypes go here void ourdelay(int time); //void InitTimer1(); //void Interrupt1(); /*Richard R. pope 07-19-14 */ #pragma config FOSC =3D XT, WDTE =3D OFF, PWRTE =3D ON, MCLRE =3D OFF \ CP =3D OFF, CPD =3D OFF, BOREN =3D OFF, IESO =3D OFF, FCMEN =3D OF= F main() { 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 Reset =3D 34; int Gate =3D 18; while (1 =3D=3D 1) // Loop forever { TRISC =3D Reset; // Clear the Display TRISC =3D Gate; // Start counting ourdelay(1); // Count the frequency for one second =3D = HZ ourdelay(15); // Display the frequency for 15 seconds } } // End NewControlCode.c void ourdelay(int time) { int x; for(x=3D0; x <=3D time * 10; x++) { } return; } //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; TMR1IF_bit =3D 0; TMR1H =3D 0x0B; TMR1L =3D 0xDC; TMR1IE_bit =3D 1; INTCON =3D 0xC0; } void Interrupt(){ if (TMR1IF_bit){ TMR1IF_bit =3D 0; TMR1H =3D 0x0B; TMR1L =3D 0xDC; //Enter your code here } } --=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 .