This MCC based MPLAB X IDE example shows how to use the Analog Signal Conditioning (OPAMP) peripheral to implement a constant-current driver using just one external resistor. The constant current amperage setting can be adjusted using firmware control.