ASCII schematics from LTSpice

J

Jonathan Kirwan

Guest
I've just posted up an initial web page that includes my short program for
converting LTSpice schematics into ASCII ones:

http://users.easystreet.com/jkirwan/new/LTSpice.html

The included ASCII library file has just a few symbols in it, right now. And I
mean __just a few__!! It has two resistor orientations, 0 and 90, two cap
orientations, 0 and 90, one orientation for 'npn2', one for 'voltage' and that
is IT! It's dead easy to add more, though, with any editor program. I'm going
to work on adding the fuller complement of the more common parts as time
permits, but I thought it was more important to put out something right now and
let folks look and complain and kibitz so that it can be improved quickly before
too much time goes into the library side of things.

Anyway, full source is included (for those with MS VC 1.52C compiler) and there
is a big comment section at the top describing many details.

Jon
 
On Sun, 12 Sep 2004 22:08:16 GMT, Jonathan Kirwan <jkirwan@easystreet.com>
wrote:

I've just posted up an initial web page that includes my short program for
converting LTSpice schematics into ASCII ones:

http://users.easystreet.com/jkirwan/new/LTSpice.html
I've finally managed to add some of the basic ASCII library elements so that
most schematics will look ... about right. If you already have LTSpice you may
want to give it a try. It's still very preliminary and the ASCII symbols aren't
the best for everyone, but it will read okay I think.

The program handles netlist node names, resistors, capacitors, inductors, bjts,
mosfets, diodes, and a voltage source. No B-sources or similar stuff, yet. I
can use any feedback on how things should look and any library enhancements
anyone adds to the library file.

For now, I've just compiled it as a DOS .COM file. In the ZIP it is named
"ASCSCHEM.COM" and the library file is "ASCSCHEM.SYM". But you can move these
two files anywhere in your path and you can also rename them, just so long as
they both have the same name.

To use it, just type (in DOS):

ascschem draft3.asc

which places the ASCII schematic on stdout. Or,

ascschem *.asc

which places all of the schematics onto the same file names but with a .TXT
extension.

etc.

Here's an example from a 2Hz oscillator I had on disk:

Vcc
|
|
|
,-------+------------------+-------+
| | | |
| | | |
| | | |
| | | |
\ \ \ \
/ R4 / R2 / R3 / R5
Vcc \ 6.8meg\ 330k \ 680k \ 6.8Meg
| / / / /
| | | C2 | |
| | | || .033u | |
| | +----||--------------------+
| | | || | |
- | | C3 | |
--- V1 | | || | +-----OUT
- 5 +----------------||--------+ |
--- | | || | |
| | | .033u | |
| | |/c Q1 Q2 c\| |
| '-----| 2N3904 2N3904 |-----'
| |>e e<|
gnd | |
'------+-----------'
|
|
|
\
/ R1
\ 2.7Meg
/
|
|
|
gnd

That was directly created without any hand-intervention on my part from a
schematic I'd placed on disk more than a year ago.

Jon
 
Jonathan Kirwan <jkirwan@easystreet.com> wrote:

On Sun, 12 Sep 2004 22:08:16 GMT, Jonathan Kirwan <jkirwan@easystreet.com
wrote:

I've just posted up an initial web page that includes my short program for
converting LTSpice schematics into ASCII ones:

http://users.easystreet.com/jkirwan/new/LTSpice.html

I've finally managed to add some of the basic ASCII library elements so that
most schematics will look ... about right. If you already have LTSpice you may
want to give it a try. It's still very preliminary and the ASCII symbols aren't
the best for everyone, but it will read okay I think.

The program handles netlist node names, resistors, capacitors, inductors, bjts,
mosfets, diodes, and a voltage source. No B-sources or similar stuff, yet. I
can use any feedback on how things should look and any library enhancements
anyone adds to the library file.

For now, I've just compiled it as a DOS .COM file. In the ZIP it is named
"ASCSCHEM.COM" and the library file is "ASCSCHEM.SYM". But you can move these
two files anywhere in your path and you can also rename them, just so long as
they both have the same name.

