hola,
estoy probando el sgte codigo, el cual se resetea permanentemente. Estoy usando la fc restart_cause(), la cual me devuelve 24=NORMAL_POWER_UP . Estoy leyendo a que se debe esto, pero si alguien me da una mano se lo agradezco. alguien conoce otra forma de saber la causa del reset sin usar la fc restart_cause()??
Saludos
#include <12F683.h>
#device adc=8
#use delay(clock=4000000)
#fuses WDT,INTRC_IO, NOCPD, NOPROTECT, NOMCLR, NOPUT, NOBROWNOUT, NOIESO, NOFCMEN
#use rs232(baud=9600,parity=N,xmit=PIN_A0,rcv=PIN_A1,bits=8,restart_wdt,errors)
#ROM 0x7FF={0x3400}
//--------------------------------
#int_CCP1
CCP1_isr()
{
putc("X");
}
void Constructor (void);
void main()
{
long aux;
restart_wdt();
aux=restart_cause();
printf("Restart=%lu
",aux);
printf("INICIO
"

;
Constructor ();
while (1)
{
restart_wdt();
printf("algo
"

;
delay_ms(2000);
}
}
//-----------------------------------------------
void Constructor (void)
{
restart_wdt();
set_tris_a(0b001110);
#ASM
movlw 0x8f// OSCCON
movwf 0x04
movlw 0b1100101 // 4M, intternal clock, stable
movwf 0x00
movlw 0x90// OSCTUNE – OSCILLATOR TUNING
movwf 0x04
movlw 0b00000//
movwf 0x00
movlw 0x81// OPTION REG
movwf 0x04
movlw 0b11001000// pull up dis,prescaler a wdt
movwf 0x00
movlw 0x8C // PIE1 periph interrup enable
movwf 0x04
movlw 0b00100000// CCP1 enable
movwf 0x00
movlw 0x15 //CCP1CON CCP control reg
movwf 0x04
movlw 0b00000101// captura cada flanco ascend
movwf 0x00
movlw 0x10 //T1CON
movwf 0x04
movlw 0b00000001
movwf 0x00
movlw 0x2007 // config
movwf 0x04
movlw 0b11000011011100 //
movwf 0x00
#ENDASM
setup_adc_ports(0);
setup_adc(ADC_OFF);
//setup_counters(RTCC_INTERNAL,RTCC_DIV_1);
//setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
setup_timer_2(T2_DISABLED,0,1);
//setup_ccp1(CCP_CAPTURE_RE);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
//enable_interrupts(INT_CCP1);
enable_interrupts(GLOBAL);
}