Specifications

Event Multitasking - 4
CONFIG COUNT counter, address, bit [,preset] [,AUTO]
Where:
counter is the counter number which may be 0 through 7.
address is the I/O address of the port (of 8 bits) that you want to use for the input. This will typically
be an 82C55 port.
bit is the particular bit or line of the port addressed. The range is 0 through 7.
preset is an optional parameter that tells the counter to notify the system when a preset count has been
reached. The program will branch if an ON COUNT statement has been executed. The value may
range from 1 to 65,656.
AUTO is an optional parameter. Without AUTO, the counter will continue to increment after the
preset count is reached. When AUTO is specified, the counter will reset to zero after reacting the
preset count. This way no counts are missed while the subroutine branch is executing.
Background Tasking is Much Faster
The data that you enter with the CONFIG COUNT and ON COUNT statements is compiled into object code. Thus, the
execution time on the 200 Hz (100 times in 9 Mhz systems) clock tick is only microseconds, rather than the milliseconds
that it would take in BASIC.
Modes of Operation
At there are two modes of operation. The first is the polled mode in which counts are accumulated and read from time to
time by the program. When the counter reaches 65,535, the next count will roll the counter over to zero. This mode
requires only that CONFIG COUNT and START COUNT be executed in that order. A short example would be:
10 CONFIG COUNT 5,0,1,2000,AUTO
20 START COUNT 5
.
.
Line 10 configures counter 5 to read bit 1 of address 0 as an input. When the count reaches 2000,
the counter will automatically reset.
Line 20 starts counter operation. These two lines do not need to be adjacent in the program.
However, line 20 must be executed after line 10.
The second is the interrupt mode. When the preset count is reached, a software interrupt is generated and the program
branches to a subroutine which acts on the preset count. This mode requires that CONFIG COUNT, ON COUNT and
START COUNT be executed in that order. Below is a short example of a prescaler:
10 CONFIG COUNT 5,0,1,2000,AUTO
20 ON COUNT 5 GOSUB 200
30 START COUNT 5
.
.
200 INC A
210 RETURN