To use it, just type (in DOS):

ascschem draft3.asc

which places the ASCII schematic on stdout. Or,

ascschem *.asc

which places all of the schematics onto the same file names but with a .TXT
extension.

etc.

Here's an example from a 2Hz oscillator I had on disk:

Vcc
|
|
|
,-------+------------------+-------+
| | | |
| | | |
| | | |
| | | |
\ \ \ \
/ R4 / R2 / R3 / R5
Vcc \ 6.8meg\ 330k \ 680k \ 6.8Meg
| / / / /
| | | C2 | |
| | | || .033u | |
| | +----||--------------------+
| | | || | |
- | | C3 | |
--- V1 | | || | +-----OUT
- 5 +----------------||--------+ |
--- | | || | |
| | | .033u | |
| | |/c Q1 Q2 c\| |
| '-----| 2N3904 2N3904 |-----'
| |>e e<|
gnd | |
'------+-----------'
|
|
|
\
/ R1
\ 2.7Meg
/
|
|
|
gnd

That was directly created without any hand-intervention on my part from a
schematic I'd placed on disk more than a year ago.

Jon
This looks great, well done!

For a regular LT Spice user who can dash off schematics quickly (as I
can sometimes do in CircuitMaker), your program could prove an
excellent alternative route to an ASCII schematic. Especially for
those like me who find ASCII originals a struggle, even with tools
such as Andy's and Gary's. As you see from my later comments, I've
used your program successfully in several examples, although almost
certainly not in optimum fashion.

Could you clarify a couple of points please. From your web page:
"Without any command line options, the program simply converts its
standard input and writes the results to the standard output."

What exactly is 'its standard input' and 'the standard output'?

Or (probably the same question?) from the above post:
"To use it, just type (in DOS):
ascschem draft3.asc
which places the ASCII schematic on stdout"

What is 'stdout'? Is this some programming or scripting term? (I'm not
a programmer.) Presumably draft3.asc was your specimen LT Spice
output, copied into the ASCSCHEM folder?

-------

Using a Windows XP PC, what I did was copy several ASC files from
C:\Program Files\LTC\SwCADIII\examples\Educational
to the same folder in which I've placed your 3 files, i.e
D:\Program Files\ASCSCHEM

I opened a Command Prompt window (as close to 'DOS' as I understand
Windows XP gets), navigated to your folder. I then entered the command
ascschem Draft2.asc, and hit enter. That gave me a neat result in the
Command window, white on black, which I've copied from that odd source
and pasted below:

DRAFT2.ASC

,-------+-------,
| | |
| | |
| | |
- V1 \ --- C1
--- 1 / R1 --- 1
- \ 2 |
--- / |
| | |
| | |
| | |
| +-------'
| |
GND GND


My next example, NE555.asc was badly chosen, as it gave a result with
235 lines of text, incomprehensible when pasted! Not surprising when I
looked at in LT Spice; it's the 555 internals, not the simple astable
or similar that I'd unthinkingly assumed <g>. So I previewed my next
few examples in LT Spice first. For interest, here are a few more of
my laborious pastes:

ASTABLE.ASC

,---------+----------------------------,
| | |
| | |
| \ \
| / R1 / R2
| \ 2K \ 2K
| / /
| | |
| +----+------- -----+-------+
| | | | |
- V1 | | | |
--- 5 | | | |
- | \ \ |
--- | / R3 / R4 |
| | \ 101K \ 100K |
| | / / |
| ' | | |
| | C1 C2 | |
| | || || | |/c Q1
| -+---||- -||--+-----|
| || || |>e 2N3904
| .01u .01u |
| , |
| | |
| | |
GND GND GND

Presumably diagonal lines are a problem, e.g. top of R4 to right of
C1? (BTW, CircuitMaker can't do them either; my schematic above would
have a sort of Nazi swastika for those two diagonals <g>)

And the 'mirrored' NPN BJT Q2?

Presumably these just await appropriate library entries?

Next, and last:

CLAPP.ASC

