This time with the code:
Code:@ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF K CON 15 ' Calibration factor for flow meter = # pulses per gal ' Setup Timer0 as an 8-bit counter with the clock input on RA2. ' 1:1 TMR0 prescaler ' TMR0 counts on high-to-low transitions OPTION_REG = %00111000 ' A/D & Comparators disabled ANSEL=0 ' all digital ANSELH=0 ' analog module disabled CM1CON0=0 CM2CON0=0 ' Port setup PORTC = 0 ' LEDs off, PULSOUT RC3 provides a high-going pulse PORTA = 0 TRISC = %11110000 ' lower 4 pins outputs TRISA = %11111111 ' RA2 = 2TMR0 clock input for simulated meter pulse inputs TMR0 = 0 ' clear TMR0 count WPUA.2 = 1 ' enable weak pull-up on RA2 Main: IF TMR0 < K THEN WRITE 7, TMR0 ' write count during testing ' Keep the valve open...do nothing..let water flow HIGH PORTC.0 ' Blink Light LED while water is flowing Pause 500 LOW PORTC.0 PAUSE 500 ELSE WRITE 9, TMR0 ' write count during testing before clearing TMR0 = 0 ' clear TMR0 count PULSOUT PORTC.3,1000 ' Generate required 10 msec pulse to RC3 ENDIF GOTO Main END




Bookmarks