Configures 7266 counter for desired operation. This function can only be used with boards that contain a 7266 counter chip (Quadrature Encoder boards).
For more information, refer to the LS7266R1 data sheet (ls7266r1.pdf) in the Documents subdirectory where the UL is installed (C:\Program files\Measurement Computing\DAQ by default).
C/C++
int cbC7266Config(int BoardNum, int CounterNum, int Quadrature, int CountingMode, int DataEncoding, int IndexMode, int InvertIndex, int FlagPins, int Gating)
Visual Basic
Function cbC7266Config(ByVal BoardNum&, ByVal CounterNum&, ByVal Quadrature&, ByVal CountingMode&, ByVal DataEncoding&, ByVal IndexMode&, ByVal InvertIndex&, ByVal FlagPins&, ByVal Gating&) As Long
BoardNum
The number associated with the board when it was installed with InstaCal or created with cbCreateDaqDevice(). BoardNum may be 0 to 99. The board must have a LS7266 counter.
CounterNum
Counter Number (1 - n), where n is the number of counters on the board.
Quadrature
Selects the resolution multiplier for quadrature input, or disables quadrature input (NO_QUAD) so that the counters can be used as standard TTL counters. NO_QUAD, X1_QUAD, X2_QUAD, or X4_QUAD.
CountingMode
Selects operating mode for the counter. NORMAL_MODE, RANGE_LIMIT, NO_RECYCLE, MODULO_N. Set it to one of the constants in the CountingMode argument values section below.
DataEncoding
Selects the format of the data that is returned by the counter - either Binary or BCD format. BCD_ENCODING, BINARY_ENCODING.
IndexMode
Selects which action will be taken when the Index signal is received. The IndexMode must be set to INDEX_DISABLED whenever a Quadrature is set to NON_QUAD or when Gate is set to ENABLED. Set it to one of the constants in the IndexMode argument values section below.
InvertIndex
Selects the polarity of the Index signal. If set to DISABLED, the Index signal is assumed to be positive polarity. If set to ENABLED, the Index signal is assumed to be negative polarity.
FlagPins
Selects which signals will be routed to the FLG1 and FLG2 pins. Set it to one of the constants in the FlagPins argument values section below.
Gating
If gating is set to ENABLED, then the channel INDEX input is routed to the RCNTR pin of the LS7266 chip, and is used as a gating signal for the counter. Whenever Gating = ENABLED the IndexMode must be set to INDEX_DISABLED.
| NORMAL_MODE | Each counter operates as a 24 bit counter that rolls over to 0 when the maximum count is reached. |
| RANGE_LIMIT | In range limit count mode, an upper an lower limit is set, mimicking limit switches in the mechanical counterpart. The upper limit is set by loading the PRESET register with the cbCLoad() function after the counter has been configured. The lower limit is always 0. When counting up, the counter freezes whenever the count reaches the value that was loaded into the PRESET register. When counting down, the counter freezes at 0. In either case the counting is resumed only when the count direction is reversed. |
| NO_RECYCLE | In non-recycle mode the counter is disabled whenever a count overflow or underflow takes place. The counter is re-enabled when a reset or load operation is performed on the counter. |
| MODULO_N | In modulo-n mode, an upper limit is set by loading the PRESET register with a maximum count. Whenever counting up, when the maximum count is reached, the counter will roll-over to 0 and continue counting up. Likewise when counting down, whenever the count reaches 0, it will roll over to the maximum count (in the PRESET register) and continue counting down. |
| INDEX_DISABLED | The Index signal is ignored. |
| LOAD_CTR | The channel INDEX input is routed to the LCNTR pin of the LS7266 counter chip. The counter is loaded whenever the signal occurs. |
| LOAD_OUT_LATCH | The channel INDEX input is routed to the LCNTR pin of the LS7266 counter chip. The current count is latched whenever the signal occurs. When this mode is selected, the cbCIn() function will return the same count value each time it is called until the Index signal occurs. |
| RESET_CTR | The channel INDEX input is routed to the RCNTR pin of the LS7266 counter chip. The counter is reset whenever the signal occurs. |
| CARRY_BORROW | FLG1 pin is CARRY output, FLG2 is BORROW output. |
| COMPARE_BORROW | FLG1 pin is COMPARE output, FLG2 is BORROW output. |
| CARRYBORROW_UPDOWN | FLG1 pin is CARRY/BORROW output, FLG2 is UP/DOWN signal. |
| INDEX_ERROR | FLG1 pin is INDEX output, FLG2 is error output. |