OpenTimerx

Configure the selected timer.

Function Processor
OpenTimer0 All supported processors that have Timer 0
OpenTimer1 All supported processors that have Timer 1
OpenTimer2 All supported processors that have Timer 2
OpenTimer3 18F1220  18F1320
OpenTimer3 18C601  18C801  18F2220  18F2320  18F2420  18F4320  18F2221  18F2321  18F4221  18F4321  18F2410  18F2510  18F2515  18F2610  18F4410  18F4510  18F4515  18F4610  18F2423  18F2523  18F4423  18F4523  18F2455  18F2550  18F4455  18F4550  18F2480  18F2580  18F4480  18F4580  18F2420  18F2520  18F4420  18F4520  18F2525  18F2620  18F4525  18F4620  18F2682  18F2685  18F4682  18F4685  18F6390  18F6490  18F8390  18F8490  18F6585  18F8585  18F6680  18F8680
OpenTimer3 PIC18F6520  PIC18F8520  PIC18F6620  PIC18F8620  PIC18F6720  PIC18F8720  PIC18F6527  PIC18F6622  PIC18F6627  PIC18F6722  PIC18F8527  PIC18F8622  PIC18F8627  PIC18F8722  PIC18F65J10  PIC18F65J15  PIC18F66J10  PIC18F66J15  PIC18F67J10  PIC18F85J10  PIC18F85J15  PIC18F86J10  PIC18F86J15  PIC18F87J10  PIC18F66J60  PIC18F66J65  PIC18F67J60  PIC18F86J60  PIC18F86J65  PIC18F87J60  PIC18F96J60  PIC18F96J65  PIC18F97J60  PIC18F66J11  PIC18F66J16  PIC18F67J11  PIC18F86J11  PIC18F86J16  PIC18F87J11
OpenTimer3 18F6310  18F6410  18F8310  18F8410
OpenTimer4 All supported processors that have Timer 4
OpenTimer5 All supported processors that have Timer 5

Also See: CloseTimer  StartTimer  StartTimerInterrupt  StopTimer  StopTimerInterrupt


OpenTimer0

Requirements: <libs/timers.bas>
Syntax: OpenTimer0(config as uByte, intConfig as uByte)
Processors Valid For: All supported processors
config Constants:

T0_ON
T0_OFF
Initial On/Off State
Timer 0 on
Timer 0 off

T0_8BIT
T0_16BIT
Timer 0 8/16 bit Selection
8 Bit
16 Bit

T0_CLK_T0CKI
T0_CLK_INTERNAL
Timer 0 Clock Source
Transition on T0CKI pin
Internal instruction cycle

T0_HI2LOW_EDGE
T1_LOW2HI_EDGE
Timer 0 Edge Selection
Increment on high to low transition of T0CKI pin
Increment on low to high transition of T0CKI pin

T0_PS_1_1
T0_PS_1_2
T0_PS_1_4
T0_PS_1_8
T0_PS_1_16
T0_PS_1_32
T0_PS_1_64
T0_PS_1_128
T0_PS_1_256
Prescaler Selection
1:1
1:2
1:4
1:8
1:16
1:32
1:64
1:128
1:256
intConfig Constants:
T0_INT_OFF Timer 0 Interrupts disabled
T0_INT_HIGH Timer 0 High Priority Interrupts Enabled
T0_INT_LOW Timer 0 Low Priority Interrupts Enabled
Example: Open Timer 0 as an 8 bit timer with an internal clock source, a prescaler selection of 1:1, and the high priority interrupt enabled
OpenTimer0(T0_8BIT + T0_CLK_INTERNAL + T0_PS_1_1,T0_INT_HIGH)

OpenTimer1

Requirements: <libs/timers.bas>
Syntax: OpenTimer1(config as uByte, intConfig as uByte)
Processors Valid For: All supported processors
config Constants:

T1_8BIT_RW
T1_16BIT_RW
R/W Mode
8 Bit Read/Write
16 Bit Read/Write

T1_PS_1_1
T1_PS_1_2
T1_PS_1_4
T1_PS_1_8
Prescaler
1:1
1:2
1:4
1:8

T1_OSC_ON
T1_OSC_OFF
Timer 1 Oscillator
Enabled
Disabled

T1_SYNC_OFF
T1_SYNC_ON
External Clock Input Synchronization
Not Synchronized
Synchronized

T1_EXT_CLK
T1_INT_CLK
Clock Source
External Clock ( from RC0/T1OSO/T13CKI pin )
Internal Clock (Fosc/4)

