PDA

View Full Version : External clock



Firegod
- 16th March 2007, 21:43
It is my first time using an external oscillator. I am using an 18F4525. I have connected a ABRACON Half Size TTL/HCMOS Clock Oscillator PN/ACH-40-EK to the OSC1 pin (40.0 mHz). The oscillator outputs a saw tooth wave form from 1.8 volts to 3.1 volts.

The clock speed of the 18F4525 appears to be about 400 times too slow. Nothing I do changes to speed. I am also unable to get the Fosc/4 signal out of OSC2 when I configure OSC = EC.

The LED changes state approx every four seconds if I use the code:

DEFINE OSC 40
TRISA.1 = 0
ch1 var PORTA.1

loop:
HIGH ch1
PAUSE 100
LOW ch1
GOTO loop

I have edited my 18F4525.inc file located in my c:\pbp directory to the following:

NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F4525, r = dec, w = -311, f = inhx32
INCLUDE "P18F4525.INC" ; MPASM Header
CONFIG OSC = ECIO6 ; Ext Clock with I/O on RA6
CONFIG IESO = OFF ; Disable Internal External Osc. Switch Over
CONFIG PWRT = OFF ; Disable Power-up Timer:
CONFIG BOREN = OFF ; Disable brownout reset
CONFIG WDT = OFF ; Disable watch dog timer
CONFIG MCLRE = OFF ; MCLR pin disabled; RE3 input pin enabled
CONFIG PBADEN = OFF ;Port B A/D disabled
CONFIG LVP = OFF ;Low voltage ISCP disabled
CONFIG FCMEN = OFF ; Fail-Safe Clock Monitor disabled
NOLIST

endif
LIST
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 8


I have also tried:
OSCCON.0 = 0
OSCCON.1 = 0

Do I have the wrong part?
Is my configuration wrong?
Does the wave form from the oscillator need to cross zero?

Firegod
- 17th March 2007, 00:53
Got it working, it appears there was something wrong with the oscillator. The bottom of the wave is now < 1 volt.

Nevermind.