HOLA NATALIA:
Aqui te envio una rutina en assembler para transmitir y recibir datos por software desde un PIC al PC. Lo que tienes que hacer es cargar el registro: xmtreg con el dato que quieres enviar a la PC y luego llamar a asyxmt y listo. Esta configurado para enviar 8 bits de datos a 4800 baudios por el pin del puertoA que declares como salida (xmit). Espero te sirva. Saludos desde Peru.;====== HALF.GRP ==========================================================
;
asyrec bcf comflag,1
bcf comflag,0
movlw 09
movwf bitctr
asyrec1 btfsc porta,rec
goto asyrec1
call half
btfss porta,rec
goto asyrec3
bsf comflag,1
goto asyrecx
asyrec3 call full
decfsz bitctr,f
goto asyrec4
btfss porta,rec
bsf comflag,0
goto asyrecx
;
asyrec4 bsf status,c
btfss porta,rec
bcf status,c
rrf recreg,f
goto asyrec3
;
asyrecx retlw 0
;
;-------------------------------------------------------------------------
asyxmt bcf porta,xmit
call full
movlw 08
movwf bitctr
asyxmt1 rrf xmtreg,f
btfsc status,c
goto asyxmt2
bcf porta,xmit
goto asyxmt3
asyxmt2 bsf porta,xmit
;
asyxmt3 call full
decfsz bitctr,f
goto asyxmt1
;
bsf porta,xmit
call full
retlw 0
;---------------------------------------------------------------------------
vdly movf bcount,w
movwf cntrb
vdly0 movf acount,w
movwf cntra
vdly1 decfsz cntra,f
goto vdly1
decfsz cntrb,f
goto vdly0
retlw 0
;--------------------------------------------------------------------------
half movlw d"3"
movwf bcount
movlw d"20"
movwf acount
call vdly
retlw 0
;-------------------------------------------------------------------------
full movlw d"3"
movwf bcount
movlw d"43"
movwf acount
call vdly
retlw 0