7.3 API functions....................................................42
7.3.1 S826_CounterSnapshotRead..............................42
7.3.2 S826_CounterWaitCancel..................................43
7.3.3 S826_CounterCompareWrite.............................43
7.3.4 S826_CounterCompareRead..............................44
7.3.5 S826_CounterSnapshot......................................44
7.3.6 S826_CounterRead............................................45
7.3.7 S826_CounterPreloadWrite...............................45
7.3.8 S826_CounterPreloadRead................................46
7.3.9 S826_CounterPreload........................................46
7.3.10 S826_CounterStateWrite.................................47
7.3.11 S826_CounterStatusRead................................48
7.3.12 S826_CounterExtInRoutingWrite....................48
7.3.13 S826_CounterExtInRoutingRead....................49
7.3.14 S826_CounterSnapshotConfigWrite................49
7.3.15 S826_CounterSnapshotConfigRead................50
7.3.16 S826_CounterFilterWrite.................................51
7.3.17 S826_CounterFilterRead..................................52
7.3.18 S826_CounterModeWrite................................52
7.3.19 S826_CounterModeRead.................................54
7.4 Application notes..............................................55
7.4.1 Hardware interrupts...........................................55
7.4.2 Time delay.........................................................55
7.4.3 Periodic timer.....................................................56
7.4.3.1 Hardware timer..........................................56
7.4.3.2 Software timer...........................................56
7.4.4 Call a function periodically................................57
7.4.5 Frequency counter..............................................58
7.4.6 Period and pulse width measurement................58
7.4.7 Routing a counter output to DIO pins................60
7.4.8 One-shot operation.............................................60
7.4.9 Jamming counts into a counter..........................61
7.4.10 PWM generator................................................61
7.4.11 Incremental encoders.......................................62
7.4.11.1 Basic operation.......................................62
7.4.11.2 Using interrupts.......................................63
7.4.11.3 Measuring speed......................................64
7.4.11.4 Precise homing........................................65
7.4.11.5 Output pulse at specific position.............65
7.4.11.6 Output pulse every N encoder pulses......66
7.4.11.7 Interfacing touch-trigger probes..............67
7.4.12 Quadrature clock generator..............................69
7.4.13 Pulse burst generator........................................69
Chapter 8: Digital I/O.....................................72
8.1 Introduction.......................................................72
8.1.1 Signal router.......................................................72
8.1.2 Safemode............................................................73
8.1.3 Edge capture.......................................................73
8.1.4 Pin timing...........................................................73
8.1.4.1 External pull-up resistors..........................74
8.1.4.2 Noise filter.................................................74
8.1.5 Reset state..........................................................74
8.2 Connectors J2/J3...............................................74
8.3 API functions....................................................75
8.3.1 S826_DioOutputWrite.......................................75
8.3.2 S826_DioOutputRead........................................76
8.3.3 S826_DioInputRead...........................................76
8.3.4 S826_DioSafeWrite...........................................77
8.3.5 S826_DioSafeRead............................................77
8.3.6 S826_DioSafeEnablesWrite..............................77
8.3.7 S826_DioSafeEnablesRead...............................78
8.3.8 S826_DioCapEnablesWrite...............................78
8.3.9 S826_DioCapEnablesRead................................79
8.3.10 S826_DioCapRead...........................................79
8.3.11 S826_DioWaitCancel......................................81
8.3.12 S826_DioOutputSourceWrite..........................81
8.3.13 S826_DioOutputSourceRead...........................82
8.3.14 S826_DioFilterWrite........................................83
8.3.15 S826_DioFilterRead........................................83
8.4 Application notes..............................................84
8.4.1 Basic operation...................................................84
8.4.2 Waiting for stable outputs..................................84
8.4.3 Debouncing inputs.............................................84
8.4.4 Setting and clearing DIOs..................................85
8.4.5 Edge detection....................................................85
Chapter 9: Watchdog timer............................86
9.1 Introduction.......................................................86
9.1.1 Operation............................................................86
9.1.2 Reset Out circuit................................................87
9.1.3 Initialization.......................................................87
9.2 Connector P2.....................................................87
9.3 API functions....................................................87
9.3.1 S826_WatchdogConfigWrite.............................87
9.3.2 S826_WatchdogConfigRead..............................88
9.3.3 S826_WatchdogEnableWrite.............................89
9.3.4 S826_WatchdogEnableRead..............................89
9.3.5 S826_WatchdogStatusRead...............................89
9.3.6 S826_WatchdogKick.........................................90
9.3.7 S826_WatchdogEventWait................................90
9.3.8 S826_WatchdogWaitCancel..............................91
9.4 Application notes..............................................91
9.4.1 Kicking the watchdog........................................91
9.4.2 Activating safemode with the watchdog............92
9.4.3 Output watchdog on a DIO................................92
Chapter 10: Safemode controller....................94
10.1 Introduction.....................................................94
10.1.1 Write protection...............................................94
10.2 API functions..................................................95
10.2.1 S826_SafeControlWrite...................................95
S826 Instruction Manual ii Table of Contents