Wrong timing using internal Clock 16F88 & 12F683
Posted: Tue May 03, 2011 12:45 pm
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)
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
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)
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