Setting CONFIG bits in a FC C

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
User avatar
Jay Dee
Posts: 398
Joined: Tue Aug 18, 2009 6:42 pm
Has thanked: 121 times
Been thanked: 154 times

Setting CONFIG bits in a FC C

Post by Jay Dee »

Hi,
I'm using a PICKIT 3 to program a chip, how do I set the required CONFIG bits? I do not see an option menu as I get with PPP. Do I need to create a C code block at the very start of my FC and list the required Config bits?

If so, what is the correct format to put this information in ? I guess I need to specify the config word and then the state of each function?

For example my info gives the following for config word 1 High and Low (for PIC18F25K80);
Could someone give me an example of how I would select each option? :?

CONFIG1L (address:0x300000, mask:0x5D)
RETEN -- VREG Sleep Enable bit
RETEN = ON 0xFE Ultra low-power regulator is Enabled (Controlled by SRETEN bit).
RETEN = OFF 0xFF Ultra low-power regulator is Disabled (Controlled by REGSLP bit).

INTOSCSEL -- LF-INTOSC Low-power Enable bit
INTOSCSEL = LOW 0xFB LF-INTOSC in Low-power mode during Sleep.
INTOSCSEL = HIGH 0xFF LF-INTOSC in High-power mode during Sleep.

SOSCSEL -- SOSC Power Selection and mode Configuration bits
SOSCSEL = LOW 0xEF Low Power SOSC circuit selected.
SOSCSEL = DIG 0xF7 Digital (SCLKI) mode.
SOSCSEL = HIGH 0xFF High Power SOSC circuit selected.

XINST -- Extended Instruction Set
XINST = OFF 0xBF Disabled.
XINST = ON 0xFF Enabled.

CONFIG1H (address:0x300001, mask:0x08)
FOSC -- Oscillator
FOSC = LP 0xF0 LP oscillator.
FOSC = XT 0xF1 XT oscillator.
FOSC = HS2 0xF2 HS oscillator (High power, 16 MHz - 25 MHz).
FOSC = HS1 0xF3 HS oscillator (Medium power, 4 MHz - 16 MHz).
FOSC = EC3IO 0xF4 EC oscillator, CLKOUT function on OSC2 (High power, 16 MHz - 64 MHz).
FOSC = EC3 0xF5 EC oscillator (High power, 16 MHz - 64 MHz).
FOSC = RC 0xF6 External RC oscillator, CLKOUT function on OSC2.
FOSC = RCIO 0xF7 External RC oscillator.
FOSC = INTIO2 0xF8 Internal RC oscillator.
FOSC = INTIO1 0xF9 Internal RC oscillator, CLKOUT function on OSC2.
FOSC = EC2IO 0xFA EC oscillator, CLKOUT function on OSC2 (Medium power, 160 kHz - 16 MHz).
FOSC = EC2 0xFB EC oscillator (Medium power, 160 kHz - 16 MHz).
FOSC = EC1IO 0xFC EC oscillator, CLKOUT function on OSC2 (Low power, DC - 160 kHz).
FOSC = EC1 0xFD EC oscillator (Low power, DC - 160 kHz).

PLLCFG -- PLL x4 Enable bit
PLLCFG = OFF 0xEF Disabled.
PLLCFG = ON 0xFF Enabled.

FCMEN -- Fail-Safe Clock Monitor
FCMEN = OFF 0xBF Disabled.
FCMEN = ON 0xFF Enabled.

IESO -- Internal External Oscillator Switch Over Mode
IESO = OFF 0x7F Disabled.
IESO = ON 0xFF Enabled.

Any help appreciated, :)
J.

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Setting CONFIG bits in a FC C

Post by medelec35 »

Hi Jay,
What I do when using pickit to directly program via Flowcode is to still have PPP to set configuration options.

In Compiler options, have ticked 'Use external program to set configuration options'
In location make sure path is set to ppp e.g
If 64bit win:
C:\Program Files (x86)\Flowcode\v5\Tools\PPP\PPPv3.exe
or 32 bit wim:
C:\Program Files\Flowcode\v5\Tools\PPP\PPPv3.exe

The programmer part is left as for Pickit 3


Martin
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Setting CONFIG bits in a FC C

Post by Benj »

For reference integrating PICkit 3 into Flowcode as the default programmer can be done as shown here.
http://www.matrixmultimedia.com/support ... f=68&t=786

Not sure if this will currently support your new .dat file Jay but worth a go. The .dat should be placed into the following directory though the exe file may also require an update to work correctly.

C:\Program Files (x86)\Flowcode\v5\Tools\PICkit3

User avatar
Jay Dee
Posts: 398
Joined: Tue Aug 18, 2009 6:42 pm
Has thanked: 121 times
Been thanked: 154 times

Re: Setting CONFIG bits in a FC C

Post by Jay Dee »

Thanks guys, thats cleared quite a bit up...however :D
when I go <Compiler Options> < Programmer>
The top two sections are greyed out and i cannot find a way to set the programmer location.
The tick box and lower two sections can be edited.
hmmm. :? any ideas how to un-grey the top boxes? I've twiddled lots of settings for the last 20 minutes but to no avail,
thanks, J.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Setting CONFIG bits in a FC C

Post by Benj »

Hello,

The top two programmer options are greyed out when your using a device with a fixed programming method eg the MIAC or ECIO devices.

I have checked and when the 18F25K80 device is selected as a target the top two boxes should be available for editing.

User avatar
Jay Dee
Posts: 398
Joined: Tue Aug 18, 2009 6:42 pm
Has thanked: 121 times
Been thanked: 154 times

Re: Setting CONFIG bits in a FC C

Post by Jay Dee »

DOH!! Yep thanks Ben, absolutely right. I was in another project and fiddling with the settings. busy time of year and rushing to much, starting to make some silly mistakes! Thanks for prompt response. :D
J.

Post Reply