Simulation of lin/log converter gives wrong results

my simulation for a linear to logarithmic converter gives some confusing results - output Vout2 gives somewhere not a million miles away from what it should be although it’s not that correct either, but at least when you zoom in on the trace you can see the shape is something like what you would expect.

the bit i find really confusing, is the output Vout. This is obviously completely incorrect (in the sense its not what happens in real life), the output Vout should be centred around 0. Why the offset?

Unless you have this box checked in the simulator settings, M is interpreted as milli by SPICE because it’s case-insensitive. The typical way is to write meg to specify megaohm. I don’t know if that’s the cause of your issue, but it’s worth mentioning.

If you still have problems, I suggest either uploading your project in a ZIPped folder or giving us a copy/paste of the SPICE netlist text. The screenshot can’t tell us how you set up each component and if you did it correctly.

1 Like

thank i didn’t know that, it does make a difference but the problem is still there - output from Vout is all wrong, despite that the output from vout2 is quite feasibly correct now

project is attached (6.6 KB)

One thing I was able to notice from your netlist is that you haven’t set the “Alternate Node Sequence” for the PNP transistors. The default node order for BJTs is C B E. Since the symbols you used are E B C, you need to put 3 2 1 in for the “Alternate Node Sequence” as shown below:

I still don’t have enough info to run your project, since your SPICE libraries aren’t in your project folder and are somewhere in your Documents folder instead: C:\Users\phili\Documents\_spice models\
That’s normally fine to do, but keep in mind that it screws up portability if you need to send your project to someone else and have them see exactly what you see.

ahh, apologies im just getting used to it. Here is the project with all the spice files in the folder (10.6 KB)

interestingly, the alternate node sequence didn’t make any difference.

In your schematic and netlist, there is no power supply voltage. You will need to add spice voltage sources connected to nodes +12V and -12V.


Great catch. I totally missed that one.

ah OK, I didn’t realise I had to use the SPICE voltage sources. Looks like it’s all working now! thanks