Wednesday, 5 August 2015

spice - LTSPICE - How to create PWM with rise time



A simple PWM circuit is simple to create using LTSPICE, such as:


VIN VSIN 0  SIN(0 1 10 0 0)
VP VTRI 0 PULSE(-1.5 1.5 0 9.998m 1u 1u 10m)
B1 VOUT 0 V=U(V(Vtri)-V(Vsin))*5

But voltage reflection simulations, i need the PWM rising edge to be more realistic, i.e. with a time delay on the rising edge like this:


enter image description here


I have tried using a PULSE, but its frequency and on-time is fixed.


What I need is something that activates a given pulse, or a behavioral voltage source that can create a pulse if a certain condition is true. The pulse has to be as long as the condition is true - as with conventional PWM.


An example of what I have tried, but which caused a syntax error:



enter image description here


The syntax error is that in the B2-element (to the right), cannot use "V1" as voltage output. It has to be 5 (volts) or something.


How to I solve this? I just started using SPICE two days ago, and I bet there is a few tricks I am not aware of yet



Answer



This works for me.


enter image description here


I had to change the prefix to BV for [B]V4. And also use net names; it doesn't seem to take the voltage sources' names in those behavioral expressions.


enter image description here






What I need is something that activates a given pulse, or a behavioral voltage source that can create a pulse if a certain condition is true.



What you seem to actually want however is a PWL triggered ramp like so:


enter image description here


Also what you're describing is not actually called PWM. If you somehow need to modulate the width instead of triggering then see this solution.




Well assuming you only want non-zero rise (as in your graph) but zero fall time, and you want that combined with PWM, then you basically have to combine the above two solutions:


enter image description here


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...