This application note illustrates the different functions of the Programmable Counter Array (PCA) which are available on the 83C51FA and 83C51FB. Included arecookbook samples of code in typical applications to simplify the use of the PCA. Since all the examples are written in assembly language, it is assumed the reader isfamiliar with ASM51. For further information on these products or ASM51 refer to the Embedded Controller Handbook (Vol. I).CONTENTS PAGEPCA OVERVIEW 1PCA TIMER/COUNTER 1COMPARE/CAPTURE MODULES 3CAPTURE MODE 5Measuring Pulse Widths 5Measuring Periods 7Measuring Frequencies 7Measuring Duty Cycles 9Measuring Phase Differences 10Reading the PCA Timer 13COMPARE MODE 13SOFTWARE TIMER 13HIGH SPEED OUTPUT 15WATCHDOG TIMER 18PULSE WIDTH MODULATOR 19CONCLUSION 21APPENDICESA. Test Routines A-1B. Duty Cycle Calculation B-1C. Special Function Registers C-1FIGURES PAGE1. PCA Timer/Counter and Compare/Capture Modules 12. PCA Interrupt 43. PCA Capture Mode 54. Measuring Pulse Width 55. Measuring Period 76. Measuring Frequency 77. Measuring Duty Cycle 98. Measuring Phase Differences 109. Software Timer Mode 1310. High Speed Output Mode 1511. Watchdog Timer Mode 1812. PWM Mode 1913. CCAPnH Varies Duty Cycle 20LISTINGS PAGE1. Measuring Pulse Widths 62. Measuring Frequencies 83. Measuring Duty Cycle 94. Measuring Phase Differences 115. Software Timer 146. High Speed Output (WithoutInterrupt) 157. High Speed Output (With Interrupt) 168. High Speed Output (Single Pulse) 179. Watchdog Timer 1910. PWM 21TABLES PAGE1. PCA Timer/Counter Inputs 22. CMOD values 23. Compare/Capture Mode values 34. PWM Frequencies 20