# Custom photodiode symbol in LTSpice 'syntax error in transmission line statement: ".."'

I want to simulate different opamps for use in the transimpedance amplification stage in a position sensing device (PSD) photodiode.

The equivalent circuit for the PSD photodiode is saved in psd.asc.

The transimpedance amplification schematic is saved in opamp.asc.

From the standard library I copied diode.asy and added the two light arrows. Furthermore I adjusted the input and output labels and changed the prefix, name letter from D to P.

I was able to select psd as a component in opamp.asc. However when I want to run some transient analysis I get the error message:

Syntax error in coupled transmission line statement: "p1 n0001 0 pd"

I configured the current source in psd.asc to emulate a triangle current response if it matters.

The corresponding LTSpice files are available as Gist.

• I don't think you can just change the prefix however you want. SPICE gives a special meaning to each prefix, and it's not really open to change. Feb 23, 2019 at 15:18
• P is apparently the prefix for a transmission line, so when you use P it thinks you're trying to define a transmission line rather than a diode. Feb 23, 2019 at 15:19
• @ThePhoton you are right. I changed P back to D and now the simulation runs. However voltages and currents are constant. The pulse modulation of the current generator inside the photodiode seems to be disabled. Feb 23, 2019 at 15:24
• You need to use X for a subcircuit model. There are tutorials out there on how to do it. Feb 23, 2019 at 15:28
• I had to remove every SYMATTR command in psd.asy and change SymbolType CELL to SymbolType BLOCK. Can you put this together in an answer? Feb 23, 2019 at 15:34

## 1 Answer

You aren't allowed to change the prefix letter of a component however you like. Each prefix letter is hard-coded to create a certain type of component, and you can't change that. For example, all diodes must start with "D", and all resistors must start with "R".

By changing the prefix to "P" you told LTSpice that you're placing a transmission line in your circuit, rather than a diode.

But actually, your model is a subcircuit, rather than a single diode. So you must use the "X" prefix rather than "D".

For a more general tutorial on creating subcircuit models and inserting them into other designs, see this old question: How to make LTSpice sub-circuits available globally?.