Stopwatch does not measure time accurately

Hello,

I am having some problems with a stopwatch. It seems to measure half the time it should. One reading should be about 2.5-3ms and the other about 10-12ms

I think the problem is with my fuses and the selected clock.

With fuses set to an external crystal (CKSEL = 1111 SUT = 01) I get about half the time. 1.2ms and 5.6ms

With fuses set to an internal oscillator (CKSEL = 0010 SUT = 10) I get about one forth of the time. That's about 0.6ms for the first reading.

If I enable CKDIV8 the Arduino moves so slow it is impossible to use.

I use an Arduino Pro mini 5V 16Mhz.

What am I doing wrong? Any help would be appreciated.

Reburn the bootloader, select Uno as the board type. Then Uno as the board type going forward.
Fuses will be reset to 16 MHz, external ocscillator. I burn all my 328's as Uno. Keeps like simpler.

Thank you for the reply but it did not work.

This is my UNO from boards.txt

uno.name=Arduino Uno
uno.upload.protocol=arduino
uno.upload.maximum_size=32256
uno.upload.speed=115200
uno.bootloader.low_fuses=0xff
uno.bootloader.high_fuses=0xde
uno.bootloader.extended_fuses=0x05
uno.bootloader.path=optiboot
uno.bootloader.file=optiboot_atmega328.hex
uno.bootloader.unlock_bits=0x3F
uno.bootloader.lock_bits=0x0F
uno.build.mcu=atmega328p
uno.build.f_cpu=16000000L
uno.build.core=arduino
uno.build.variant=standard

What am I doing wrong?

You have failed to properly post the code.

Hi,
Have you tried code with a NON MODIFIED 328?
That is written code for a stopwatch with a bog standard 328 as CrossRoads has suggested and PLEASE,

Can you please post a copy of your sketch, using code tags?
They are made with the </> icon in the reply Menu.
See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

Unless you post your code, we have no idea how you are configuring timers etc....

What resolution and range do you need with your stopwatch?

Thanks... Tom... :slight_smile: