unable to set config bits

An area to discuss 8-bit PIC specific problems and examples

Moderator: Benj

Post Reply
JFinlayson
Posts: 93
Joined: Mon Sep 23, 2013 4:33 pm
Has thanked: 5 times
Been thanked: 6 times
Contact:

unable to set config bits

Post by JFinlayson »

Hi I have write config on download flag set in Project options dialog, configure. But unable to change internal oscillator speed or no matter what oscillator I set pic 8 keeps running at 1Mhz. So looks like I am unable to set configuration bits.
I am using latest version of Flowcode 7 and latest version of Microchip XC8 V1.4 compiler. Is there any other way to send configuration to chip?
The older the boy the bigger the toy

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: unable to set config bits

Post by QMESAR »

Hi
Are you setting the OSCON Register with the flowcode Oscillator Helper or you have to do it with a C code component
if you can post a minimum project then we could help you
Attachments
1.jpg
1.jpg (66.36 KiB) Viewed 4708 times

JFinlayson
Posts: 93
Joined: Mon Sep 23, 2013 4:33 pm
Has thanked: 5 times
Been thanked: 6 times
Contact:

Re: unable to set config bits

Post by JFinlayson »

I set the oscillator speed in project options, general options as in program attached
RAT440.fcfx
(11.66 KiB) Downloaded 259 times
The older the boy the bigger the toy

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: unable to set config bits

Post by kersing »

The setting in project options just tells Flowcode what speed the oscillator is set to. It does not set the value on chip. To actually configure the oscillator on the chip you need to use a C code icon and set the PIC registers to the correct values.

The code to use the internal oscillator at 8 MHz for your device should be:

Code: Select all

OSCCON = 0b01110011;
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

JFinlayson
Posts: 93
Joined: Mon Sep 23, 2013 4:33 pm
Has thanked: 5 times
Been thanked: 6 times
Contact:

Re: unable to set config bits

Post by JFinlayson »

Ok Thanks is it just the oscillator speed setting that is not sent?
I presume the other config bits are programmed?
The older the boy the bigger the toy

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: unable to set config bits

Post by kersing »

Oscillator speed is not part of the configuration bits, it is a separate register. The configuration bits are programmed.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Post Reply