,-------------,
' |
|
|
- V1
,--------+----------+---- --- 10.
| | | -
| | | , ---
' | --- C1 | |
| --- 750p| |
| | | |
' | | |
| | GND
, +------+
| | '
| , |
--- C2 | --- C3
--- 50p | --- 750p
| | |
| | | ,
| | | |
| | | |
GND GND GND GND

Several parts seem missing in that one, such as the FET J1, and
inductors L1 and L4. Here's what it looks like in LT Spice:

http://www.terrypin.dial.pipex.com/Images/clapp.gif

After barely a couple of days, I must say I'm mightily impressed. Give
it another week or two and maybe you could come up with a polished
version running under Windows - for CircuitMaker!

--
Terry Pinnell
Hobbyist, West Sussex, UK
 
On Tue, 14 Sep 2004 09:48:30 +0100, Terry Pinnell
<terrypinDELETE@THESEdial.pipex.com> wrote:

snip
This looks great, well done!
Thanks.

For a regular LT Spice user who can dash off schematics quickly (as I
can sometimes do in CircuitMaker), your program could prove an
excellent alternative route to an ASCII schematic. Especially for
those like me who find ASCII originals a struggle, even with tools
such as Andy's and Gary's. As you see from my later comments, I've
used your program successfully in several examples, although almost
certainly not in optimum fashion.

Could you clarify a couple of points please. From your web page:
"Without any command line options, the program simply converts its
standard input and writes the results to the standard output."

What exactly is 'its standard input' and 'the standard output'?
Sorry, Terry. It's "programmer speak." The standard input is usually just the
keyboard. But it can be redirected using "pipes." Rather than try to explain
all that, my recommendation is that if you don't know what it is, don't use it.
It's not really important, most of the time.

Or (probably the same question?) from the above post:
"To use it, just type (in DOS):
ascschem draft3.asc
which places the ASCII schematic on stdout"
No, not the same thing. That actually specifies a file name, which is
different. Here's an example of the first case (using standard input):

type draft3.asc | ascschem

But I don't expect you to follow that one.

What is 'stdout'? Is this some programming or scripting term? (I'm not
a programmer.) Presumably draft3.asc was your specimen LT Spice
output, copied into the ASCSCHEM folder?
It's just the screen, usually. Again, it can be redirected. For example:

type draft3.asc | ascschem | wc

Which would send draft3.asc to ascschem and then take the output of that and
send it to the word-counting program (for what reason, I cannot imagine.)

I'd recommend just realizing that if you type one file name, the output goes to
the screen. If you type two or more or use wildcards, you'll get saved .TXT
files, instead.


-------

Using a Windows XP PC, what I did was copy several ASC files from
C:\Program Files\LTC\SwCADIII\examples\Educational
to the same folder in which I've placed your 3 files, i.e
D:\Program Files\ASCSCHEM
Yes. That's one way to do it.

I opened a Command Prompt window (as close to 'DOS' as I understand
Windows XP gets), navigated to your folder. I then entered the command
ascschem Draft2.asc, and hit enter. That gave me a neat result in the
Command window, white on black, which I've copied from that odd source
and pasted below:

DRAFT2.ASC

,-------+-------,
| | |
| | |
| | |
- V1 \ --- C1
--- 1 / R1 --- 1
- \ 2 |
--- / |
| | |
| | |
| | |
| +-------'
| |
GND GND
Okay. That makes sense.

My next example, NE555.asc was badly chosen, as it gave a result with
235 lines of text, incomprehensible when pasted! Not surprising when I
looked at in LT Spice; it's the 555 internals, not the simple astable
or similar that I'd unthinkingly assumed <g>.
Well, Terry. There remains a big problem, still. This is NOT a finished
product, yet!! Please, please keep that in mind. I've got this VERY TINY
library of just a few basic parts.

By the way, check the site every few days and re-get the stuff, if you want.
I'll try and update the program every so often with new library entries and
perhaps some proram updates, as well. However, keep in mind that while this
remains a serious work-in-progress you may find yourself frustrated. Perhaps it
would be better to wait a month or so, then look, if you want to avoid playing
with a program that lacks so much, just now.

