Yes it's like your drawing but not working. I send {k3} from the windows terminal and from another 2 programs and it's not working. I am using PICBASIC PRO and PIC16F84a and My code now exactly like this:

define osc 4
include "bs2defs.bas"

wating:
SERIN PORTa.1,N9600,["K"],b1

IF b1 = 51 THEN out ' Ascii 51 = decimal 3 (When you type 3 myvar will be 51)

goto wating ' this line is esential otherwise any key will activate the function

out:

HIGH PORTb.7

PAUSE 300

LOW PORTb.7

goto watin
-------------------------------------

best regard
kindows