Hi Luca,

I haven't looked at the rest of it, but both programs are missing the bottom of the Main loop.
Code:
MAIN:
HIGH LED2
IF PORTB.0 = 0 THEN MAIN
B0 = 1
LOW LED2
GOSUB GETDATA
GOTO MAIN

GETDATA:
SSPBUF = "?"
GOSUB LETCLEAR
if SSPBUF<>"!" THEN GETDATA
SSPBUF = 0