osc setting not working

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
hackinblack
Posts: 26
Joined: Mon Apr 17, 2017 9:55 pm
Has thanked: 2 times
Been thanked: 14 times
Contact:

osc setting not working

Post by hackinblack »

i am trying to get the OSCCON correctly set on a PIC 12F1572
but the 'project > options' selection i choose simply doesn't seem to work; the timings are way out.
I read a post about another user having trouble with PWM clock speeds on the same chip, and it mentions an osc helper utility...
just Where in V7 is it? i don't have a 'tools' menu at all!

edit scratch that; i found it, but not where it said...!
but despite pasting the C block code before the 'main' loop with the config hex, it still won't configure properly; in simulation it flies round so fast the LED that should blink at 1hz doesn't go out!
Attachments
1s_blinky.fcfx
(9.19 KiB) Downloaded 212 times

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: osc setting not working

Post by Benj »

Hello,

In your loop you only have a delay for when the LED is on.

So your essentially doing this.

LED On
Delay 1 s
LED Off
LED On
...

If you add a second delay after switching the LED off then it should hopefully work as expected.

hackinblack
Posts: 26
Joined: Mon Apr 17, 2017 9:55 pm
Has thanked: 2 times
Been thanked: 14 times
Contact:

Re: osc setting not working

Post by hackinblack »

strange; i still don't know if the C block is even required..the information available isn't clear on this point.
i also spelt 'OSCCON' as 'OSCON'...XC-8 picked that one up :oops: i added the closing delay i missed out and it works!
So exactly when IS a C-block setup required? i realise these newer enhanced/baseline concoctions are slightly odd in general; but they are the nearest modern equivalent of the good old 12F675 (This was confirmed by a comment from one of microchip's PIC developement team...at least i got that bit correct!) whether i am able to fathom the intricacies of microchip's datasheets for these newer PIC's is another matter;as there are days i could swap my head for a turnip and not notice the difference. :?

The code it was intended for is this project
TMR0dual.fcfx
Timer0 useage PIC 12F1572
(10.74 KiB) Downloaded 234 times
Which blinks 2 LEDs...1 at a rate set by delay-nS in software,and another run independently 'in the background' by the hardware (namely Timer0 overflows)
Simply a trial to acheive accurate I/O delay control,independent of any firmware running.
It now functions as it was intended to; a good place to start from!

thanks for the help

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: osc setting not working

Post by Benj »

Hello,

The C code icon is only required when using the INTOSC oscillator type in the configuration options and using a none default clock speed.

For the 12F1572 the default INTOSC clock speed is 500KHz.

hackinblack
Posts: 26
Joined: Mon Apr 17, 2017 9:55 pm
Has thanked: 2 times
Been thanked: 14 times
Contact:

Re: osc setting not working

Post by hackinblack »

Thanks for that; i also found this, which clears up my confusion
viewtopic.php?f=68&t=19308
I had forgotten that OSCCON, though it is a 'configuration' ISN'T actually part of the CONFIG register... :oops:

Post Reply