# C7266Config()

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).

Member of the MccBoard class.

## Function Prototype

VB .NET

Public Function C7266Config(ByVal counterNum As Integer, ByVal quadrature As MccDaq.Quadrature, ByVal countingMode As MccDaq.CountingMode, ByVal dataEncoding As MccDaq.DataEncoding, ByVal indexMode As MccDaq.IndexMode, ByVal invertIndex As MccDaq.OptionState, ByVal flagPins As MccDaq.FlagPins, ByVal gateState As MccDaq.OptionState) As MccDaq.ErrorInfo

C# .NET

public MccDaq.ErrorInfo C7266Config(int counterNum, MccDaq.Quadrature quadrature, MccDaq.CountingMode countingMode, MccDaq.DataEncoding dataEncoding, MccDaq.IndexMode indexMode, MccDaq.OptionState invertIndex, MccDaq.FlagPins flagPins, MccDaq.OptionState gateState)

## Parameters

counterNum

Number (1 to n) of the counter to configure, where n is the number of counters on the board.

quadrature

Selects the resolution multiplier for quadrature input (X1Quad, X2Quad, or X4Quad), or disables quadrature input (NoQuad) so that the counters can be used as standard TTL counters.

countingMode

Selects the operating mode for the counter. Refer to CountingModes parameter values below.

dataEncoding

Selects the format of the data that is returned by the counter - either Binary or BCD format. Options are BinaryCount or BCDCount.

indexMode

Selects which action is taken when the Index signal is received. The IndexMode must be set to IndexDisabled whenever a Quadrature is set to NOQuad, or when GateState is set to Enabled. Refer to IndexModes parameter values below.

invertIndex

Selects the polarity of the Index signal. Options are Enabled or Disabled. If set to Enabled, the Index signal is assumed to be negative polarity. If set to Disabled, the Index signal is assumed to be positive polarity.

flagPins

Selects which signals are routed to the FLG1 and FLG2 pins. Refer to the FlagPins parameter values below.

gateState

When gateState is set to ENABLED, the channel INDEX input is routed to the RCNTR pin of the LS7266 chip, and is used as a gating signal for the counter. When set to ENABLED indexMode must be set to IndexDisabled.

## Returns

- Error code or 0 if no errors

### CountingModes parameter values

NormalMode | Each counter operates as a 24 bit counter that rolls over to 0 when the maximum count is reached.
RangeLimit | 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 CLoad method 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.
NoRecycle | 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.
ModuloN | In ModuloN 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.

### IndexModes parameter values

IndexDisabled | The Index signal is ignored.
LoadCtr | The channel INDEX input is routed to the LCNTR pin of the LS7266 counter chip. The counter is loaded whenever the signal occurs.
LoadOutLatch | 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 CIn() method will return the same count value each time it is called until the Index signal occurs.
ResetCtr | The channel INDEX input is routed to the RCNTR pin of the LS7266 counter chip. The counter is reset whenever the signal occurs.

### FlagPins parameter values

CarryBorrow | FLG1 pin is Carry output, FLG2 is Borrow output.
CompareBorrow | FLG1 pin is Compare output, FLG2 is Borrow output.
CarryBorrowUpDown | FLG1 pin is Carry/Borrow output, FLG2 is Up/Down signal.
IndexError | FLG1 pin is Index output, FLG2 is Error output.