View previous topic :: View next topic |
Author |
Message |
LDiracDelta
Joined: 24 Jun 2005 Posts: 1
|
PIC18F4580 -- Using INTOSC fuse |
Posted: Fri Jun 24, 2005 2:28 pm |
|
|
The Pic-C compiler seems to have problem using the PIC18F4580's internal oscillator with the following code:
#include <18f4580.h>
#device ADC=8
#fuses INTOSC,NOWDT,NOPROTECT,NOLVP
#use delay(clock=8000000)
#use rs232(baud=9600,parity = E, bits = 7, xmit=PIN_C1, rcv=PIN_C0)
What sort of cajolling does one have to do to get Pic-C to compile to use the built in internal Oscillator. I don't want to use the internal rc circuit (INTRC). |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jun 24, 2005 3:29 pm |
|
|
Can you post the Fuse options listed at the top of your 18F4580.H file ? |
|
|
mickey231bhq
Joined: 06 Apr 2005 Posts: 19 Location: Formosa
|
|
Posted: Fri Jun 24, 2005 10:57 pm |
|
|
Code: | ////////////////////////////////////////////////////////////////// INTERNAL RC
// Constants used in setup_oscillator() are:
// First param:
#define OSC_31KHZ 0
#define OSC_125KHZ 0x10
#define OSC_250KHZ 0x20
#define OSC_500KHZ 0x30
#define OSC_1MHZ 0x40
#define OSC_2MHZ 0x50
#define OSC_4MHZ 0x60
#define OSC_8MHZ 0x70
// The following may be OR'ed in with the above using |
#define OSC_TIMER1 1
#define OSC_INTRC 2
#define OSC_NORMAL 0
// A second optional parametter may be used with this part to fine
// tune the speed (signed int)
// Result may be (ignore all other bits)
#define OSC_STATE_STABLE 4
// Second param:
#define OSC_31250 0xC0
#define OSC_31KHZ 0
#define OSC_PLL_ON 0x40
#define OSC_PLL_OFF 0
// The tune value 0-31 may be OR'ed in with the above using | |
|
|
|
|