T1_ON
T1_OFF
Initial On/Off State
On
Off
intConfig Constants:
T1_INT_OFF Timer 1 Interrupts disabled
T1_INT_HIGH Timer 1 High Priority Interrupts Enabled
T1_INT_LOW Timer 1 Low Priority Interrupts Enabled
Example: Open Timer 1 with 16 bit R/W, internal clock source, a prescaler selection of 1:1, and the high priority interrupt enabled
OpenTimer1(T1_16BIT_RW + T1_PS_1_1 + T1_INT_CLK ,T1_INT_HIGH)

 


OpenTimer2

Requirements: <libs/timers.bas>
Syntax: OpenTimer2(config as uByte, intConfig as uByte)
Processors Valid For: All supported processors
config Constants:

T2_ON
T2_OFF
Initial On/Off State
On
Off

T2_POSTSCALE_1_1
T2_POSTSCALE_1_2
T2_POSTSCALE_1_3
T2_POSTSCALE_1_4
T2_POSTSCALE_1_5
T2_POSTSCALE_1_6
T2_POSTSCALE_1_7
T2_POSTSCALE_1_8
T2_POSTSCALE_1_9
T2_POSTSCALE_1_10
T2_POSTSCALE_1_11
T2_POSTSCALE_1_12
T2_POSTSCALE_1_13
T2_POSTSCALE_1_14
T2_POSTSCALE_1_15
T2_POSTSCALE_1_16
Postscaler
1:1
1:2
1:3
1:4
1:5
1:6
1:7
1:8
1:9
1:10
1:11
1:12
1:13
1:14
1:15
1:16

T2_PRESCALE_1_1
T2_PRESCALE_1_4
T2_PRESCALE_1_16
Prescaler
1:1
1:4
1:16
intConfig Constants:
T2_INT_OFF Timer 2 Interrupts disabled
T2_INT_HIGH Timer 2 High Priority Interrupts Enabled
T2_INT_LOW Timer 2 Low Priority Interrupts Enabled
Example: Open Timer 2 with a prescaler of 1:1, a postscaler of 1:3, and a low priority interrupt.
OpenTimer2(T2_POSTSCALE_1_3 + T2_PRESCALE_1_1 ,T1_INT_LOW)

 


OpenTimer3

Requirements: <libs/timers.bas>
Syntax: OpenTimer3(config as uByte, intConfig as uByte)
Processors Valid For: 18F1220  18F1320
config Constants:

T3_8BIT_RW
T3_16BIT_RW
R/W Mode
8 Bit Read/Write
16 Bit Read/Write

T3_PS_1_1
T3_PS_1_2
T3_PS_1_4
T3_PS_1_8
Prescaler
1:1
1:2
1:4
1:8

T3_CCP_SRC
T1_CCP_SRC
CCP Clock Source
Timer3
Timer1

T3_SYNC_OFF
T3_SYNC_ON
External Clock Input Synchronization
Not Synchronized
Synchronized

T3_EXT_CLK
T3_INT_CLK
Clock Source
External Clock ( from T13CKI pin )
Internal Clock (Fosc/4)

T3_ON
T3_OFF
Initial On/Off State
On
Off
intConfig Constants:
T3_INT_OFF Timer 3 Interrupts disabled
T3_INT_HIGH Timer 3 High Priority Interrupts Enabled
T3_INT_LOW Timer 3 Low Priority Interrupts Enabled
Example: Open Timer 3 with 16 bit R/W, internal clock source, a prescaler selection of 1:1, and the high priority interrupt enabled
OpenTimer1(T3_16BIT_RW + T3_PS_1_1 + T3_INT_CLK ,T3_INT_HIGH)

 


OpenTimer3

Requirements: <libs/timers.bas>
Syntax: OpenTimer3(config as uByte, intConfig as uByte)
Processors Valid For: 18C601  18C801  18F2220  18F2320  18F2420  18F4320  18F2221  18F2321  18F4221  18F4321  18F2410  18F2510  18F2515  18F2610  18F4410  18F4510  18F4515  18F4610  18F2423  18F2523  18F4423  18F4523  18F2455  18F2550  18F4455  18F4550  18F2480  18F2580  18F4480  18F4580  18F2420  18F2520  18F4420  18F4520  18F2525  18F2620  18F4525  18F4620  18F2682  18F2685  18F4682  18F4685  18F6390  18F6490  18F8390  18F8490  18F6585  18F8585  18F6680  18F8680
config Constants:

T3_8BIT_RW
T3_16BIT_RW
R/W Mode
8 Bit Read/Write
16 Bit Read/Write

T3_PS_1_1
T3_PS_1_2
T3_PS_1_4
T3_PS_1_8
Prescaler
1:1
1:2
1:4
1:8

T3_CCP_SRC
T1_CCP_SRC
CCP Clock Source
Timer3
Timer1

