# stopwatch

Stopwatch library

Author | Matthew Schinkel - borntechi.com, copyright © 2009..2023, all rights reserved.
Adapted-by | Rob Jansen
Compiler | 2.5r8

Description

    Creates a stopwatch for timing events

Notes

    You do not need to define any constants in your program. Stopwatch will
    choose these default values for you.

Dependencies

No dependency found

## Summary

### Global variables/contants

- `var byte*4 stopwatch_high_value at _stopwatch_counter + 2`
- `const _stopwatch_count_size = 6`
- `var byte stopwatch_counter[_stopwatch_count_size] at _stopwatch_counter`
- `var word _stopwatch_step_time`
- `var byte*_stopwatch_count_size _stopwatch_counter`

### Procedures

- `stopwatch_isr()`
- `stopwatch_start()`
- `stopwatch_continue()`
- `stopwatch_init()`
- `stopwatch_stop()`

### Functions

- `stopwatch_cycles'get() return byte*STOPWATCH_VAR_SIZE`
- `stopwatch_read_cycles() return byte*STOPWATCH_VAR_SIZE`
- `stopwatch_read_time() return byte*STOPWATCH_VAR_SIZE`
- `stopwatch_time_overflow'get() return bit`
- `stopwatch'get() return byte*STOPWATCH_VAR_SIZE`
- `stopwatch_cycle_overflow'get() return bit`

## API details

### Global variables/contants

- `var byte*4 stopwatch_high_value at _stopwatch_counter + 2`

  No documentation found

- `const _stopwatch_count_size = 6`

      size of stopwatch counter

- `var byte stopwatch_counter[_stopwatch_count_size] at _stopwatch_counter`

  No documentation found

- `var word _stopwatch_step_time`

      time of one timer step

- `var byte*_stopwatch_count_size _stopwatch_counter`

      define the stopwatch counter

### Procedures

- `stopwatch_isr()`

      interrupt to increment stopwatch if hardware timer > 65535

- `stopwatch_start()`

      start the stopwatch at time = 0

- `stopwatch_continue()`

      continue running the stopwatch at it's current value.

- `stopwatch_init()`

      initialize the stopwatch

- `stopwatch_stop()`

      stop the stopwatch

### Functions

- `stopwatch_cycles'get() return byte*STOPWATCH_VAR_SIZE`

      read the stopwatch cycles (pseudo variable).
      returns number of instructions cycles run.

- `stopwatch_read_cycles() return byte*STOPWATCH_VAR_SIZE`

      read the stopwatch. returns number of instructions cycles run.

- `stopwatch_read_time() return byte*STOPWATCH_VAR_SIZE`

      read the stopwatch as time, reutrns value in "STOPWATCH_MIN_VALUE"

- `stopwatch_time_overflow'get() return bit`

      check if stopwatch time counter has overflowed.

- `stopwatch'get() return byte*STOPWATCH_VAR_SIZE`

      read the stopwatch (pseudo variable).
      returns approximate time in "STOPWATCH_MIN_VALUE".

- `stopwatch_cycle_overflow'get() return bit`

      check stopwatch instruction cycle count overflowed.

## Related samples

Here are the list of samples which use this library:

16f15325 | 16f15325_stopwatch.jal
16f648a | 16f648a_stopwatch.jal
16f723 | 16f723_stopwatch.jal
16f73 | 16f73_stopwatch.jal
16f877 | 16f877_stopwatch.jal
16f877a | 16f877a_stopwatch.jal
16f88 | 16f88_stopwatch.jal
18f14k50 | 18f14k50_stopwatch.jal
18f2450 | 18f2450_stopwatch.jal
18f2520 | 18f2520_stopwatch.jal
18f2550 | 18f2550_stopwatch.jal
18f2620 | 18f2620_stopwatch.jal
18f452 | 18f452_stopwatch.jal
18f4550 | 18f4550_stopwatch.jal
18f4620 | 18f4620_stopwatch.jal
18f67j50 | 18f67j50_sd_card_crc.jal
18f67j50 | 18f67j50_memory_pointer.jal
18f67j50 | 18f67j50_stopwatch.jal