Mel,

I've the reverse problem. Couple of questions if you don't mind:

I want to toggle the LED once a second running at a clock freq of 31.25kHz is this possible?

If I set the OSCCON to a freq of 2MHz (or lower), and I set DEFINE OSC 2 (or lower), my code wont compile?

Do you need to DEFINE OSC "speed" when using OSCCON? It seems that I do, eg the toggling LED seems to double in speed if I don't DEFINE the oscillator speed.

Heres my code.


' FLICK LED ON/OFF EVERY SECOND

' =============
' PRESET FUSES
' =============
@ DEVICE pic16F88, INTRC_OSC
@ DEVICE pic16F88, WDT_ON
@ DEVICE pic16F88, BOD_ON
@ DEVICE pic16F88, PROTECT_ON
@ DEVICE pic16F88, MCLR_ON
@ DEVICE pic16F88, WDT_ON
@ DEVICE pic16F88, CPD_OFF
@ DEVICE pic16F88, LVP_OFF
@ DEVICE pic16F88, CCPMX_OFF
@ DEVICE pic16F88, DEBUG_OFF
@ DEVICE pic16F88, PWRT_ON

' 000 = 31.25 kHz
' 001 = 125 kHz
' 010 = 250 kHz
' 011 = 500 kHz
' 100 = 1 MHz
' 101 = 2 MHz
' 110 = 4 MHz
' 111 = 8 MHz

OSCCON = %01010010 ' 2MHz
'DEFINE OSC 2 ' this line causes problems
LED1 var PortB.0
TRISB=%11111110

LOOP:
TOGGLE LED1
PAUSE 1000
WHILE OSCCON.2=0: WEND

GOTO LOOP


<b>My ultimate goal is to have a slow HPWM (around 1.7kHz) running at a slow clock speed.</b> Is this the right way to do it?
--------
Cheers
Squib