I've modified the code according to the answers.
But with or without the 32,768kHz crystal, the LED will always blink.
As per datasheet, I have enabled LP oscillator. Why should I set the internal oscillator instead please?
Same question for T1CON.TMR1CS; why should I set this one?
Code:' ====== FUSES ==================================================================================== ' PIC 16F690 __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOD_ON & _IESO_ON & _FCMEN_ON ' ====== INTERRUPT SERVICE ROUTINE ================================================================ GOTO INIT: ' Just to place ISR at top of program DISABLE ISR: 'if TMR1IF is set (TMR1 has overflown) toggle PORTB.6 'LED PIR1.0 = 0 ' clear TMR1IF overflow flag resume ENABLE ' ====== INITIALIZE =============================================================================== INIT: PAUSE 1000 'circuit settle time ' ====== DEFINES ================================================================================== DEFINE OSC 4 ' ====== REGISTERS ================================================================================ ' 76543210 OPTION_REG = %10000000 ' Pull-Ups disabled OSCCON = %01100000 ' Internal RC set to 4Mhz ANSEL = %00000000 ' Analog inputs Channels 0 to 7 ANSELH = %00000000 ' Analog inputs Channels 8 to 11 INTCON = %11000000 ' INTerrupts CONtrol: GIE is ON, PEIE is ON T1CON = %00111011 ' Timer1 OSC enabled, Timer1 enabled, presc.1:8 PIE1 = %00000001 ' Enable TMR1IF overflow flag ' ====== PROGRAM ================================================================================== ON INTERRUPT GOTO ISR MAIN: goto MAIN: END




Bookmarks