Jan-Erik, Yep, that was the problem. The gate and the reset pulses are=20 working. The numbers are wrong. It is almost 40 seconds before the reset=20 pulse occurs and the gate is staying on for about 4.4 seconds. I found=20 the problem after you pointed it out. This was another error in the code given by the Mikroelektronika=20 timer calculator. The code from the calculator was void Interrupt1().=20 Capitol I and the numeral 1. That is two problems in one line. It has to=20 be void interrupt 'somename'(void) and no prototype. I'll work on the=20 timing. That will be pretty easy. I sure learned a lot on this one.=20 Watch out for the calculator. It is not correct for XC8. Thanks, rich! On 7/23/2014 11:49 AM, Jan-Erik Soderholm wrote: > Jan-Erik Soderholm wrote 2014-07-23 18:39: > >> Had to change "void interrupt()" to "void interrupt myisr()". >> >> "interrupt" is a function argument, not the name itself. >> > See also "5.9.1 Writing an Interrupt Service Routine" in the XC8 docs. > > "The function qualifier interrupt may be applied to a C function > definition so that it will be executed once the interrupt occurs" > > And the example is clear on this: > > void interrupt tc_int(void) > { > if (TMR0IE && TMR0IF) { > TMR0IF=3D0; > ++tick_count; > return; > } > // process other interrupt sources here, if required > } > > > Jan-Erik. --=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 .