Confusion in feedback for switchmode dc/dc converter

I have a slight confusion in how the feedback pin works. The "$V_{ref} \times (1 + R_1 / R_2)$" seems like a shortcut to me, and I have trouble understanding how to feed a voltage in to it, to say make a tracking pre-regulator to always maintain +2 volts.

The circuit I am designing starts fairly simple, it looks roughly like this:

From what I understand, you have 5V running past D1 and feeding 5V in to the resistive divider (at very start), making $$\frac{10k}{84.5k+10k}\times5V=0.52V$$

That is fed in to the error amplifier, of which the reference voltage from datasheet I assume is 1.265V

And so it tries to bring 0.52->1.265V, making $$5V\times\frac{1.265}{0.52}=12V$$

The above is new to me and I had discovered the correlation while writing it. Is that how the error amplifier works?

If I want say...7V, I would cause the voltage to the FB pin to be (7/5) times lower than 1.265V so it will work itself up to 7V as my formula above? (excuse that math if minor mistake, but more or less using the difference in FB and Vref to multiply the input voltage).

-
Leave the 5V out of your figurings - it is confusing you unnecessarily. 5V is only trelevant because an exmaple had Vout = 5V but it has no real relationship to operation at other voltages. What matters is Vfb and the feedback resistor divide ratio. | The FB pin is maintained AT the FB voltage set by the IC. You divide the output and apply the result to the FB pin to control Vout. If the divider divides by N:1 then Vout will be Vfb x N. So eg a 10k:1K divider divides by (10k+1k)/1k = 11:1 so Vout would be Vfb x 11 = 1.265 x 11 = 13.915 volt etc. –  Russell McMahon Aug 23 '12 at 1:52

Yes, that's how the error amplifier works - the regulator tries to keep the voltage at the FB pin at Vref (1.265V in your case) through the voltage divider.
Basically to set the output to 7V, you need a divider ratio of (7V / 1.265V) - 1 = 4.53:1, so for instance 1k for the bottom resistor and 4.53k for the top resistor (the actual division is 5.53, so 7 / 5.53 = 1.265)

If you want a tracking preregulator though, you cannot just supply a certain voltage to the FB pin to control the output voltage, as the regulator needs to be able to "find" the 1.265V again by setting it's output accordingly. You have broken the FB loop if you supply a voltage directly, and the switching will either be on or off permanently.
You need to do something like apply a scaling voltage to the bottom of the resistor divider as shown here:

To take our above 7V and the 1k:4.53k divider as an example of how it works, say we now set the bottom of the divider to -1V instead of 0V. We would now get (5.53 * (1.265V + 1V) - 1 = 11.53V at the output (we add the 1V as the bottom resistor now needs 2.265V across it for the FB pin to see 1.265V)

-
No, the resistor divider won't see the 5 V from the input, but the output voltage. Since the regulator has an error amplifier which compares the input at the $V_{FB}$ with the 1.265 V reference, and will keep them equal we get
$V_{OUT} = \dfrac{10 k\Omega + 84.5k\Omega}{10 k\Omega} \cdot V_{REF} = \dfrac{10 k\Omega + 84.5k\Omega}{10 k\Omega} \cdot 1.265 V= 11.95 V$