So I previewed my next
few examples in LT Spice first. For interest, here are a few more of
my laborious pastes:

ASTABLE.ASC

,---------+----------------------------,
| | |
| | |
| \ \
| / R1 / R2
| \ 2K \ 2K
| / /
| | |
| +----+------- -----+-------+
| | | | |
- V1 | | | |
--- 5 | | | |
- | \ \ |
--- | / R3 / R4 |
| | \ 101K \ 100K |
| | / / |
| ' | | |
| | C1 C2 | |
| | || || | |/c Q1
| -+---||- -||--+-----|
| || || |>e 2N3904
| .01u .01u |
| , |
| | |
| | |
GND GND GND

Presumably diagonal lines are a problem, e.g. top of R4 to right of
C1? (BTW, CircuitMaker can't do them either; my schematic above would
have a sort of Nazi swastika for those two diagonals <g>)
Actually, what you are seeing is that anytime a library part isn't in the ASCII
library file, nothing appears where it should be. It's just blank space. From
the above, I can see that the library is missing something.

If that was a BJT, but turned around, please just reload down the program again.
I think I fixed that, now, by adding some of the other rotations.

And the 'mirrored' NPN BJT Q2?
Yup. That should work, now.

Presumably these just await appropriate library entries?
Yup. But that particular one is solved, right now. Just reload the program
stuff from the site.

Next, and last:

CLAPP.ASC

,-------------,
' |
|
|
- V1
,--------+----------+---- --- 10.
| | | -
| | | , ---
' | --- C1 | |
| --- 750p| |
| | | |
' | | |
| | GND
, +------+
| | '
| , |
--- C2 | --- C3
--- 50p | --- 750p
| | |
| | | ,
| | | |
| | | |
GND GND GND GND

Several parts seem missing in that one, such as the FET J1, and
inductors L1 and L4. Here's what it looks like in LT Spice:
I've got the MOSFETs and inductors added, now. Try getting the program again.
Sorry to keep saying that, but there it is.

http://www.terrypin.dial.pipex.com/Images/clapp.gif

After barely a couple of days, I must say I'm mightily impressed. Give
it another week or two and maybe you could come up with a polished
version running under Windows - for CircuitMaker!
If only I had a copy of it. Hehe.

Thanks, Terry!
Jon
 
On Tue, 14 Sep 2004 09:48:30 +0100, Terry Pinnell
<terrypinDELETE@THESEdial.pipex.com> wrote:

Presumably diagonal lines are a problem
And yes, they are currently ignored in the program. I specifically exclude
placing them, since I'm not yet sure how to emulate them in ASCII. If something
really nice comes to mind, I'll see about putting it in there. In the meantime,
use nice and neat horizontal and vertical lines. Oh, well.

Jon
 
Jonathan Kirwan <jkirwan@easystreet.com> wrote:

I've got the MOSFETs and inductors added, now. Try getting the program again.
Sorry to keep saying that, but there it is.
Thanks for that comprehensive and prompt reply. Downloaded the latest
version. Clapp.asc now shows inductors, but not the FET.

