I'm trying to use a digital signal (3.3V or 0V) to set a voltage reference for a comparator (4.7V and 6V.)
I've come up with the circuit below but it doesn't seem to be very precise and I can't seem to fine-tune the output for either 4.7V or 6V.
Is there any flaw in the design that wouldn't work in reality?
The comparator used is the MAX9038 if that helps.
Edit: I'm going to edit my question whenever I get some time, thanks for all the help so far already!
Edit2: Below is my full circuit. This circuit is meant to measure the current, compare against ref and limit the current going through the load. It will be used for a flyback power supply I'm designing. The power supply can be upgraded by adding a module which expands its current from 3A to 6A. Without a module this circuit has to protect above 3A, with module it has to be 6A. Since im using the MAX4172 to measure the current aswell i need it to be as precise as possible. The measured current will go into an ADC to a microcontroller. I haven't exactly looked into this yet, but i think to make it as precise as possible i need to get the output of the MAX4172 as close to the supply voltage of the ADC as possible (3.3V). at the moment the R1 resistor sets the output voltage to 3.3V at 6A. So i was thinking that the only way to make this adjustable is to change the ref voltage, is my thinking here correct? If so, what would be the easiest way to make this happen (voltage divider with a MOSFET?)