Potentiometer in LTSPICE XVII

Thread Starter

Mayank_2606

Joined Jun 10, 2020
57
I am trying to create a POT in ltspice xvii, even after following all the steps i am not able to get this to work.
I created a schematic first for the pot, viz. pot.asc and then created a symbol for this file namely, pot.asy.
I even named the attributes and added a spiceline that said
R = 10k and Val = 50.

but as soon as i use this symbol in schematic i am getting a fatal error.
Am i missing something?
 

Attachments

Thread Starter

Mayank_2606

Joined Jun 10, 2020
57
Here's the pot files I use.
Put the .lib file in the sub folder, and the .asy file in the sym folder.
Or perhaps you can use them to determine the error in your files.
So we cannot do this directly via a .asc file?
like the tutorials i followed used a normal schematic file and then created a symbol for it.
It worked for them.

As the only difference i see is that you are using a subcircuit, while i just created a .asc file.
 

crutschow

Joined Mar 14, 2008
34,280
So we cannot do this directly via a .asc file?
Probably, but I'm not sure what you mean by "directly".
If you put the files in the specified libraries, then you can call is up in a .asc schematic, just like any other component.
You many have to close and open LTspice after you do that to make it visible in the parts window.
 

Alec_t

Joined Sep 17, 2013
14,280
But i need to know what is wrong in the way i created the POT
You need to tell Spice that R and Val are parameters. In the model, use curly braces to let Spice know to find the values.
Here's the usual pot model :

* This is the potentiometer
* _____
* 1--|_____|--2
* |
* 3
*
.SUBCKT potentiometer 1 2 3
.param w=limit(wiper,1m,.999)
R0 1 3 {Rtot*(1-w)}
R1 3 2 {Rtot*(w)}
.ENDS

Note that Spice hates zero Ohm resistance, so the limit function is used.
 
Last edited:

eetech00

Joined Jun 8, 2013
3,856
I am trying to create a POT in ltspice xvii, even after following all the steps i am not able to get this to work.
I created a schematic first for the pot, viz. pot.asc and then created a symbol for this file namely, pot.asy.
I even named the attributes and added a spiceline that said
R = 10k and Val = 50.

but as soon as i use this symbol in schematic i am getting a fatal error.
Am i missing something?
Remove ALL attribute values specified in the symbol file.

Then remove the symbol and add the symbol to the schematic, then rht-clk the symbol and add R=10k Val=50 in the params field
 
Last edited:

Thread Starter

Mayank_2606

Joined Jun 10, 2020
57
You need to tell Spice that R and Val are parameters. In the model, use curly braces to let Spice know to find the values.
Here's the usual pot model :

* This is the potentiometer
* _____
* 1--|_____|--2
* |
* 3
*
.SUBCKT potentiometer 1 2 3
.param w=limit(wiper,1m,.999)
R0 1 3 {Rtot*(1-w)}
R1 3 2 {Rtot*(w)}
.ENDS

Note that Spice hates zero Ohm resistance, so the limit function is used.
This is my spice code..
i followed the one they taught on the sparkfun tutorial

* F:\SpicePrograms\pot.asc
R1 1 2 {Ra}
R2 2 3 {Rb}
.param Ra=R*(Val/100)
.param Rb=R*(1-(Val/100))
.backanno
.end

learn.sparkfun.com/tutorials/getting-started-with-ltspice/creating-a-new-model-
the tutorial i was talking about
 
Last edited:

Alec_t

Joined Sep 17, 2013
14,280
Have you remembered to edit the symbol attributes in your .asy file and specified, e.g. R=50 Val=10k in the Value field?
 
Top