,-------------,
' |
|
|
-
,--------+----------+---- --- V1
| | | - 10.
| | | , ---
| | --- C1 | |
|( | --- 750p| |
L1 |( | | | |
100u |( | | | |
|( --- | | GND
| D2 / \ +------+
|1N4148 --- | |
| | | |(
--- C2 | --- L4 |(
--- 50p | ---1mH |(
| | | |(
| | | |
| | | |
| | | |
GND GND GND GND

I'll revisit in a week or so.

--
Terry Pinnell
Hobbyist, West Sussex, UK
 
On Tue, 14 Sep 2004 12:53:02 +0100, Terry Pinnell
<terrypinDELETE@THESEdial.pipex.com> wrote:

Jonathan Kirwan <jkirwan@easystreet.com> wrote:

I've got the MOSFETs and inductors added, now. Try getting the program again.
Sorry to keep saying that, but there it is.

Thanks for that comprehensive and prompt reply. Downloaded the latest
version. Clapp.asc now shows inductors, but not the FET.
Ah. Thanks. I've got mosfets in (nmos and pmos) but not the njf or pjf, for
example. (Well, I just added them.)

,-------------,
' |
|
|
-
,--------+----------+---- --- V1
| | | - 10.
| | | , ---
| | --- C1 | |
|( | --- 750p| |
L1 |( | | | |
100u |( | | | |
|( --- | | GND
| D2 / \ +------+
|1N4148 --- | |
| | | |(
--- C2 | --- L4 |(
--- 50p | ---1mH |(
| | | |(
| | | |
| | | |
| | | |
GND GND GND GND

I'll revisit in a week or so.
Makes sense to me!

Jon
 
On Sun, 12 Sep 2004 22:08:16 +0000, Jonathan Kirwan wrote:

I've just posted up an initial web page that includes my short program for
converting LTSpice schematics into ASCII ones:

http://users.easystreet.com/jkirwan/new/LTSpice.html

The included ASCII library file has just a few symbols in it, right now. And I
mean __just a few__!! It has two resistor orientations, 0 and 90, two cap
orientations, 0 and 90, one orientation for 'npn2', one for 'voltage' and that
is IT! It's dead easy to add more, though, with any editor program. I'm going
to work on adding the fuller complement of the more common parts as time
permits, but I thought it was more important to put out something right now and
let folks look and complain and kibitz so that it can be improved quickly before
too much time goes into the library side of things.

Anyway, full source is included (for those with MS VC 1.52C compiler) and there
is a big comment section at the top describing many details.

Jon
Is there any reason it shouldn't compile under linux? If not, I may have a
go to see if it can display the results of the gschem schematic program. I
can't read your site atm, which is why I haven't just done it.

--
http://www.niftybits.ukfsn.org/

remove 'n-u-l-l' to email me. html mail or attachments will go in the spam
bin unless notified with
HTML:
 or [attachment] in the subject line.
 
On Tue, 14 Sep 2004 20:50:27 +0100, andy <news4@earthsong.free-online.co.uk>
wrote:

On Sun, 12 Sep 2004 22:08:16 +0000, Jonathan Kirwan wrote:

I've just posted up an initial web page that includes my short program for
converting LTSpice schematics into ASCII ones:

http://users.easystreet.com/jkirwan/new/LTSpice.html

The included ASCII library file has just a few symbols in it, right now. And I
mean __just a few__!! It has two resistor orientations, 0 and 90, two cap
orientations, 0 and 90, one orientation for 'npn2', one for 'voltage' and that
is IT! It's dead easy to add more, though, with any editor program. I'm going
to work on adding the fuller complement of the more common parts as time
permits, but I thought it was more important to put out something right now and
let folks look and complain and kibitz so that it can be improved quickly before
too much time goes into the library side of things.

Anyway, full source is included (for those with MS VC 1.52C compiler) and there
is a big comment section at the top describing many details.

Jon

Is there any reason it shouldn't compile under linux?
It won't, I'm fairly sure. It uses Microsoft-specific libraries. They aren't
complex ones (for example, _strlwr() is used to lower the case of every
character in a string) but they'd need to be replaced by appropriate functions
in the gnu library.

If not, I may have a
go to see if it can display the results of the gschem schematic program.
Okay. Of course, you'd need to change the parsing process. How hard that will
be will depend a lot on how closely aligned the schematic semantic designs are.

I can't read your site atm, which is why I haven't just done it.
Just try again, I suppose.

If you do take a whack at this, I'd appreciate any feedback on the source code
or the ASCII library layout. All these things are subject to change and
improvements. For example, there is no distinct "node point" designation in the
ASCII library for the parts, with special meaning. Instead, the source code
tries to do "reasonable things" when it sees a dash (-) or vertical bar (|) in
the image and matches it up with wires it sees in the schematic.

Jon
 

Welcome to EDABoard.com

Sponsor

Back
Top