T3_SYNC_OFF
T3_SYNC_ON
External Clock Input Synchronization
Not Synchronized
Synchronized

T3_EXT_CLK
T3_INT_CLK
Clock Source
External Clock ( from T13CKI pin )
Internal Clock (Fosc/4)

T3_ON
T3_OFF
Initial On/Off State
On
Off
intConfig Constants:
T3_INT_OFF Timer 3 Interrupts disabled
T3_INT_HIGH Timer 3 High Priority Interrupts Enabled
T3_INT_LOW Timer 3 Low Priority Interrupts Enabled
Example: Open Timer 3 with 16 bit R/W, internal clock source, a prescaler selection of 1:1, and the high priority interrupt enabled
OpenTimer1(T3_16BIT_RW + T3_PS_1_1 + T3_INT_CLK ,T3_INT_HIGH)

 


OpenTimer3

Requirements: <libs/timers.bas>
Syntax: OpenTimer3(config as uByte, intConfig as uByte)
Processors Valid For: PIC18F6520  PIC18F8520  PIC18F6620  PIC18F8620  PIC18F6720  PIC18F8720  PIC18F6527  PIC18F6622  PIC18F6627  PIC18F6722  PIC18F8527  PIC18F8622  PIC18F8627  PIC18F8722  PIC18F65J10  PIC18F65J15  PIC18F66J10  PIC18F66J15  PIC18F67J10  PIC18F85J10  PIC18F85J15  PIC18F86J10  PIC18F86J15  PIC18F87J10  PIC18F66J60  PIC18F66J65  PIC18F67J60  PIC18F86J60  PIC18F86J65  PIC18F87J60  PIC18F96J60  PIC18F96J65  PIC18F97J60  PIC18F66J11  PIC18F66J16  PIC18F67J11  PIC18F86J11  PIC18F86J16  PIC18F87J11
config Constants:

T3_8BIT_RW
T3_16BIT_RW
R/W Mode
8 Bit Read/Write
16 Bit Read/Write

T3_PS_1_1
T3_PS_1_2
T3_PS_1_4
T3_PS_1_8
Prescaler
1:1
1:2
1:4
1:8

T3_4_CCP15

T3_4_CCP3_5_T1_2_CCP1_2


T3_4_CCP2_5_T1_2_CCP1


T1_2_CCP1_5
CCP Clock Source
Timer 3 and Timer 4 are the clock source for CCP1 - CCP5

Timer 3 and Timer 4 are the clock source for CCP3 - CCP5
Timer 1 and Timer 2 are the clock source for CCP 1 and CCP2

Timer 3 and Timer 4 are the clock source for CCP2 - CCP5
Timer 1 and Timer 2 are the clock source for CCP1

Timer 1 and Timer 2 are the clock source for CCP1 - CCP5

T3_SYNC_OFF
T3_SYNC_ON
External Clock Input Synchronization
Not Synchronized
Synchronized

T3_EXT_CLK
T3_INT_CLK
Clock Source
External Clock ( from T13CKI pin )
Internal Clock (Fosc/4)

T3_ON
T3_OFF
Initial On/Off State
On
Off
intConfig Constants:
T3_INT_OFF Timer 3 Interrupts disabled
T3_INT_HIGH Timer 3 High Priority Interrupts Enabled
T3_INT_LOW Timer 3 Low Priority Interrupts Enabled
Example: Open Timer 3 with 16 bit R/W, internal clock source, a prescaler selection of 1:1, and the high priority interrupt enabled
OpenTimer1(T3_16BIT_RW + T3_PS_1_1 + T3_INT_CLK ,T3_INT_HIGH)

 


OpenTimer3

Requirements: <libs/timers.bas>
Syntax: OpenTimer3(config as uByte, intConfig as uByte)
Processors Valid For: 18F6310  18F6410  18F8310  18F8410
config Constants:

T3_8BIT_RW
T3_16BIT_RW
R/W Mode
8 Bit Read/Write
16 Bit Read/Write

T3_PS_1_1
T3_PS_1_2
T3_PS_1_4
T3_PS_1_8
Prescaler
1:1
1:2
1:4
1:8

T3_CCPX

T3_CCP3_T1_CCP1_2


T3_CCP2_3_T1_CCP1


T1_CCPX
CCP Clock Source
Timer 3 is the clock source for all CCP modules

Timer 3 is the clock source for CCP3
Timer 1 is the clock source for CCP1 and CCP2

Timer 3 is the clock source for CCP2 and CCP3
Timer 1 is the clock source for CCP1

Timer 1 is the clock source for all CCP modules

T3_SYNC_OFF
T3_SYNC_ON
External Clock Input Synchronization
Not Synchronized
Synchronized

