1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

AND gate in LTspice usage?

Discussion in 'General Electronics Chat' started by HeatherM, Nov 25, 2009.

  1. HeatherM

    HeatherM New Member

    Joined:
    Nov 21, 2009
    Messages:
    11
    Likes:
    0
    I'm not sure how to use this AND gate in LTspice can someone assist?

    A1 in the schematic is the spice model its giving for and gate.
     

    Attached Files:

  2. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,259
    Likes:
    961
    Location:
    Loveland, CO USA
    A. Special Functions.

    Symbol names: INV, BUF, AND, OR, XOR, SCHMITT, SCHMTBUF, SCHMTINV, DFLOP, VARISTOR, and MODULATE

    Syntax: Annn n001 n002 n003 n004 n005 n006 n007 n008 <model> [instance parameters]

    These are Linear Technology Corporation's proprietary special function/mixed mode simulation devices. Most of these and their behavior are undocumented as they frequently change with each new set of models available for LTspice. However, here we document some of them because of their general interest.

    INV, BUF, AND, OR, and XOR are generic idealized behavioral gates. All gates are netlisted with eight terminals. These gates require no external power. Current is sourced or sunk from the complementary outputs, terminals 6 and 7, and returned through device common, terminal 8. Terminals 1 through 5 are inputs. Unused inputs and outputs are to be connected to terminal 8. The digital device compiler recognizes that as a flag that that terminal is not used and removes it from the simulation. This leads to the potentially confusing situation where AND gates act differently when an input is grounded or at zero volts. If ground is the gate's common, then the grounded input is not at a logic false condition, but simply not part of the simulation. The reason that these gates are implemented like that is that this allows one device to act as 2-, 3-, 4- or 5- input gates with true, inverted, or complementary output with no simulation speed penalty for unused terminals. That is, the AND device acts as 12 different types of AND gates. The gates default to 0V/1V logic with a logic threshold of .5V, no propagation delay, and a 1Ohm output impedance. Output characteristics are set with these instance parameters:

    Name-----Default-----Description

    Vhigh-----1------ Logic high level

    Vlow------0------ Logic low level

    Trise------0------ Rise time

    Tfall-----Trise---- Fall time

    Tau----- 0----- Output RC time constant

    Cout----- 0-----Output capacitance

    Rout-----1----- Output impedance

    Rhigh----- Rout----- Logic high level impedance

    Rlow----- Rout----- Logic low level impedance

    Note that not all parameters can be specified on the same instance at the same time, e.g., the output characteristics are either a slewing rise time or an RC time constant, not both.

    The propagation delay defaults to zero and is set with instance parameter Td. Input hold time is equal to the propagation delay.

    The input logic threshold defaults to .5*(Vhigh+Vlow) but can be set with the instance parameter Ref. The hold time is equal to the propagation delay.

    The exclusive XOR device has non-standard behavior when more than two inputs are used: The output is true only when exactly one of all inputs is true. Use the associative property of XOR's with multiple XOR devices to implement an XOR block with more than two inputs.

    The Schmitt trigger devices have similar output characteristics as the gates. Their trip points are specified with instance parameters Vt and Vh. The low trip point is Vt-Vh and the high trip point is Vt+Vh.

    The gates and Schmitt trigger devices supply no timestep information to the simulation engine by default. That is, they don't look when they are about to change state and make sure there's a timestep close to either side of the state change. The instance parameter tripdt can be set to stipulate a maximum timestep size the simulator takes across state changes.

    The VARISTOR is a voltage controlled varistor. Its breakdown voltage is set by the voltage between terminals 1 and 2. Its breakdown impedance is specified with the instance parameter rclamp. See the example schematic .\examples\Educational\varistor.asc

    The MODULATE device is a voltage controlled oscillator. See the example schematic .\examples\Educational\PLL.asc. The instantaneous oscillation frequency is set by the voltage on the FM input. The conversion from voltage to frequency is linear and set by the two instance parameters, mark and space. Mark is the frequency when the FM input is at 1V and space is the frequency when the input is at 0V. The amplitude is set by the voltage on the AM input and defaults to 1V if that input is unused(connected to the MODULATE common).

    The schematic capture aspect of LTspice netlists symbols for these devices in a special manner. All unconnected terminals are automatically connected to terminal 8. Also, if terminal 8 is unconnected, then it is connected to node 0.
     
  3. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    ron, I love you, I had no idea there was a varistor model in LTspice =P I've been looking for that feature for almost 2 years =O Obviously I wasn't looking very hard, either that or it's something they added relatively recently.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. zd0702

    zd0702 New Member

    Joined:
    Oct 19, 2011
    Messages:
    2
    Likes:
    0

    Xor gate

    Does anyone know how to get XOR Gate by using LTSpice simulation? I just started learning using Ltspice? It would be very good if someone can upload a xor gate.
    Thanks
     
  6. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,190
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi,
    Goto to this link and sign up.
    http://tech.groups.yahoo.com/group/LTspice/

    It has CD, HC and HCF digital IC models.
     
  7. Mikebits

    Mikebits Well-Known Member

    Joined:
    May 24, 2008
    Messages:
    6,214
    Likes:
    174
    Location:
    San Diego, Ca
    Agree with this, those default gates in Ltspice are just obnoxious. Get the models from Eric's link, you will be glad you did. Only caveat is you need to know lib to put them in, and .include statement. Just got home from a very long day, and too tired, but maybe Big E will explain if you ask nice :)
     
  8. ilia b

    ilia b New Member

    Joined:
    Apr 12, 2016
    Messages:
    1
    Likes:
    0
    Hi, can you please elaborate as to where can I find the models? I could not find them in the yahoo group anywhere.:)
     
  9. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,190
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    • Thanks Thanks x 1
  10. crutschow

    crutschow Well-Known Member Most Helpful Member

    Joined:
    Mar 14, 2008
    Messages:
    10,593
    Likes:
    477
    Location:
    L.A., USA Zulu -8
    ONLINE
    You can also generate a variable resistance by letting a resistor value be a function of time [e.g. R=1+sin(time) which would generate a sinewave variation in resistance from 0 to 2Ω].
    [The simulated time in seconds is automatically substituted for the word time in the equation. For transcendental functions time would be interpreted as radians, thus you would get one cycle every 2pi seconds of simulation time. Of course time can be multiplied by any arbitrary number, thus sin(2*pi*1k*time) would give one cycle per ms or 1kHz].

    The command can include common functions listed under waveform arithmetic in the Help file.

    Note that you must be careful about using a resistive function that would generate negative resistances with time, which will give strange results in the simulation.
    The abs function can be used to prevent it from going negative.
     
    Last edited: Apr 12, 2016
  11. eTech

    eTech Active Member

    Joined:
    Apr 25, 2012
    Messages:
    561
    Likes:
    43
    There is an "A" device XOR gate in the Digital folder of LTspice.
     
  12. eTech

    eTech Active Member

    Joined:
    Apr 25, 2012
    Messages:
    561
    Likes:
    43
    Here is a little demo circuit you can run.
     

    Attached Files:

  13. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,259
    Likes:
    961
    Location:
    Loveland, CO USA
    eTech,
    How do you get 5 plot windows?
     
  14. kinarfi

    kinarfi Well-Known Member

    Joined:
    Jul 7, 2009
    Messages:
    1,504
    Likes:
    30
    Location:
    P. G., Utah, United States of America
    here's an Xor gate I use on my off road vehicle that I changed from having amber turn signals to sharing the brake lights
     

    Attached Files:

  15. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,190
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi Ron,
    Right click on the Plot window [pane] and select 'Add Plot Pane' from the pop up menu.
    To move a plot line from window to window, left mouse key held down on the plot label, then drag to the required window [pane]

    Note: Windows/Tile Vertically will give left/right circuit/plots

    E
     
    • Like Like x 1
    • Informative Informative x 1
  16. eTech

    eTech Active Member

    Joined:
    Apr 25, 2012
    Messages:
    561
    Likes:
    43
    Hi

    Eric explains in #14

    eT
     

Share This Page