Hello all,
I've been playing with a clock program.
The program will display 24hour on line 1 of an 8x2 LCD
And display 12 hour time on line 2

This is working fine.
I now want to add a button which will stall the increment of seconds.
But for some reason the chip is not responding to the button press.
Pin 13 RA0 is tied to ground via 10k resistor and pulled to 5+ by the button.
But the chip is not detecting the button.

There is an IF statement that looks for 5+ at PORTA.0 pin 13 which calls a subroutine
I've verified this works by temporarily changing it to look for low state rather than high state.

And I've verified with a DVM the pin change from 0 to 5+
And I tempo

What am I missing?

Thanks

------------------------------------------------------------
' 16F676 8x2 Clock Program
' Clock Displayed on Handtronix LCD
' Oscillator = Internal
' LCD 4-bit mode.

#CONFIG
__config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF
#ENDCONFIG

' Defines necessary for PBP3's built-in LCD functions
DEFINE LCD_DREG PORTC ' Set LCD Data port
DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTC ' Set LCD Register Select port
DEFINE LCD_RSBIT 4 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTA ' Set LCD Enable port
DEFINE LCD_EBIT 5 ' Set LCD Enable bit - RA5 pin 2
DEFINE LCD_BITS 4 ' Set LCD 4-bit mode
DEFINE LCD_LINES 2 ' Set LCD lines
DEFINE LCD_COMMANDUS 1500 ' Set command delay time in us
DEFINE LCD_DATAUS 44 ' Set data delay time in us

ANSEL = 0 ' Disable Analog
TRISC = 0 ' PortC all output
TRISA = %00000111 ' RA0,RA1,RA2 (pins 13,12,11) inputs for buttons
' RA3,RA4,RA5 (pins 4,3,2) output

mhr var byte 'Military hour (24hr)
lhr var byte 'Local hour (12hr)
mn var byte 'minute
sc var byte 'second

mhr = 18
lhr = 0
mn = 16
sc = 0

clock_pulse var word
clock_pulse = 1005

Pause 1000 ' Wait for LCD to startup
Lcdout $fe, 1 ' Clear LCD screen
pause 10
lcdout $fe, $0C ' Turn cursor off

mainloop:
lcdout $FE, $80 'Cursor at First Line
lcdout " " 'clear line 1
lcdout $FE, $80 'Cursor at First Line

' FIRST LINE OF CLOCK
if mhr < 10 then lcdout "0" 'To insure hour is double-digit number
lcdout dec mhr,":"

if mn < 10 then lcdout "0"
lcdout dec mn, ":"

if sc < 10 then lcdout "0"

lcdout dec sc
pause clock_pulse

'SECOND LINE OF CLOCK
lcdout $FE, $C0 'Cursor at 2nd line
Lcdout " " ' Clear 2nd line
lcdout $FE, $C0 'Cursor at 2nd line

if mhr > 12 then
lhr = mhr - 12
elseif mhr = 0 then
lhr = 12
else
lhr = mhr
endif

if lhr < 10 then lcdout "0"
lcdout dec lhr, ":"
if mn < 10 then lcdout "0"
lcdout dec mn, " "
if mhr < 13 then
lcdout "AM"
else
lcdout "PM"
endif


'LOOK FOR BUTTON PRESS TO STALL INCREMENT TIME
if PORTA.0 = 1 Then second_pause 'Look for button press and stall clock


'INCREMENT TIME
sc = sc + 1
if sc > 59 then
sc = 0
mn = mn + 1
endif
if mn > 59 then
mn = 0
mhr = mhr + 1
endif
if mhr > 23 then
mhr = 0
endif

Goto mainloop ' Update Display

second_pause:
While PORTA.0 = 1
wend

Goto mainloop 'Update Display

End ' END OF PROGRAM