User`s manual
CYDAS UDR Library User’s Guide Counter Boards - CYQUAD Series
117
CYQUAD Series
Counter I/O
Counter functions and methods supported
UDR:
cbC7266Config(), cbCIn(), cbCIn32(), cbCLoad(), cbCLoad32(), cbCStatus()
UDR for .NET: C7266Config(), CIn(), CIn32(), CLoad(), CLoad32(), CStatus()
Counter argument values
CounterNum PCYQUAD 02, CYQUAD 02
1 to 2
CYQUAD 04, CYQUAD 04P
1 to 4
RegName UDR:
COUNT1, COUNT2, PRESET1, PRESET2, PRESCALER1, PRESCALER2
UDR for .NET:
QuadCount1, QuadCount2, QuadPreset1, QuadPreset2, QuadPreScaler1,
QuadPreScaler2
CYQUAD 04, CYQUAD 04P also support:
UDR:
COUNT3, COUNT4, PRESET3, PRESET4, PRESCALER3, PRESCALER4
UDR for .NET:
QuadCount3
, QuadCount4, QuadPreset3, QuadPreset4, QuadPreScaler3,
QuadPreScaler4
LoadValue
When using cbCLoad32() or CLoad32() to load the COUNT# or PRESET# registers,
values up to 16.78 million (2
24
–1) can be loaded. Values using cbCLoad() and
CLoad()are limited to 65,535 (2
16
–1). Refer to "Basic signed integers" on page 112
for more information. When loading the
PRESCALER# register, values can be from 0
to 255. (Digital Filter Clock frequency = 10 MHz/LoadValue + 1.)
Hardware considerations
Loading and Reading 24-bit values
The CYQUAD series boards feature a 24-bit counter. For counts of less than 16 bits (65535), you can use the
cbCIn() and cbCLoad() functions, or the CIn() and CLoad() methods. You can use the cbCIn32() and
cbCLoad() functions, or the CIn32() and CLoad32() methods for any number supported by the LS7266
counter (24 bits = 16777216).
Cascading counters (CYQUAD 04P only)
The CYQUAD 04P can be set up for cascading counters. By setting the appropriate registers, you can have
(4) 24-bit counters, (2) 48-bit counters, (1) 24-bit and (1) 72-bit counters, or (1) 96-bit counter. The
OUTPUT
pins of a counter are directed to the next counter by setting the
FLG1 to CARRY/BORROW and the FLG2 to
UP/DOWN. Bits 3 and 4 of the IOR Register control are set to 1,0 to accomplish this.
You can set these bits by using the functions
cbC7266Config(BoardNum, CounterNum, Quadrature,
CountingMode, DataEncoding, IndexMode, InvertIndex, FlagPins, and GateEnable). When using the
CYDAS UDR Library for .NET, use the
C7266Config() method.
The constant CARRYBORROW_UPDOWN (value of 3) is used for the parameter FlagPins.
The IOR register cannot be read. However, you can read the values of the BADR2+9 register. The value for
Base 2 can be determined by looking at the resources used by the board. The 8-bit region is BADR2. The
BADR+9 register contains values for PhxA and PhxB, for x = 1 to 4 to identify counters. The diagram below