在控制寄存器TMRCTRL中当计数模式CM设置为100, PCS选择一个输入管脚为A相脉冲输入, SCS选择选择另一个输入管脚为B相脉冲输入,○NCE选择为0(重复计数), LENGTH = 0, DIR = 0. OM =0, 计数器将初级和次级外部输入信号作为积分编码信号进行解码,提供了计数和方向信息。英文手册13-9和13-10页给了详细介绍。
• Set the Control (CTRL) register PCS bits to 0000
• Set the Control (CTRL) register SCS bits to 01
• Clear the Status and Control (SCTRL) register
• Set the Counter (CNTR) register to 0x0000
• Set the Load (LOAD) register to 0x0000
• Set the Compare 1 (COMP1) register to 0xFFFF
• Set the Compare 2 (COMP2) register to 0x0000
• Clear the Comparator Status and Control (CSCTRL) register
• Set the Control (CTRL) register CM bits to 100