The processing procedure in counter mode is showed as the following flow chart.
Please refer to Function
Reference for details of used functions.
And please refer to Sample
Programs of the used language for details of source code.
You can see the detail of each function when you click on the blocks on the flowchart.