Skip to content

Commit

Permalink
Adding theory of operation documentation section to main README.md.
Browse files Browse the repository at this point in the history
  • Loading branch information
simon committed Oct 7, 2019
1 parent e6807bc commit 1b3c750
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,24 @@ STM32F2 | | | X |
* ATtiny85 @ 8MHz : Adafruit Gemma, Arduino Gemma, Adafruit Trinket 3V

<!-- END COMPATIBILITY TABLE -->

### PCF8523 Timers
#### Timer Theory of Operation

A timer counts down from some value, with some frequency (see the enumeration Pcf8523FrequencyDivision) associated with its counting operation. A timer counts out the period PERIOD = TIMER_VALUE / TIMER_FREQUENCY from the time it is enabled. When disabled, a timer is cleared, rather than paused.

The PCF8523 has three timers. Countdown timers A and B count down to 0, and then start over counting from their original value. When a timer's value reaches 0, its flag is set. If its interrupt is enabled, timer A sets the INT1 pin, and timer B sets the INT1 and INT2 pins. These pins remain set until the interrupt flag is cleared, or until the interrupt is disabled.

Watchdog timer A counts down from some value, but does not begin counting again when zero is reached. The interrupt flag/enable facilities are the same. Unlike the countdown timers, the flag is automatically cleared on the next read of the flag and interrupt control register (control 2); reading the timer state, the interrupt state, or writing the interrupt state will accomplish this register-clearing read as a side-effect. Note that WDT A is a mode of timer A, and it cannot be run concurrently with countdown timer A.

The INT1 line is shared with the CLKOUT/square wave function. Only one function can be used, and enabling the interrupt output will disable the square wave generation function.

#### Wiring and Configuring the Interrupt Lines

The INT1 and INT2 pins are open collectors, and transition from high-impedance to low-impedance when an interrupt becomes active. When an INT pin is connected to a pulled-up GPIO pin, the GPIO pin's digital state will be low when the interrupt is active.

#### Notes on Pinouts and Form-factors

INT1 is available on Adafruit's feather and standalone boards for the pcf, as "INT" on the feather (https://www.adafruit.com/product/2922) and "SQW" on the standalone board (https://www.adafruit.com/product/3295).

INT2 is available only in the TSSOP14 form-factor of the pcf.

0 comments on commit 1b3c750

Please sign in to comment.