# LTSPICE - Changing parameters of a pulsed voltage source

At the moment I'm simulating a basic buck converter circuit and would like to be able to vary the duty cycle given to the circuit by a microcontroller (switching a MOSFET).

I'm simulating the micro using a pulsed voltage source, and I want to vary the tOn parameter but am not sure how. I've tried placing {dutyCyc} in the tOn window, and adding .param dutyCyc=value*time to the circuit, which doesn't work.

I've seen suggestions on stepping through a list of values, but that performed multiple simulations as opposed to a single one with an increasing duty cycle over time.

What am I missing?

• Not quite sure what you really want but you can always use pwl files for arbitrary waveforms Jun 3 '18 at 11:48
• How do you want to vary the tOn parameter? The expression you wrote for dutyCyc has tOn increasing with the simulation time, and it should work. You may need more curly braces. A picture of your pulsed source and .param statement may be helpful. Jun 3 '18 at 17:14
• This may help electronics.stackexchange.com/questions/247396/… Feb 2 '19 at 7:54

The error amplifier is made up of G1, which takes a reference of the output and compares it to the reference, V2 (5V), then forms a 1st order loop filter with C2 and its series resistance. The result is compared against the ramp, V3, with A1 (a Schmitt trigger, but here it has the role of a comparator), then controls the switch (think of it as an idealized FET). Here are some zoomed portions of the error amplifier (V(err), black), the ramp (V(ramp), blue), and the "gate" voltage (V(c), red):