PDA

View Full Version : 18F252 config



mpardinho
- 15th July 2008, 21:07
i need change my config because 18F2520 finish in my city....then i but 18F252 and
i have problem with config

code/pic work with 8 mhz internal oscilator with pll = 32mhz

Code work 100%


asm
__CONFIG _CONFIG1H, _OSC_INTIO7_1H & _IESO_OFF_1H
__CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_512_2H
__CONFIG _CONFIG3H, _PBADEN_OFF_3H
__CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
__CONFIG _CONFIG5L, _CP0_ON_5L & _CP1_ON_5L & _CP2_ON_5L & _CP3_ON_5L
__CONFIG _CONFIG5H, _CPB_ON_5H
endasm

DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h
DEFINE HSER_BAUD 9600
DEFINE HSER_CLROERR 1

'-------------------------------------------------------------------------------
Led var PORTC.4

'-------------------------------------------------------------------------------

I Var WORD
J Var BYTE

'-------------------------------------------------------------------------------
Boot:

DEFINE OSC 32

OSCCON = %11110000 ' 8 Mhz, internal osc
OSCTUNE = %11000000 ' 4x PLL enabled

CMCON = 7
ADCON1 = 15 ' Port A digital
INTCON2.7 = 0 ' Ativa Pull-Ups

LATA = 0
LATB = 0

PORTA = 0
TRISA = %00000000

PORTB = 0
TRISB = %10101110

PORTC = 0
TRISC = %10000000

Led = 1
pause 2000

hSEROUT ["-"]
PAUSE 1
hSEROUT ["START", 13, 10]
pause 1

Led = 0

i = 0
Loop:
Hserout[65 + I, 13]
Goto Loop


i try....not work


asm
***
i try .....
.. __CONFIG _CONFIG1H, _HS_OSC_1H
.. __CONFIG _CONFIG1H, _HSPLL_OSC_1H
.. __CONFIG _CONFIG1H, _RC_OSC_1H
.. __CONFIG _CONFIG1H, _OSCS_ON_1H & _RC_OSC_1H
.. __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HS_OSC_1H
.. __CONFIG _CONFIG1H, _RCIO_OSC_1H
***

__CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_128_2H
__CONFIG _CONFIG4L, _LVP_OFF_4L
__CONFIG _CONFIG5L, _CP0_ON_5L & _CP1_ON_5L & _CP2_ON_5L & _CP3_ON_5L
__CONFIG _CONFIG5H, _CPB_ON_5H
endasm

DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h
DEFINE HSER_BAUD 9600
DEFINE HSER_CLROERR 1

'-------------------------------------------------------------------------------
Led var PORTC.4

'-------------------------------------------------------------------------------

I Var WORD
J Var BYTE

'-------------------------------------------------------------------------------
Boot:

DEFINE OSC 32

OSCCON = %11110000 ' 8 Mhz, internal osc
'-- disable in 252 OSCTUNE = %11000000 ' 4x PLL enabled

'-- disable in 252 CMCON = 7
ADCON1 = 15 ' Port A digital
INTCON2.7 = 0 ' Ativa Pull-Ups

LATA = 0
LATB = 0

PORTA = 0
TRISA = %00000000

PORTB = 0
TRISB = %10101110

PORTC = 0
TRISC = %10000000

Led = 1
pause 2000

hSEROUT ["-"]
PAUSE 1
hSEROUT ["START", 13, 10]
pause 1

Led = 0

i = 0
Loop:
Hserout[65 + I, 13]
Goto Loop

skimask
- 15th July 2008, 21:16
All possible/relevant CONFIG fuses options are listed at the end of the MPASM .INC files for your particular PIC. Those should help you figure out which ones you need and which ones are incorrect (whether it be spelling, options that are/aren't present, etc).
And exactly what is your question? Having trouble decoding the English...
What isn't working right? What error messages?

mpardinho
- 15th July 2008, 22:39
The real problem is i need that my 18f252 work with internal oscilator and 32mhz,
in pic18d2520 i use config above and work 100%

asm
__CONFIG _CONFIG1H, _OSC_INTIO7_1H & _IESO_OFF_1H
...

and

DEFINE OSC 32

OSCCON = %11110000 ' 8 Mhz, internal osc
OSCTUNE = %11000000 ' 4x PLL enabled

i need help for corret config in 18F252

Charles Linquis
- 16th July 2008, 01:37
This should give you an idea -

http://www.picbasic.co.uk/forum/archive/index.php/t-2135.html

Bruce
- 16th July 2008, 13:42
This is cut & paste directly from the 18F252 data sheet:

2.1 Oscillator Types

The PIC18FXX2 can be operated in eight different Oscillator modes. The user can program
three configuration bits (FOSC2, FOSC1, and FOSC0) to select one of these eight modes:

1. LP Low Power Crystal
2. XT Crystal/Resonator
3. HS High Speed Crystal/Resonator
4. HS + PLL High Speed Crystal/Resonator with PLL enabled
5. RC External Resistor/Capacitor
6. RCIO External Resistor/Capacitor with I/O pin enabled
7. EC External Clock
8. ECIO External Clock with I/O pin enabled

Note there is no internal oscillator option for the 252. Oops...;o}

mpardinho
- 16th July 2008, 20:19
thaks all for help.......realy 452 not have internal oscilator.......vendor sad 252 = 2520
arggggggggg.....i'm a donkey....i not read pdf