In current regulation mode, we have a sensing resistor … here’s where my brain says no
2ohm 2watt resistor.
Why is it the calculation is based on the internal voltage reference 1.25v and not on the supply voltage?
If the voltage going out was say 12vout (15v in) why is it not 12/2 (6amps) ?
Because the entire purpose of the LM317 in this case is to keep 1.25V across the output and the adjust terminal. It is really just a 1.25V voltage regulator.
In fact, I could use an LM7805 in exactly the same way. Input 20V, Output 5 Ohm resistor to the Ground terminal, Ground terminal to the load.
As long as the load is low enough so that 20V - 5V - 3V(minimum drop across a 7805) >0, it will keep current at a constant 1A. So with a 1 Ohm load, 1V is dropped across the load, 5V across the 5 Ohm current sense resistor, and 20-5-1 = 14V is dropped across the LM7805
With a 10 ohm load, 10V must be dropped across the load. That leaves 10V for the 7805 and current sense resistor, so we’re still within the bounds of regulation. 20-10-5 = 5V dropped across the 7805.
With a dead short, zero volts across the load. 20-5 = 15V dropped across the 7805.
12 Ohm load, 12V dropped across it. 20-12-5 = 3V dropped across the 7805.
Any higher resistance load, and the 7805 has no more headroom, so current will drop. Voltage across the current sense resistor will drop, but voltage across the load will still rise, just not enough to keep current at 1A.