Trying to drive an LED with OSC2 out is probably not going to work, as it's not designed to
drive LEDs. It's a low-current clock output. You might get by with applying OSC2 out to the
base of a transistor, but I've never tried it.
And your multi-meter may not be fast enough to keep up with a 2MHz pulse out on OSC2.
An LED turned ON/OFF at 2MHz will most likely appear to be dimly lit all the time. 2MHz is
pretty quick.
Your comment for TIMER1 prescaler is wrong. You actually have the prescaler set to 1:4,
and your comment on the value of CCPR1 is wrong too. It should be 4096 VS 4069.
If you want to see the LEDs blink, you're going to need a lot more time between interrupts.
Try something like this;
Code:
@ DEVICE INTRC_OSC_CLKOUT, LVP_OFF, WDT_OFF, MCLR_OFF, BOD_OFF, CCPMX_ON, PWRT_ON
OSCCON = %00010000 ' 125kHz INTERNAL OSCILLATOR
ANSEL = %00000000 ' MAKE PortA PINS ALL DIGITAL
PORTB = 0 ' ALL CLEAR AT POR
TRISB = %00000000
LED VAR PortB.4
LED1 VAR PortB.3
T1CON = %00110001 ' ENABLE TIMER1, PRESCALE 1:8, INTERNAL CLK
PIE1 = %00000100 ' ENABLE CCP1 INT
CCP1CON = %00001011 ' COMPARE MODE, AUTO RESET TIMER1
CCPR1L = %00000000 ' SET CCP REGISTER TO 4096
CCPR1H = %00010000 ' 4096*8*32uS = 1.048 seconds toggle rate
INTCON = %11000000 ' ENABLE GLOBAL INT, ENABLE PERIPHERAL INT.
on interrupt goto ISP
Main:
@ nop
GOTO Main
DISABLE
ISP:
TOGGLE LED
TOGGLE LED1
PIR1.2 = 0
RESUME
ENABLE
Bookmarks