Rev through bore encoder when using brushed motor

Can we use absolute mode when using brushed motor?
Is it directly connect to the front encoder data port which designed for brushless motor?
And how can I get the instance in the code?
I had tried to connect it to roborio DIO, and use DutyCycleEncoder class to access it. But we couldn’t get value from it.
螢幕擷取畫面 2022-02-15 210946
We connected it by this.

So, I want to know if there are another way to use absolute mode under brushed mode.
Thanks for answers

You can connect the A (Blue) and B (Yellow) directly to 2 of the DIO on the RoboRIO. [Please check the color wire on the spec to be sure - Through Bore Encoder - REV Robotics]

If you are going to use the encoder, I would highly recommended reading the Encoder section of the WPILIB docs - Encoders - Software — FIRST Robotics Competition documentation