Hi, I'll get to the point: I program PORTA as output, and everytime I write a logic 1 in pin 4 (RA4/T0CKI) it doesn't change. I'm simulating my program in Labcenter ISIS v5 ... it's not the first time that happens, and not only with the 16f628, but with 16f877 and 16f84 (those are the only ones that I was programming lately).. Here is my code:
BTW, the __CONFIG is ok? or i'm doing something wrong there? :S
Greets!!
Code:
LIST P=16F628
INCLUDE <p16f628.inc>
__CONFIG _CP_OFF & _BODEN_OFF & _INTRC_OSC_NOCLKOUT & _DATA_CP_OFF & _LVP_OFF & _MCLRE_ON & _PWRTE_ON & _WDT_OFF & _XT_OSC & _ER_OSC_NOCLKOUT
CounterA EQU 20h
CounterB EQU 21h
CounterC EQU 22h
ORG 0x00
goto INICIO
ORG 0x04
goto inter
INICIO clrf PORTB
clrf PORTA
bsf RCSTA,SPEN
movlw 0x07
movwf CMCON
movlw b'11000110'
movwf OPTION_REG
bsf STATUS,RP0
bcf STATUS,RP1
movlw b'00000011'
movwf TRISB
movlw 0xFF
movwf TRISA
movlw b'00100100'
movwf TXSTA
movlw .25
movwf SPBRG
bsf PIE1,RCIE
bcf STATUS,RP0
bsf RCSTA,SPEN
movlw b'10010000'
movwf RCSTA
bsf STATUS,RP0
bcf STATUS,RP1
bsf TXSTA,TXEN
bcf STATUS,RP0
stt movlw b'11010000'
movwf INTCON
BUCLE goto BUCLE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
inter btfsc PIR1,RCIF
goto getdat
btfsc INTCON,INTF
goto senddat
goto stt
getdat bcf PIR1,RCIF
bsf STATUS,RP0
movlw 0xE0
movwf TRISA
bcf STATUS,RP0
movf RCREG,W
movwf PORTA
goto stt
senddat bsf STATUS,RP0
movlw 0xFF
movwf TRISA
bcf STATUS,RP0
movfw PORTA
movwf TXREG
bsf STATUS,RP0
bcf STATUS,RP1
COMP_TX btfss TXSTA,TRMT
goto COMP_TX
bcf STATUS,RP0
goto stt
;PIC Time Delay = 1,0000020 s with Osc = 4 MHz
PDelay movlw D'6'
movwf CounterC
movlw D'24'
movwf CounterB
movlw D'168'
movwf CounterA
loop decfsz CounterA,1
goto loop
decfsz CounterB,1
goto loop
decfsz CounterC,1
goto loop
return
END
BTW, the __CONFIG is ok? or i'm doing something wrong there? :S
Greets!!