Quote Originally Posted by mister_e
my bet is more about possibility of a buffer overflow.
Try this one for the transmitter
Code:
Set transmit register to transmitter enabled
DEFINE HSER_TXSTA 20h

' Set baud rate
DEFINE HSER_BAUD 2400

cmcon = 7

Main:

    If (PORTA.1 = 0) then
        hserout ["1"]
        while PORTA.1=0 : Wend : pause 500
        endif
    if (PORTA.1 = 1) then
        hserout ["2"]
        while PORTA.1=1 : wend : pause 500        
        endif

goto main
end
what about your crystal speed? Config fuses? Schematic?
It sounds like you only want to send a character on the state change of the switch. Use a bit variable such as current_state for the last known state.
This way, you won't hang the program up waiting for the switch to change.

Read_switch:
if (PORTA.1= current_state) then goto main ; No change goto main program
hserout [PORTA.1 + $30] ; Make the switch value the ASCII equivelent and send it.
current_state = PORTA.1 ; Current_state = switch value
goto main ; How neat is that?!?