void puerto_serial_event() interrupt 4{ 
ES=0; /////////////////////// this is not neded, drop it
if(TI==1){ //if transmition occurs 
TI=0; //clears TI /////////////////////////// here you should output next char
} 

if (RI==1){ //if reception occurs 
RI=0; //clears RI 
if(RB8){ 
SM2=0; ///////////////////// here verify that this is the one that is spoken to
} 
else{ 
ind_trama++; ////////////// this should move to xxx below
if(ind_trama>4){ //////////// 4 is a bit small for a ring buffer
ind_trama=0; 
} 
trama[ind_trama]=SBUF; 
////////// xxx
SM2=1; //data mode 1 //  do not leave mode1 till you see end of transmisson
} 
} 
ES=1;  /////////////////////// this is not neded, drop it

}

when copying listings enclose them in {pre> and {/pre> (use <, not {) that preserved the indentions
