# stopwatch2

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

- `const _STOPWATCH2_COUNT_SIZE = 6`
- `var byte stopwatch2_counter[_STOPWATCH2_COUNT_SIZE] at _stopwatch2_counter`
- `var byte*_STOPWATCH2_COUNT_SIZE _stopwatch2_counter`
- `var word _stopwatch2_step_time`
- `var byte*4 stopwatch2_high_value at _stopwatch2_counter + 2`

### Procedures

- `stopwatch2_init()`
- `stopwatch2_continue()`
- `stopwatch2_stop()`
- `stopwatch2_start()`
- `stopwatch2_isr()`

### Functions

- `stopwatch2'get() return byte*STOPWATCH2_VAR_SIZE`
- `stopwatch2_cycle_overflow'get() return bit`
- `stopwatch2_read_time() return byte*STOPWATCH2_VAR_SIZE`
- `stopwatch2_time_overflow'get() return bit`
- `stopwatch2_read_cycles() return byte*STOPWATCH2_VAR_SIZE`
- `stopwatch2_cycles'get() return byte*STOPWATCH2_VAR_SIZE`

## API details

### Global variables/contants

- `const _STOPWATCH2_COUNT_SIZE = 6`

      size of stopwatch2 counter

- `var byte stopwatch2_counter[_STOPWATCH2_COUNT_SIZE] at _stopwatch2_counter`

  No documentation found

- `var byte*_STOPWATCH2_COUNT_SIZE _stopwatch2_counter`

      define the stopwatch2 counter

- `var word _stopwatch2_step_time`

      time of one timer step

- `var byte*4 stopwatch2_high_value at _stopwatch2_counter + 2`

  No documentation found

### Procedures

- `stopwatch2_init()`

      initialize the stopwatch2

- `stopwatch2_continue()`

      continue running the stopwatch2 at it's current value.

- `stopwatch2_stop()`

      stop the stopwatch2

- `stopwatch2_start()`

      start the stopwatch2 at time = 0

- `stopwatch2_isr()`

      interrupt to increment stopwatch2 if hardware timer > 65535

### Functions

- `stopwatch2'get() return byte*STOPWATCH2_VAR_SIZE`

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

- `stopwatch2_cycle_overflow'get() return bit`

      check stopwatch2 instruction cycle count overflowed.

- `stopwatch2_read_time() return byte*STOPWATCH2_VAR_SIZE`

      read the stopwatch2 as time, reutrns value in "STOPWATCH2_MIN_VALUE"

- `stopwatch2_time_overflow'get() return bit`

      check if stopwatch2 time counter has overflowed.

- `stopwatch2_read_cycles() return byte*STOPWATCH2_VAR_SIZE`

      read the stopwatch2. returns number of instructions cycles run.

- `stopwatch2_cycles'get() return byte*STOPWATCH2_VAR_SIZE`

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

## Related samples

Here are the list of samples which use this library:

16f15325 | 16f15325_stopwatch2.jal