4 capture digital input edges – Sensoray 626 User Manual
Page 13

Sensoray Model 626 Instruction Manual
11
9.4 Capture Digital Input Edges
This feature is not available on inputs 20-23 and 44-47 (The grayed out areas of the tables).
Reading any edge capture data or interrupt data from these inputs will always return 0.
Writing to any of edge capture or interrupt register for these inputs will have no effect.
9.4.1 Selecting Positive or Negative Edge Capture
Table 7 Selecting Positive or Negative Edge Capture
Offset
Input Channel Number
(Hex)
Register
Name
Bit 15
Bit 14
Bit 13
Bit 12
Bit 11
Bit 10
Bit 9
Bit 8
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
44 WREDSELA
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
54 WREDSELB 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
64 WREDSELC 47
46
45
44
43
42
41
40
39 38 37 36 35 34 33 32
Write to the WREDSEL register with a ‘0’ to select negative edges (transition from 1 to 0) or a ‘1’ to
select positive edges (transition from 0 to 1). Note that these will take effect once edge capturing for a
particular channel has been enabled.
9.4.2 Edge Capture Interrupt
A captured edge is usually set up to be accompanied by an interrupt. (See “Selecting Interrupt on Edge
Capture” P13). If this is not done then the RDCAPFLG will need to be polled to see if an edge has
occurred.
9.4.3 Enabling and Disabling Edge Capture
Table 8 Enabling & Disabling Edge Capture
Offset
Input Channel Number
(Hex)
Register
Name
Bit 15
Bit 14
Bit 13
Bit 12
Bit 11
Bit 10
Bit 9
Bit 8
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
42 WRCAPSELA
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
52 WRCAPSELB 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
62 WRCAPSELC 47
46
45
44
43
42
41
40
39 38 37 36 35 34 33 32
Before any edges can be captured the channel/s that are to be captured from must be enabled. Using the
EDCAP bit of MISC1 to do this is a means of ‘masking out’ the other channel’s WRCAPSEL bits while
modifying a selected channel.
To Enable a channel for edge capture:
1. First the EDCAP bit of the MISC1 register must be setup.
‘1’ is used to enable one or more channels.
‘0’ is used to disable one or more channels.
2. Now write to the WRCAPSELA, B or C to apply the above command to the corresponding
channels selected with a ‘1’ in WRCAPSELA, B or C.