User`s manual

112
12
Counter Boards
Introduction
This chapter provides details on using counter/timer boards in conjunction with the CYDAS UDR Library.
Boards released after the printing of this user’s guide are explained in Readme files on the CYDAS UDR
Library installation disk.
Basic signed integers
When reading or writing ports that are 16-bits wide, be aware of the following issue using signed integers
(which is required when using Basic):
On some boards, such as the CYCTM 10 count register or
AUXPORT digital ports, the ports are 16-bits wide.
When accessing the data at these ports, the digital values are arranged as a single 16-bit word. Using signed
integers, values above 0111 1111 1111 1111 (32767 decimal) can be confusing. The next increment, 1000
0000 0000 0000 has a decimal value of -32768. Using signed integers, this is the value that is returned from a
16 bit counter at half of maximum count. The value for full count (just before the counter turns over) is -1.
Keep this in mind if you are using Basic, since Basic does not supply unsigned integers (values from 0 to
65535) or unsigned longs (values from 0 to 4,294,967,295). Refer to "16-bit values using a signed integer data
type" on page 7 for more information.
The CYDAS UDR Library provides functions for the initialization and configuration of counter chips, and can
configure a counter for any of the counter operations. However, counter configuration does not include
counter-use, such as event counting and pulse width. Counter-use is accomplished by programs which use the
counter functions. The CYDAS UDR Library Version 1 and later provides the
cbCFreqIn() function for
counter use, while the CYDAS UDR Library for .NET provides the
CFreqIn() method. Other functions and
methods may be added for counter use to later revisions.
Read the counter chip's data sheet
To use a counter for any but the simplest counting function, you must read, understand, and employ the
information contained in the chip manufacturer's data sheet. Technical support of the CYDAS UDR Library
does not include providing, interpreting, or explaining the counter chip data sheet.
To fully understand and maximize the performance of the counter/timer boards and their related function
calls, review the following related data sheet(s):
Counter/Timer Data Sheet
82C54 82C54.pdf is located in the Documents installation subdirectory.
AM9513 9513A.pdf is located in the Documents installation subdirectory.
Z8536 The data book for the Z8536 counter chip is included with the product that employs this chip.
LS7266 LS7266R1.pdf is located in the Documents installation subdirectory.
Counter chip variables
UDR Library counter initialization and configuration functions include names for bit patterns, such as
ALEGATE, which stands for Active Low Enabled Gate N. In any case where the UDR Library has a name for
a bit pattern, it is allowed to substitute the bit pattern as a numeric. This will work, but your programs will be
harder to read and debug.