PDA

View Full Version : 18F4520 Configs



ruijc
- 10th June 2010, 12:32
Hi all,

i've just read retepsnikrep' post about the 16F886 config and i have a similar question:

Can anyone show me an example of the configs using MPASM for the 18F4520 ?

I have tryed many different options but ended up with errors compiling.

Thanks

mackrackit
- 10th June 2010, 14:04
What are the parameters?
In the meantime goto
program files-microchip-mpasm suite
there you will find an inc file for the chip. At the end of the file all of the config options are listed.

ruijc
- 10th June 2010, 15:36
Greetings mackrackit,

I've looked in the folder you mentioned and the file is called P18F45K20.INC.

I've looked inside the file and found the OSC ( _FOSC_HS_1H EQU H'F2' ; HS oscillator ) and MCLR ( _MCLRE_OFF_3H EQU H'7F' ; RE3 input pin enabled; MCLR disabled ) lines.

However, i'm trying to place these into the code but i'm not being able to succeed.

Tryed stuff like :

@ __CONFIG _CONFIG1, _FOSC_HS_1H
@ __CONFIG _CONFIG3H, _MCLRE_ON_3H

but dont work

ScaleRobotics
- 10th June 2010, 16:23
but dont work

Hmm, not too much to go on here, but..

Have you read the wiki here:
http://www.picbasic.co.uk/forum/content.php?r=157-Presetting-Configuration-Fuses-%28PIC-Defines%29-into-your-Program ? Especially the end where it says don't forget.....

ruijc
- 10th June 2010, 16:43
Thanks scalerobotics,

Got it working,

just a quick question:

The lines remarked in PBP's Inc file are default settings ? This means if i dont add the config lines in the code PBP will set these fuses by it self ( and by remarking them there will be no default settings ).

Is this correct ?

Thanks

ScaleRobotics
- 10th June 2010, 17:07
The lines remarked in PBP's Inc file are default settings ? This means if i dont add the config lines in the code PBP will set these fuses by it self ( and by remarking them there will be no default settings ).

Is this correct ?

Yes, you've got it. You can either edit it in PBP's inc files, and change it chip by chip. Or you can remark them out of PBP's inc files, and put them in your code for each project. They are the default settings. I usually copy them into my project, remark them out of PBP's inc file, and use them as a starting point.

Glad you've got it working.

Walter

ruijc
- 10th June 2010, 17:23
I agree with you and that's how i'll do

Thanks Walter

My best regards
Rui

latitjuig
- 10th June 2010, 19:53
Hi everybody. I got a pickit3 with a p18f45k20 chip. I would like to program in C. I would like to control a dc motor by pressing the button on the demo board or by connecting two switches, on for forward motion and one for reverse. can ANYBODY please help me with an example and please tell me what compiler i need to download etc. ive got mplab.
Or if it is easier to control a servo motor a example will be appriciated aswell. thanks

Bruce
- 10th June 2010, 22:18
I would like to program in C
Your best bet for finding help would be on the forum for the C compiler you're using. Not on one for a BASIC compiler...:eek: