Make LTSpice report an error

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
I'd like a way to make LTSpice report an error if one of my sub-circuits  
detects an invalid condition. For example, I often simulate a PIC by  
representing it as a sub-circuit that applies signals to its pins in  
accordance with the way I intend to program it. I'd like that  
sub-circuit to check, for example, that it has the correct voltage on  
its power and ground pins, and flag an error if not.

Anyone have a way of doing that?

Sylvia.

Re: Make LTSpice report an error
On 3/30/2017 9:09 PM, Sylvia Else wrote:
Quoted text here. Click to load it

LTspice will report the results of measurements which can contain  
calculations.  If you have a value called "VoltageTooLow" and calculate  
it by dividing by a value which would be exactly zero when your error  
condition occurs, rather than reporting a number it will flag the  
error... I think.  I know I had what look like error reports when my  
measure statements were not able to be executed.

Otherwise you can create a signal that makes an extreme change in  
voltage when the error condition occurs and monitor it on the waveform  
display.  Switches are useful for bounds checking.

--  

Rick C

Re: Make LTSpice report an error
On 31/03/2017 2:53 PM, rickman wrote:
Quoted text here. Click to load it
I had thought of division by zero. It doesn't work. Nor does sqrt(-1).  
Having a signal whose voltage indicates an error is less effective  
because it requires one to remember to check it.

Sylvia.

Re: Make LTSpice report an error
On 3/31/2017 2:32 AM, Sylvia Else wrote:
Quoted text here. Click to load it

I can get it to report that Vcc is not above a threshold.

.MEAS TRAN VccCheck FIND V(Vdd) WHEN V(Vdd)>3.45

Measurement "vcccheck" FAIL'ed

This is a bit backwards, but this will report the voltage if it is above  
the threshold at any time or give the error if it never goes above.

Depending on the nature of your power rail you could check directly for  
a voltage below the threshold.  If it finds it it will report the  
voltage.  If it is *never* below the threshold it will give the error  
message.  If the voltage ramps up or is within spec at any time this  
will not find the improper voltage.

--  

Rick C

Re: Make LTSpice report an error
On Fri, 31 Mar 2017 12:09:52 +1100, Sylvia Else

Quoted text here. Click to load it

Check out Bounding_Circuits.zip on the Device Models & Subcircuits
Page of my website.

That may be of help.
        
                                        ...Jim Thompson
--  
| James E.Thompson                                 |    mens     |
| Analog Innovations                               |     et      |
We've slightly trimmed the long signature. Click to see the full one.

Site Timeline