beautypg.com

15 s826_countersnapshotconfigread, S826_countersnapshotconfigread – Sensoray 826 User Manual

Page 46

background image

cfg

Flags with 'E' prefix determine the types of events that will capture snapshots: '1' = enable capturing, '0' = disable
capturing. Each flag with 'R' prefix determines whether the corresponding 'E' flag will be automatically cleared upon
snapshot capture, thus preventing subsequent events of that type from invoking snapshots.

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

0

0

0

0

0

0

0

RER REF RXR RXF RZ RM1 RMO

0

0

0

0

0

0

0

0

0

EER EEF EXR EXF EZ EM1 EM0

Flag

Snapshot trigger event

ER

ExtIn leading edge

EF

ExtIn falling edge

XR

Index leading edge

XF

Index falling edge

Z

Zero counts reached

M1

Compare1 register matches counter core

M0

Compare0 register matches counter core

mode

Write mode for cfg: 0 = write, 1 = clear bits, 2 = set bits (see “Atomic Read-Modify-Write”).

Return Values

If the function succeeds, the return value is zero.

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

Remarks

This function programs the snapshot configuration register. A snapshot will be captured when an 'E' flag is
programmed to '1' and the corresponding event occurs. Upon snapshot capture, the associated 'E' flag will be
automatically cleared if the corresponding 'R' flag is set.

Independent of these flags, snapshots may also be captured upon quadrature clock error or in response to calls to
S826_CounterSnapshot.

7.3.15 S826_CounterSnapshotConfigRead

The S826_CounterSnapshotConfigRead function reads the snapshot configuration register.

int S826_CounterSnapshotConfigRead(
uint board, // board identifier
uint chan, // counter channel number
uint *cfg // configuration flags
);

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.

cfg

Pointer to buffer that will receive the configuration flags. The format of the returned value is identical to the events
value used in the S826_CounterSnapshotConfigWrite function. Note that 'E' flags (flags with 'E' name prefix) may be
automatically reset in response to captured snapshots.

Return Values

If the function succeeds, the return value is zero.

826 Instruction Manual

41

Counters