diff options
author | Damien George <damien.p.george@gmail.com> | 2015-02-23 22:14:54 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-02-23 22:14:54 +0000 |
commit | 1babb6d0c723fa08fcbf8e48a0eeee476a42cd39 (patch) | |
tree | ba72ec166e6b5474de65eada9b064ac894169d15 /docs/tutorial | |
parent | 5d323defe4dab940494002e80c69cfb36d204a49 (diff) | |
download | micropython-1babb6d0c723fa08fcbf8e48a0eeee476a42cd39.tar.gz micropython-1babb6d0c723fa08fcbf8e48a0eeee476a42cd39.zip |
docs: Update timer tutorial to reflect new behaviour of timer.
Diffstat (limited to 'docs/tutorial')
-rw-r--r-- | docs/tutorial/timer.rst | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/docs/tutorial/timer.rst b/docs/tutorial/timer.rst index 22cfc012e0..fee01e17b7 100644 --- a/docs/tutorial/timer.rst +++ b/docs/tutorial/timer.rst @@ -26,12 +26,14 @@ it's not yet initialised. So let's initialise it to trigger at 10 Hz Now that it's initialised, we can see some information about the timer:: >>> tim - Timer(4, prescaler=255, period=32811, mode=0, div=0) + Timer(4, prescaler=624, period=13439, mode=UP, div=1) The information means that this timer is set to run at the peripheral -clock speed divided by 255, and it will count up to 32811, at which point -it triggers an interrupt, and then starts counting again from 0. These -numbers are set to make the timer trigger at 10 Hz. +clock speed divided by 624+1, and it will count from 0 up to 13439, at which +point it triggers an interrupt, and then starts counting again from 0. These +numbers are set to make the timer trigger at 10 Hz: the source frequency +of the timer is 84MHz (found by running ``tim.source_freq()``) so we +get 84MHz / 625 / 13440 = 10Hz. Timer counter ------------- |