T3_EXT_CLK
T3_INT_CLK
Clock Source
External Clock ( from T13CKI pin )
Internal Clock (Fosc/4)

T3_ON
T3_OFF
Initial On/Off State
On
Off
intConfig Constants:
T3_INT_OFF Timer 3 Interrupts disabled
T3_INT_HIGH Timer 3 High Priority Interrupts Enabled
T3_INT_LOW Timer 3 Low Priority Interrupts Enabled
Example: Open Timer 3 with 16 bit R/W, internal clock source, a prescaler selection of 1:1, and the high priority interrupt enabled
OpenTimer1(T3_16BIT_RW + T3_PS_1_1 + T3_INT_CLK ,T3_INT_HIGH)

 

OpenTimer4

Requirements: <libs/timers.bas>
Syntax: OpenTimer4(config as uByte, intConfig as uByte)
Processors Valid For: 18F66J10  18F65J15  18F6520  18F66J10  18F66J11  18F66J15  18F66J16  18F6527  18F66J10  18F66J15  18F6620  18F6622  18F66J60  18F66J60  18F6627  18F67J10  18F67J11  18F67J60  18F6720  18F6722  18F85J10  18F85J15  18F8520  18F8527  18F86J10  18F86J11  18F86J15  18F86J16  18F8620  18F86J60  18F86J65  18F8622  18F8627  18F87J10  18F87J11  18F87J60  18F8720  18F8722  18F96J60  18F96J65  18F97J60
config Constants:

T4_ON
T4_OFF
Initial On/Off State
On
Off

T4_POSTSCALE_1_1
T4_POSTSCALE_1_2
T4_POSTSCALE_1_3
T4_POSTSCALE_1_4
T4_POSTSCALE_1_5
T4_POSTSCALE_1_6
T4_POSTSCALE_1_7
T4_POSTSCALE_1_8
T4_POSTSCALE_1_9
T4_POSTSCALE_1_10
T4_POSTSCALE_1_11
T4_POSTSCALE_1_12
T4_POSTSCALE_1_13
T4_POSTSCALE_1_14
T4_POSTSCALE_1_15
T4_POSTSCALE_1_16
Postscaler
1:1
1:2
1:3
1:4
1:5
1:6
1:7
1:8
1:9
1:10
1:11
1:12
1:13
1:14
1:15
1:16

T4_PRESCALE_1_1
T4_PRESCALE_1_4
T4_PRESCALE_1_16
Prescaler
1:1
1:4
1:16
intConfig Constants:
T4_INT_OFF Timer 4 Interrupts disabled
T4_INT_HIGH Timer 4 High Priority Interrupts Enabled
T4_INT_LOW Timer 4 Low Priority Interrupts Enabled
Example: Open Timer 4 with a prescaler of 1:1, a postscaler of 1:3, and a low priority interrupt.
OpenTimer4(T4_POSTSCALE_1_3 + T4_PRESCALE_1_1 ,T4_INT_LOW)

 

 


OpenTimer5

Requirements: <libs/timers.bas>
Syntax: OpenTimer5(config as uByte, intConfig as uByte)
Processors Valid For: 18F2331  18F2431  18F4331  18F4431
config Constants:

T5_SLEEP_ENABLED
T5_SLEEP_DISABLED
Sleep Enable
Enabled during Sleep
Disabled during Sleep

T5_SPECIAL_EVENT_ENA
T5_SPECIAL_EVENT_DIS
Special Event
Enabled
Disabled

T5_SINGLE_SHOT
T5_CONTINUOUS
Mode
Single Shot
Continuous

T5_PRESCALE_1_1
T5_PRESCALE_1_2
T5_PRESCALE_1_4
T5_PRESCALE_1_8
Prescaler
1:1
1:2
1:4
1:8

T5_SYNC_OFF
T5_SYNC_ON
External Clock Synchronization
Not Synchronized
Synchronized

T5_EXT_CLK
T5_INT_CLK
Clock Source
External (from T5CKI pin )
Internal ( FOSC/4 )

T5_ON
T5_OFF
Initial State
On
Off
intConfig Constants:
T5_INT_OFF Timer 1 Interrupts disabled
T5_INT_HIGH Timer 1 High Priority Interrupts Enabled
T5_INT_LOW Timer 1 Low Priority Interrupts Enabled
Example: Open Timer 5 with no special event, disabled during sleep, 1:1 prescale, continuous running, internal oscillator, initial state of on, and  no interrupts.
OpenTimer5(T5_SPECIAL_EVENT_DIS + T5_SLEEP_DISABLED + T5_CONTINUOUS + _
           T5_PRESCALE_1_1 + T5_INT_CLK + T5_ON, T5_INT_OFF)