Using a digital potentiometer in a voltage divider

You need to configure your digital potentiometer as a rheostat. If you connect the wiper with one of the terminals A or B, you will get a variable resistor between the two terminals A and B.

According to the datasheet, the wiper is at B when the digital potentiometer is set to 0, and A at full scale. This means you can choose whether the resistor will be near 0\$\ \Omega\$ or 10 k\$ \Omega\$ when you set the min/max value in software depending if you connect A or B to the wiper. This may make your software routine more convenient.