Wrong timing using internal Clock 16F88 & 12F683

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
GerhardB
Posts: 5
Joined: Mon Apr 25, 2011 10:54 pm
Location: Friedrichshafen (D)
Has thanked: 3 times

Wrong timing using internal Clock 16F88 & 12F683

Post by GerhardB »

Hi,

in a test programm a port pin should toggle
100ms on / 100ms off, but when I measure the port pin signal,
I get wrong pulse timings (see below). (internal clock OSCCON=0x60 => 4MHz)
PIC16F88_Test01.fcf
(4.5 KiB) Downloaded 255 times
here in use:
FlowCode for PIC 4.3.7.63 Prof.
Multiprogrammer EB-006-00-7


used settings:
Project options:
watchdog: off
Chip settings (PIC16F88 or PIC12F683):
Oscillator Selection: INTRC as Clock Out to measure the uC clock/4
all other options: off or disable

Here are the different test settings and test results:

FlowCode FlowCode
project OSCCON OSC2 set pulse pulse width
clock set out width measured

8000000 0x60 1MHz 100ms 288.0ms
4000000 0x60 1MHz 100ms 235.4ms
2000000 0x60 1MHz 100ms 213.0ms
1000000 0x60 1MHz 100ms 190.4ms
500000 0x60 1MHz 100ms 190.4ms

4000000 0x70 2MHz 100ms 117.0ms
4000000 0x60 1MHz 100ms 235.4ms
4000000 0x50 500kHz 100ms 471.2ms
4000000 0x40 250kHz 100ms 943.2ms
4000000 0x30 125kHz 100ms 1887.0ms

With both PIC12F683 or PIC16F88 I can reproduce it.

When I vary the "OSCCON" setting, the pulse widths are not correct,
but they are changing proportinal at least.

When I vary the "FlowCode project clock", the pulse widths are also wrong but changes
in a strange way.


But where is the bug?
How can I get the correct pulse widths?

Thanks for any help!

p.s.: using a 19.6608MHz crystal the pulse width is 96.8ms

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: Wrong timing using internal Clock 16F88 & 12F683

Post by medelec35 »

GerhardB wrote:But where is the bug?
How can I get the correct pulse widths?

Thanks for any help!
Hi GerhardB,
The problem is caused by 'Auto Clear Watchdog' (in 'View', 'Project options') enabled.
When enabled, extra clear watchdog commands are accessed to stop Watchdog time out occurring.
If you untick the option, then you will find each delay will be reduced to 100ms.

Martin

Edit just remembered about a couple of threads.
See:
http://www.matrixmultimedia.com/mmforum ... 495#p14393
and
http://www.matrixmultimedia.com/mmforum ... =30&t=6702
Martin

GerhardB
Posts: 5
Joined: Mon Apr 25, 2011 10:54 pm
Location: Friedrichshafen (D)
Has thanked: 3 times

Re: Wrong timing using internal Clock 16F88 & 12F683

Post by GerhardB »

Hi Martin,

thanks a lot, it solved the problem.

Gerhard

p.s.: I could'nt find threats to this problem, I think I used the wrong search terms.

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: Wrong timing using internal Clock 16F88 & 12F683

Post by medelec35 »

Hi Gerhard,
Your welcome.

Np about the links. I roughly knew what to search for as I have contributed on the threads.
You did not have that advantage.

I don't always find what I'm searching for either :P
Martin
Martin

Post Reply