CONFIG TIMER0, TIMER1

Top  Previous  Next

Action

Configure TIMER0 or TIMER1.

 

 

Syntax

CONFIG  TIMERx = COUNTER/TIMER , GATE=INTERNAL/EXTERNAL , MODE=0/3

 

 

Remarks

TIMERx

TIMER0 or TIMER1.

COUNTER will configure TIMERx as a COUNTER and TIMER will configure TIMERx as a TIMER.

A TIMER has built in clock input and a COUNTER has external clock input.

GATE

INTERNAL or EXTERNAL. Specify EXTERNAL to enable gate control with the INT input.

MODE

Time/counter mode 0-3. See Hardware for more details.

 

 

So CONFIG TIMER0 = COUNTER, GATE = INTERNAL, MODE=2  will configure TIMER0 as a COUNTER with no external gate control , in mode 2 (auto reload)

 

When the timer/counter is configured the timer/counter is stopped so you must start it afterwards with the START TIMERx statement.

 

See the additional statements for other microprocessors that use the CONFIG statement.

 

 

Example

CONFIG TIMER0=COUNTER, MODE=1, GATE=INTERNAL

COUNTER0 = 0                        'reset counter 0

START COUNTER0                'enable the counter to run

DELAY                                'wait a while

PRINT COUNTER0                        'print it

END