Go to Triangle Digital Support Home Page TDS2020F TECHNICAL MANUAL
Hardware support
Timer-counters
Live website search
Enter key words
 

TIMER-COUNTERS

FILES

These files support the counter-timers on the TDS2020F. In addition see LOW POWER OPERATION, page 89 and TIMEKEEPING, page 93.

 

#COUNT.TDS

Demonstrates use of Timer 1 and Timer 2 as 16-bit counters

#COUNT8.TDS

Provides eight 32-bit counter and frequency meters working independently up to 5kHz

#COUNTER.TDS

(comes with Update Service) Low overhead 32-bit pulse counter. Words recover a 32-bit count, zero the counter and start and stop its operation.

#FREQ.TDS

(comes with Update Service) Measure frequencies to over 1MHz.

#PERIOD.TDS

(comes with Update Service) Period measurements on signals from 18.8Hz to 33kHz.

#TIMING.TDS

Creates millisecond delays in real-time, even when using the multitasker. Get real time as 48-bit unsigned number, precise to 814ns.

DESCRIPTION

There are four hardware timers (plus the clock chip)-one is 8-bit and three 16-bit:

 

q       The 8-bit timer can be clocked internally at 814ns, 6.51�s or 104ms or it can use an external clock enabling it to be used as an external event counter.

q       The 16-bit timers can be set to internally increment every 407ns, 814ns or 3.255�s and any of the three can use an external clock.

 

Counter-timer pins are mainly on Port 7, which has Schmitt trigger inputs. This means that the signal you provide need not have sharp edges and full logic levels. See PARALLEL INPUT & OUTPUT, page 74, for voltage specifications. The CIRCUIT DIAGRAM, page 40, and PIN CONNECTIONS, page 38, will help you allocate timer-counter pins in your application, but see the Hardware Manual sections 10 (16-bit timers) and 11 (8-bit timers) for full information on how to use them.

All four timer-counters can be read and written by software and each may generate an interrupt on overflow to allow extension to 32-bit counting and beyond. Every timer has two output capture registers that can raise a flag when the counter matches the output capture value. The 8 flags can be polled, used to cause interrupts or generate a hardware output. Each of the three 16-bit timers also has an input capture mode-on receipt of an external signal the counter value is transferred to a 16-bit register so that the exact transition time can be read by software.

This table shows how supplied software uses the timer-counters:

 

FACILITY

USED BY

PURPOSE

Timer 1

 

 

   Input Capture

#PERIOD.TDS

period measurement

Timer 2

Not used

 

Timer 3

 

 

   Overflow interrupt

Forth ROM

date & time

 

#TIMING.TDS

precise delays

   Output Compare A

#TASKS.TDS

pre-emptive multitasker

   Output Compare B

Forth ROM

regular interrupts in Forth

 

#EVERY.TDS

execution at defined intervals

   Input Capture

#CANPRIM.TDS

CAN bus

8-bit Timer

#SERIAL2.TDS

serial Port 2

 

#FREQ.TDS

frequency measurement

Go to Triangle Digital Support Home Page Go to top   Next page