Log in

View Full Version : Pic18f252



Sphere
- 20th September 2005, 19:22
I needed more code space so I decided to use the pic18f252, the alterations to my hardware is not the problem but the configuration, if I was using a pic 16f876 I would normally add the line @ DEVICE XT_OSC, WDT_OFF, LVP_OFF, PROTECT_OFF, BOD_OFF, CPD_OFF, WRT_OFF to set the fuses, but the 18f252 according to my programmer requires 'configuration 1,2,3,4,5,6,7 ID value'. Does anyone know the code required to configure this chip.

Thanks Sphere...

Darrel Taylor
- 20th September 2005, 20:18
Melanie's got you covered.

Presetting Configuration Fuses (PIC Defines) into your Program http://www.picbasic.co.uk/forum/showthread.php?t=543
<br>

CocaColaKid
- 20th September 2005, 20:36
This is for the 452 but I think it should be pretty much the same thing.



@ __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HSPLL_OSC_1H
' Oscillator Switchover Disabled
' Oscillator Type HS PLL

@ __CONFIG _CONFIG2L, _BOR_ON_2L & _PWRT_ON_2L & _BORV_45_2L
' Brown-Out Reset Enabled
' Power-Up Timer Enabled
' Brown-Out Reset Voltage 4.5V

@ __CONFIG _CONFIG2H, _WDT_ON_2H
' Watch Dog Timer Enabled

@ __CONFIG _CONFIG4L, _STVR_ON_4L & _LVP_OFF_4L & _DEBUG_OFF_4L
' Stack Over/Underflow Reset Enabled
' Low Voltage ICSP Programming Disabled
' Background Debugger Disabled

Sphere
- 30th September 2005, 21:02
Sorry I didnt reply to this sooner but ive just got my hands on a 18f252, Im still having problems setting the oscilator type in the config. Im trying to set it for a 4mhz crystal. What do I have to add to the following line.

@ __CONFIG _CONFIG1H

Thanks for the replys so far Sphere...

Sphere
- 30th September 2005, 23:10
Sorted the problem out with the config, it was down to the default setting in pic basic pro inc files, just cleared the default settings and it now compiles without errors. Ive another issue, my program was wrote for a pic 16f876, it runs perfect. But when loaded on to an 18f252 it runs initially but then it will either reset or just lockup the program. I assume it down to the extra features in the 18f252 which need turning off. If possible can someone post the options for turning these features on and off.


Thanks Sphere...