PROBLEM SOLVED ON THIS THREAD.

Thanks, Bruce, for clarification on DEFINE. I will use this in all future programs where I have write statements.

Joe S., the 0.01 uF capacitor definitely solved my switch bounce problem. The code now works perfectly and always counts exactly 15 pulses when it activates the external pulse to the valve solenoid.

Your guys are stupendous! I learned more in the interchanges during this thread about programming PIC MCUs than I have learned in weeks reading different sources.

Thanks again and keep up the good work!