PDA

View Full Version : How to read / understand the config file P16fxxx.inc



jmj882
- 12th January 2010, 06:08
After using a time PM as the assembler of PBP I switched over to mpasmwin, but now I get errors direct in the first line of my programm.
I use the pic 16F882.
I looked in the P16F88x.inc file to see how to setup the configword(s) in my programm.
@ __CONFIG _HS_OSC
was the first I tried and te result was an error [126].
The question is what do I forget when using this processor??
Thanks in advance.

mackrackit
- 12th January 2010, 09:50
Welcome to the forum.

If you have not read this it will be good that you do.
http://www.picbasic.co.uk/forum/showthread.php?t=543

Now, make sure that the correct lines are commented in the PICs *.inc file, then the fuse line in your code using MPASM should look something like this.


@ __config _CONFIG1, _HS_OSC & _WDT_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF

Use the line you commented for a template.

jmj882
- 12th January 2010, 12:47
Thank you very much.
I will try is this evening.
And I will read the whole topic about this.
Regards,
JMJ882

jmj882
- 14th January 2010, 05:57
Hallo I am back again.
I have read the article for many times. I read the content of P16F882.inc. I tried almost every posibility I can guess, but still I got the error message.
Is there somebody here who got the part of
@ __config etc.
working for the 16F882, 16F883, 16F884, 16F886 or 16F887 working without the error message?
When I take this for an 18F452 then it's working, but for this part it is'nt.
Could there be a problem in the P16F88x.inc file or may be in the mpasm program, or maybe in me??

Archangel
- 14th January 2010, 07:05
Hallo I am back again.
I have read the article for many times. I read the content of P16F882.inc. I tried almost every posibility I can guess, but still I got the error message.
Is there somebody here who got the part of
@ __config etc.
working for the 16F882, 16F883, 16F884, 16F886 or 16F887 working without the error message?
When I take this for an 18F452 then it's working, but for this part it is'nt.
Could there be a problem in the P16F88x.inc file or may be in the mpasm program, or maybe in me??Hello jmj882,
The files you are referring to are MPASM files, where you can go and look to see which registers you have available. <b>This is not the place to change the configs.</b> look in your PBP root directory, and find the 16F882.inc, 16F883.inc . . . it is in these files where you add a semicolon ahead of the config, so the compiler will skip it.

jellis00
- 14th January 2010, 07:12
jmj882, I don't have the settings for the 16Fxxx MCUs you mention, but here is what I use for the 16F690. These should be very close to the CONFIGs for your listed chips. Notice the IF..ELSE structure of this assembly code that you can paste into a .pbp program will work with either the PM or MPASM assemblers.


' -----[ Device Declaration ]---------------------------------------------
ASM ; 16F690
ifdef PM_USED ; For PM assembler
device INTRC_OSC_NOCLKOUT ; Oscillator Selection
device FCMEN_OFF ; Fail-Safe Clock Monitor
device IESO_OFF ; Internal External Switchover
device BOD_OFF ; Brown-out Detect
; device BOR_SBODEN ; SBODEN Brown-out setting
device CPD_OFF ; Data Code Protection
device PROTECT_OFF ; Code Protection
device MCLR_OFF ; Master Clear Reset
device PWRT_OFF ; Power-up Timer
device WDT_OFF ; Watchdog Timer

else ; For MPASM assembler
cfg= _INTRC_OSC_NOCLKOUT ; Oscillator Selection
cfg=cfg& _FCMEN_OFF ; Fail-Safe Clock Monitor
cfg=cfg& _IESO_OFF ; Internal External Switchover
cfg=cfg& _BOR_OFF ; Brown-out Reset
cfg=cfg& _CPD_OFF ; Data Code Protection
cfg=cfg& _CP_OFF ; Code Protection
cfg=cfg& _MCLRE_OFF ; Master Clear Reset
cfg=cfg& _PWRTE_OFF ; Power-up Timer
cfg=cfg& _WDT_OFF ; Watchdog Timer
__CONFIG cfg
endif
ENDASM

jmj882
- 14th January 2010, 19:53
Thank you Joe S. , jellis00 and mackrackit
That was the problem. Now I also understood what I missed and didn't understood.
Regards,
jmj882