Hello there. I have written a simple code but it seems not to work properly. I am not sure what I am missing here and any help will be appreciated.
The code is as follows:
When I comment the INTCON, my led blinks fine @ 500mS. When I uncomment it, the timings go out.Code:#CONFIG ifdef PM_USED device pic16F688, intrc_osc_noclkout, wdt_on, mclr_on, protect_off else __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_ON & _CPD_ON & _BOD_ON & _IESO_ON & _FCMEN_ON endif #ENDCONFIG DEFINE OSC 8 ' OSCCON defaults to 8MHz on reset DEFINE NO_CLRWDT 1 Include "modedefs.bas" ' declare the interrupt handler define INTHAND _ISR goto main ISR: asm ; my asm code endasm main: PAUSE 50 OSCCON = %01110001 ' Internal Oscillator 8MHz TRISA = %000100 TRISC = %000010 CMCON0 = 7 ANSEL = 0 ' NO ANALOGS OPTION_REG = %10000011 ' RAPU = off, PS 1:16 to TMR0 PORTA=0 PORTC=0 ' setup iZCD to interrupt on change ' INTCON= %10110000 ' | Global interrupts enabled ' | Timer0 interrupt enabled ' | Zero Crossing interrupt enabled ' ---- Flags are cleared while 1 toggle PortA.4 pause 500 wend
I want to run my PIC16F688 at internal 8MHz and not sure if I am missing any configuration register.




Bookmarks