I'm trying to accumulate the number of counts that the COUNT command returns on each pass though Main. I feel really stupid, but this code always saves and displays the most recent count:

;****16F946:

Pause 10 ;for ICSP
@ __config _WDT_OFF & _CP_OFF & _PWRTE_ON & _MCLRE_ON & _INTRC_OSC_NOCLKOUT

OPTION_REG = %11000000 ;pullups disabled, rising edge, no prescale
ANSEL = 0 ;all pins digital
CMCON0 = 7 ;comparators off
ADCON0 = 0 ;ADC's off
WDTCON = 0 ;WDT off

TRISA = %00000000
TRISB = %11000001 ;switches on RB6,RB7, INT on RB0
TRISC = %00000000 ;LED on RC5, LCD bias on RC3
TRISD = %00000000
TRISE = %00001000 ;MCLR on RE3
TRISF = %00000000
TRISG = %000000

OSCCON = %01100001 ;4mz. mhz. internal

LCD_DB4 VAR PORTB.1
LCD_DB5 VAR PORTB.2
LCD_DB6 VAR PORTA.7
LCD_DB7 VAR PORTA.6
LCD_RS VAR PORTB.3
LCD_E VAR PORTD.2
LCD_Lines CON 1 ' # of Lines on LCD, 1 or 2 (Note: use 2 for 4 lines)
LCD_DATAUS CON 2 ' Data delay time in us
LCD_COMMANDUS CON 20 ' Command delay time in us

INCLUDE "LCD_AnyPin.pbp" ; *** Include MUST be AFTER LCD Pin assignments ****


W1 var BYTE
X1 var byte
X2 var byte

PORTC.4 = 0 ;leds off
PORTD.3 = 0

Main:

count PORTC.5, 1000, W1
write 1,W1
read 1,X1
write 2,X1
read 2,X2
lcdout $fe,1, dec W1
lcdout $fe,$c0, dec X2
pause 10
goto Main


Can someone help, please?

Thank you.