microchip-pic-avr-examples/avr128db48-constant-current-driver-using-opamp-mplab-mcc
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.
CNOASSERTION