PDA

View Full Version : #config...#endconfig



ptig185
- 1st September 2012, 13:29
Hi,

I'm just starting up with pbp3 after using pbp 2.xx for a long time now.
I'm trying the configuration settings in my code so I don't have to set or correct them in the melabs usb programmer form.

I keep getting errors using this as a test:

Define OSC 20 ' when using HS Oscillator

#CONFIG
__config _XT_OSC & _WDT_OFF ' & _LVP_OFF & _CP_OFF
#ENDCONFIG

the errors I get are:

illegal argument (expected single character)
Missing operator
Argument out of range (not a valid config register address)
Symbol not previously defined (_XT_OSC)
symbol not previously defined (_WDT_OFF)


do I have to define the processor in my code or something?



thanks,

Brian

mackrackit
- 1st September 2012, 14:51
Got to
C:\PBP3\DEVICE_REFERENCE
and find the file for you chip.

But the (') in your config statement might be causing some of you trouble.

ptig185
- 1st September 2012, 15:36
thanks,
that helps a lot seeing where they are located as a reference
but...
CONFIG WDTE = OFF
still gives "CONFIG directive Error: (setting "WDTE in the supplied MicroCode IDE.

both ON and OFF give the same error for my 18f6722 chip.

mackrackit
- 1st September 2012, 15:43
Try this
#CONFIG
__CONFIG _CONFIG1H, _OSC_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _BBSIZ_BB2K_4L & _XINST_OFF_4L

#ENDCONFIG

ptig185
- 1st September 2012, 16:50
thanks,

Yes that compiles OK
I turned the WDT off though. don't know what the other options are....

where can I get the reference on these options? they don't look like the ones in the INFO file.
what is the CONFIG1H through CONFIG4L about. Is that something in the microchip files?

mackrackit
- 1st September 2012, 17:06
To get the complete or correct configuration information you need to look at the, for this chip, P18F6722.INC file. This is in
C:\Program Files\Microchip\MPASM Suite
Do not modify this file, the info is near the end.
The CONFIG1H through CONFIG4L is just different places the various bit are stored.

Demon
- 1st September 2012, 22:48
...I turned the WDT off though. don't know what the other options are....



I usually try to turn off as much stuff as possible. I figure they cost overhead that I could use for my own program instead.

Then I turn features on as I need them 'cause I often turn off too much stuff. :D

Robert


EDIT: Maybe this might shed some light on features:

http://www.picbasic.co.uk/forum/content.php?r=467-PICs-CONFIGS-and-Oscillator-Settings-for-Beginners

mackrackit
- 1st September 2012, 23:40
I usually try to turn off as much stuff as possible. I figure they cost overhead that I could use for my own program instead.

A config bit is either on or off, but it is still a bit.

Archangel
- 2nd September 2012, 18:21
thanks,

Yes that compiles OK
I turned the WDT off though. don't know what the other options are....

where can I get the reference on these options? they don't look like the ones in the INFO file.
what is the CONFIG1H through CONFIG4L about. Is that something in the microchip files?
http://ww1.microchip.com/downloads/en/DeviceDoc/39646c.pdf

Demon
- 3rd September 2012, 04:27
A config bit is either on or off, but it is still a bit.

I know, but don't features generate more code if they are active?

PWM, USB, etc.

Robert


EDIT: An example of unnecessary overhead:


ADON: ADC Enable bit
1 = ADC is enabled
0 = ADC is disabled and consumes no operating current

I rarely use ADC, apparently having it on for nothing would consume current needlessly (probably very little, but still).

mackrackit
- 3rd September 2012, 19:14
The ADC is not in the configs as this thread was about.

But you you are correct about some of the "features".

Ioannis
- 6th September 2012, 09:53
Long time ago there was the idea of having an "auto" configurator maybe through graphic environment, for the chip that the user uses and some of the good folks here were trying to figure out how to do this.

I suppose that it was a bit of a headache and the project quietly was abandoned.

Maybe it is time to start it over again.

Ioannis

c_moore
- 6th September 2012, 10:48
Is the IDE able to use plug-ins? maybe a external program that you can call from the IDE that will parse the device info file and list the available fuses?

Acetronics2
- 6th September 2012, 16:53
http://www.picbasic.co.uk/forum/showthread.php?t=13663

no, no ... not on the head, please !!!

Alain

Ioannis
- 6th September 2012, 21:17
Hmm, that was the thread I was refering to. It seems that it was to ambitious project...

Ioannis

mackrackit
- 6th September 2012, 21:37
Maybe it is time to start it over again.

Ioannis

Does anyone have the time? I do not.

Ioannis
- 7th September 2012, 07:17
I am willing but lack the knowledge of PC programing.... :(

Ioannis