
RPBASIC-52 PROGRAMMING GUIDE
2-24
COUNT (function)
Syntax: A = COUNT(counter)
Where: counter = 0 - 1, or 4 - 11
Function: Reads a multimode hardware or software counter
Mode: Command, Run
Use: A = COUNT(0)
Cards: RPC-320, RPC-330
DESCRIPTION
RPBASIC-52 recognizes a hardware and software counter. The hardware counter is 24 bits wide from a LSI
7166 chip. (Your board may use a different kind. Please check your hardware manual.) The RPC-320 has
one of these and the RPC-330 has two. Additionally, there are 8 software counters on all cards.
counter 0 and 1 retrieve a 24 bit (3 byte) number from the LSI 7166 multimode counter IC. A number from 0
to 16777215 is returned. See your hardware manual for more information about using the LSI 7166 chip.
Eight software counters, set by the ON COUNT command, return a count from 0 to 65535. Software counter
is 4 to 11. A software count is incremented when a line goes low.
RELATED
COUNT (statement), ON COUNT
ERROR
BAD ARGUMENT When counter is out of range
EXAMPLE
The following example sets up line 3 as a software counter input. A count is printed once a second. A count
is incremented by bringin g line 3 low m omentarily.
10 ON COUNT4,3
20 ONTICK 1,1000
30 IDLE
40 GOTO 30
1000 PRINT COUNT(4)
1010 RETI
ON COUNT can be configured to generate an interrupt when a specified number of counts is reached. See
COUNT MULTITASKING under MU LTITA SKING CONSTRU CTS at the beginning of this m anual.
Kommentare zu diesen Handbüchern