Buenas, estoy intentando comunicar el pic16f628a con el pc y no lo consigo.Utilizo en Max232.No consigo visualizar nada en el hyperterminal.Espero que me podais ayudar.Gracias.El código es el siguiente
Código:
list p=16F628A ; list directive to define processor
#include <p16F628A.inc> ; processor specific variable definitions
errorlevel -302 ; suppress message 302 from list file
__CONFIG _CP_OFF & _DATA_CP_OFF & _LVP_OFF & _BOREN_OFF & _MCLRE_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
#DEFINE disparo PORTB,0
#DEFINE Rx PORTB,1
#DEFINE Tx PORTB,2
ORG 0
goto inicio
ORG 4
goto interrupcion
;Rutina Servicio Interrupcion
interrupcion
movlw 'H'
call enviaRS232
call retardo
bcf INTCON,INTF
retfie
enviaRS232
movwf TXREG ; envío el dato en acunulador w
bsf STATUS,RP0 ; Pág 1 RAM
Espere btfss TXSTA,TRMT ; transmision completa si es alto
goto Espere
bcf STATUS,RP0 ; Pág 0 RAM
return
;subrutina retardo SW 3x256x256 chapuza
retardo
movlw 0x03
movwf 0x20
retardo3
movlw 0xff
movwf 0x21
retardo2
movlw 0xff
movwf 0x22
retardo1
decfsz 0x22, 1
goto retardo1
decfsz 0x21, 1
goto retardo2
decfsz 0x20, 1
goto retardo3
return
inicio bsf STATUS,RP0
movlw b'00000011'
movwf TRISB
movlw 0x19 ; 0x19=9600 bps (0x0C=19200 bps)
movwf SPBRG
bcf OPTION_REG,INTEDG
movlw b'00100100' ; configuración rs 232
movwf TXSTA
bcf STATUS,RP0
movlw b'10010000' ; habilita de recepción Async
movwf RCSTA
movlw b'10000000'
movwf INTCON
main
sleep
goto main
END ; directive 'end of program'