beautypg.com

11 s826_counterstatusread, 12 s826_counterextinroutingwrite, S826_counterstatusread – Sensoray 826 User Manual

Page 44: S826_counterextinroutingwrite

background image

The mode, preload, compare, and snapshot configuration registers are not affected when a channel transitions between
halted and running states. This function has no effect if used to start a channel that is already running, or to stop a
channel that is already halted.

This function can be used to zero the counter core by calling it once to halt the channel (and zero the counts) and again
to start the channel running. Another way to zero the counts is to zero to the Preload0 register (by calling
S826_CounterPreloadWrite) and then transfer the preload value to the core (via S826_CounterPreload).

7.3.11 S826_CounterStatusRead

The S826_CounterStatusRead function returns information about a counter channel's status.

int S826_CounterStatusRead(
uint board, // board identifier
uint chan, // channel number
uint *status // channel status info
);

Parameters

board

826 board number. This must match the settings of the board's dip switches as described in section 2.2.

chan

Counter channel number in the range 0 to 5.

status

Pointer to a buffer that will receive the status:

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10

9

8

7

6

5

4

3

2

1

0

0

0

RUN

0

ST

0

0

0

0

0

0

0

0

0

0

PLS

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

Bit

Description

RUN

Channel enable: '1' = running, '0' = halted. This is controlled by S826_CounterStateWrite.

ST

Sticky preload command. This is controlled by S826_CounterPreload.

PLS

Preload selector. This indicates the active preload register: '1' = Preload1, '0' = Preload0.
PLS can be '1' only if mode register bit BP=1 (see S826_CounterModeWrite).

Return Values

If the function succeeds, the return value is zero.

If the function fails, the return value is an error code.

7.3.12 S826_CounterExtInRoutingWrite

The S826_CounterExtInRoutingWrite function selects the signal source for a counter channel's ExtIn input.

int S826_CounterExtInRoutingWrite(
uint board, // board identifier
uint chan, // counter channel number
uint route // routing configuration
);

Parameters

board

826 board number. This must match the settings of the board's dip switches as described in section 2.2.

chan

Counter channel number in the range 0 to 5.

826 Instruction Manual

39

Counters