- Name:
-
tmr3setup
- Syntax:
-
TMR3SETUP config
Config - is a constant/variable that configures timer3.
Config is defined as (20X2, 28X2-5V, 28X2-3V, 40X2-3V, 40X2-5V):
| Bit7 |
Must be set (1) |
| Bit6 |
Must be clear (0) |
| Bit5-4 |
1:8 Prescale (11) |
| |
1:4 Prescale (10) |
| |
1:2 Prescale (01) |
| |
1:1 Prescale (00) |
| Bit3 |
Must be clear (0) |
| Bit2 |
Must be clear (0) |
| Bit1 |
Must be clear (0) |
| Bit0 |
Timer 3 Enable (1= on, 0 = off) |
Config is defined as (28X2, 40X2):
| Bit7 |
Must be clear (0) |
| Bit6 |
Must be clear (0) |
| Bit5-4 |
1:8 Prescale (11) |
| |
1:4 Prescale (10) |
| |
1:2 Prescale (01) |
| |
1:1 Prescale (00) |
| Bit3 |
Must be clear (0) |
| Bit2 |
Must be clear (0) |
| Bit1 |
Must be set (1) |
| Bit0 |
Timer 3 Enable (1= on, 0 = off) |
- Description:
-
Configure the internal timer3 on X2 parts.
The tmr3setup command configures the internal timer3 on X2 parts. This is a free running timer that can be used for user background timing purposes.
The internal timer counts, when enabled, at a rate of (1/resonator speed) * 4. This means, for instance, at 8MHz the internal timer increment occurs every 0.5us. This value can be optionally scaled by the prescale value (set via bits 5:4) , so with a 1: 8 prescale the increment will occur every 4us (8 x 0.5us).
The PICAXE word variable 'timer3' increments on every overflow of the internal timer, ie 65536 x the increment delay. So at 8MHz with 1:8 prescalar the timer3 value will increment every 262144us (262ms).