How was told, I believe R14, R12, C9 is a integrating circuit, since the function is to control by PID and not know what is the rotation value.

RPM range is 3k - 30k (PID controlled).

My thinking is R14, R12, C9 is converting the tach signal to analog, which is then provided to comparator. A0 is comparator input.

// Constants used in setup_comparator() are:

#define A0_A3_A1_A3 0xfff04

#define A0_A3_A1_A2_OUT_ON_A4_A5 0xfcf03

#define A0_A3_A1_A3_OUT_ON_A4_A5 0xbcf05

#define NC_NC_NC_NC 0x0ff07

#define A0_A3_A1_A2 0xfff02

#define A0_A3_NC_NC_OUT_ON_A4 0x9ef01

#define A0_VR_A1_VR 0x3ff06

#define A3_VR_A2_VR 0xcff0e

As Ichan said, I think RPM pulse again reproduced at comparator out (A4). At the same time

**CVref**(A3) used (as feedback) to calculate the error for PID. I see that A3 and A2 connected together. Why it is that?

Seems A2 is an ADC input and taking reference voltage from A3 (CVref). If it is right then I'll try it in the same way. Just don't get about how to configure the comparator in this way.