Programming
Chapter 4
PC-TIO-10 User Manual
4-10
© National Instruments Corporation
Programming Considerations for the Am9513A STCs
Before using the Am9513A STC devices, you must initialize them. To do this, perform the
following steps on each of the Am9513A STC devices. All writes are 8-bit write operations. All
values are given in hexadecimal.
1. Issue a master reset by writing FF to the Am9513A Command Register.
2. Initialize all five counters. For ctr = 1 to 5, follow these steps:
•
Write ctr to the Am9513A Command Register (select the Counter Mode Register).
•
Write 00 to the Am9513A Data Register (store the least significant byte of the counter
mode value).
•
Write 00 to the Am9513A Data Register (store the most significant byte of the counter
mode value).
•
Write ctr + 8 to the Am9513A Command Register (select the Counter Load Register).
•
Write 03 to the Am9513A Data Register (store the least significant byte of the counter
load value).
•
Write 00 to the Am9513A Data Register (store the most significant byte of the counter
load value).
3. Load all counters with their Counter Load Register values by writing 5F to the Am9513A
Command Register.
Note: When you initialize Am9513A STC B, which contains Counters 6 through 10, ctr must
range from 1 to 5, not from 6 to 10. Also, each Am9513A STC must always be
configured to use the 8-bit bus mode in order to function properly.
Programming Example for the Am9513A STCs
The code below lists a sample function that can be used to reset the Am9513A STCs on the
PC-TIO-10. In addition, the code lists a sample function that can be used to generate a variable
duty-cycle square-wave.
/* miscellaneous definitions */
#define cmd_port 0x0001
#define data_port 0x0000
#define no_err 0
#define range_err -1
#define stc_a 0x0000
#define stc_b 0x0002
#define tio_ba 0x01a0
/* function prototypes */
Summary of Contents for PC-TIO-10
Page 57: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 2 National Instruments Corporation ...
Page 58: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 3 PC TIO 10 User Manual ...
Page 59: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 4 National Instruments Corporation ...
Page 60: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 5 PC TIO 10 User Manual ...
Page 61: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 6 National Instruments Corporation ...
Page 62: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 7 PC TIO 10 User Manual ...
Page 63: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 8 National Instruments Corporation ...
Page 64: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 9 PC TIO 10 User Manual ...
Page 65: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 10 National Instruments Corporation ...
Page 66: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 11 PC TIO 10 User Manual ...
Page 67: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 12 National Instruments Corporation ...
Page 68: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 13 PC TIO 10 User Manual ...
Page 69: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 14 National Instruments Corporation ...
Page 70: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 15 PC TIO 10 User Manual ...
Page 71: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 16 National Instruments Corporation ...
Page 72: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 17 PC TIO 10 User Manual ...
Page 73: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 18 National Instruments Corporation ...
Page 74: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 19 PC TIO 10 User Manual ...
Page 75: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 20 National Instruments Corporation ...
Page 76: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 21 PC TIO 10 User Manual ...
Page 77: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 22 National Instruments Corporation ...
Page 78: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 23 PC TIO 10 User Manual ...
Page 79: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 24 National Instruments Corporation ...
Page 80: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 25 PC TIO 10 User Manual ...
Page 81: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 26 National Instruments Corporation ...
Page 82: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 27 PC TIO 10 User Manual ...
Page 83: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 28 National Instruments Corporation ...
Page 84: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 29 PC TIO 10 User Manual ...
Page 85: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 30 National Instruments Corporation ...
Page 86: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 31 PC TIO 10 User Manual ...
Page 87: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 32 National Instruments Corporation ...
Page 88: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 33 PC TIO 10 User Manual ...
Page 89: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 34 National Instruments Corporation ...
Page 90: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 35 PC TIO 10 User Manual ...
Page 91: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 36 National Instruments Corporation ...
Page 92: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 37 PC TIO 10 User Manual ...
Page 93: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 38 National Instruments Corporation ...
Page 94: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 39 PC TIO 10 User Manual ...