Count multitasking – Remote Processing CAMBASIC User Manual

Page 192

Advertising
background image

Event Multitasking - 3

COUNT MULTITASKING

Introduction

CAM BASIC supports eight event counters. These ar e generated in software and are intended for low– speed counting.
Each counter may be assigned through software to any digital I/O line on any Control or expansion card. Once
configured, counting is done independently in the backgr ound. T he counters have the fo llowing features:

1.

The count rate may range from 0 to 80 Hz.

2.

The cou nters m ay be re ad at any tim e with the C OUN T function . T his function is
synchronized with the counter so that valid data is always read.

3.

You can pr ogram the counter so that the prog ram br anches to a subroutine w hen it reaches a
preset am ount using the O N C OUN T statem ent.

4.

You can also crea te a modu le n counter by having the c ounter au tomatically r eset when it
reache s a preset c ount, using the C ONF IG CO UN T statem ent.

5.

The counter s are 16– bit and can accumu late up to 65,535 counts.

6.

Y o u c a n s to p an d ze r o th e co u nt e rs in d iv id u al ly o r i n g r o up s wi th th e C L EA R C O U N T
statemen t.

7.

You can start the cou nting individually or in groups w ith the STA RT C OUN T statem ent.

8.

Y o u c a n s u sp e nd c ou n te r o pe r a ti on w hi le m a in ta i ni ng th e co u nt w it h t he S T OP C O U N T
statemen t.

9.

Y o u c a n r e st a rt th e co u nt e rs w it ho u t r e se t ti ng th e co u nt us in g th e RE S U M E C O U N T
statemen t.

How Counting is Done

A specified input line is sampled 200 times (100 times in 9 MHz systems) per second. As shown in Figure 1, when the
software detects that the input changes from a high logic state to a low logic state, the counter is incremented.

Count
input

Sample

Counter
Increment

Figure 1

Advertising