• 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.

spice model of lm386 in switchercad

Status
Not open for further replies.

hadoque

New Member
Hi
I'm trying to simulate a circuit with a LM386 with switchercad, and since that IC isn't defined in the programs library, I looked up a spice model on the net. The problem is I cant seem to get the whole thing working. This is what I do:
I saved the spice model in a file called LM.lib in \lib\sub . The file is attached.
I placed a 8 pin din, and entered the following fields:

Prefix: X
InstName: lm386
SpiceLine: .INCLUDE LM.lib

Now, when i try to run the simulation I get the following error:
SPICE Error
Unknown subcircuit called in:
xlm386 n002 n001 n004 0 p001 n003 nc_01 n002 .include lm.lib

what am I doing wrong?
 

Attachments

hadoque

New Member
ok, thanks. The only thing I havent tried in those posts are renaming the file tom LM.sub, instead of .lib, but that didn't do anything...

What exactly does the error message mean? That the file isn't found, or that the file is faulty?
 

eng1

New Member
Use the SPICE directive '.include lm386.sub' (check the filename!) to specify the model. Be sure you've re-started LTSPICE.
 

eng1

New Member
hadoque said:
I thought that was what I was doing with the "SpiceLine" field. If not, could you expain how to do that?
I don't know if that works, but the filename is wrong?

I usually use a SPICE directive (menu 'Edit'->SPICE directive). Type 'include lm386.sub' in the edit box and place the label in the schematic.
 

hadoque

New Member
geez... nothing seems to work. I've tried everything, exactly as it says in the posts. I also tried using another lib-file, just to see if there was something wrong with the one I tried, but the same error message. I wonder if the path isnt found?
 

eng1

New Member
I've just gone through the same steps and the simulation runs with no errors.
The results are quite unexpected though, but this is another issue. (*)

I've tried to cancel the 'include' directive and I've got the error message.

It seems that the program can't find the file in your computer. There must be something wrong with the file name or its extension or paths as you said.



(*)EDIT: I've tried another model that produces the results I expected:
http://www.electro-tech-online.com/threads/spice-model-lm386.23296/


This is my schematic, if it helps:
 

Attachments

Last edited:

hadoque

New Member
Alright!
Now it works. Using the full path to the sub file and realising (thanks to your schematic) that I had put the model name in the wrong field, made it work.

Thanks A LOT for the quick help...
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top