Searching \ for '[EE] Java to applet for web site.' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=java+applet+web
Search entire site for: 'Java to applet for web site.'.

Exact match. Not showing close matches.
PICList Thread
'[EE] Java to applet for web site.'
2007\07\23@034635 by James Newton

flavicon
face
I've recently been using a GPL Java program to satisfy my 10 year olds
appetite for understand how computers works by teaching him digital logic.
The program is "LogicSim" by Andreas Tetzl
http://www.tetzl.de/java_logic_simulator.html

It has some serious quirks, but so far they have all been surmountable. All
in all, it's an excellent program for learning or teaching digital logic.

After a few weeks, we have built up a collection of modules and
demonstration circuits that are quite nice. Tonight, we did a 4 bit ALU with
negation, addition, and shift right and left. The "wait a minute, you can
multiply and divide by two by just rearranging wires?" question was
priceless.

I can see how an entire course could be set up from a web site using lessons
and examples with this program, but I believe it would be best served by an
applet rather than a downloadable standalone program. So the question is:

Is there anyone out there who would be interested in attempted to make an
applet version of this program? If so, I will expand the content I have
already created into a full course in digital logic from the very basics to
at least the level of a simple ALU and all the way into a small 4 bit uC if
the program can handle that level of complexity.

---
James Newton: PICList webmaster/Admin
spam_OUTjamesnewtonTakeThisOuTspampiclist.com  1-619-652-0593 phone
http://www.piclist.com/member/JMN-EFP-786
PIC/PICList FAQ: http://www.piclist.com


2007\07\23@133125 by Joshua Shriver

picon face
Nice link! I'd love to see a course around this kind of application.
As a beginner it would be a lot easier to learn via a simulator than
dishing out $$ for parts.

-Josh

On 7/23/07, James Newton <.....jnKILLspamspam@spam@efplus.com> wrote:
{Quote hidden}

> -

2007\07\23@211852 by Timothy J. Weber

face picon face
> I've recently been using a GPL Java program to satisfy my 10 year olds
> appetite for understand how computers works by teaching him digital logic.
> The program is "LogicSim" by Andreas Tetzl
> http://www.tetzl.de/java_logic_simulator.html

> Is there anyone out there who would be interested in attempted to make an
> applet version of this program? If so, I will expand the content I have
> already created into a full course in digital logic from the very basics to
> at least the level of a simple ALU and all the way into a small 4 bit uC if
> the program can handle that level of complexity.

You might also like to look at _The Elements of Computing Systems:
Building a Modern Computer from First Principles_ by Nisan and Schocken,
Amazon <http://tinyurl.com/2hjgzz>.  They have a Java-based simulator -
also an app, not an applet, if I recall correctly - and have done all
the work in making the course.
--
Timothy J. Weber
http://timothyweber.org

2007\07\24@001412 by James Newtons Massmind

face picon face
{Quote hidden}

A very nice book and software, very powerful and complete, but JUST a bit
over the head of a 10 year old, even one as brilliant as mine. <grin>

LogicSim is, even with a quirky interface, much easier to use and
understand.

It also doesn't make sense to me that people should have to download a
complete computer program just to interact with a digital logic gate on the
screen. I've wanted something small and simple to show logic working for
years, but will probably never have the time (assuming I have the ability)
to write it myself.

Any Java applet people out there? It wouldn't even need to include the part
of the program that authors circuits, just the part that simulates them.

---
James.


2007\07\24@141538 by Hector Martin

flavicon
face
I've come to like logisim (no 'c' in there). It's also java based, and
it's fast enough to simulate an entire CPU at a few instructions per second.

For some reason, the site is down.
http://ozark.hendrix.edu/~burch/logisim/

Here's the sourceforge page, though:
http://sourceforge.net/projects/circuit/

I used it to implement an entire PIC-alike CPU in 74xx chips once (which
I may end up building out of physical chips sometime). My version uses a
slightly different 16-bit opcode format instead of 14-bit, with 8-bit
RAM addresses, and I didn't bother to implement a stack, but it is
otherwise almost identical to a 14-bit PIC core as far as I know. There
are no registers or peripherals implemented yet though (including the
all-important STATUS).

marcansoft.com/uploads/images/pic_cpu1.png
marcansoft.com/uploads/images/pic_cpu2.png
marcansoft.com/uploads/images/pic_cpu3.png
http://marcansoft.com/uploads/images/pic_cpu4.png

Note that the "microcode" really isn't - it's just a table-based
instruction decoder (there is no sequencing going on there). Instruction
time is Fosc/8, though it could easily be changed to Fosc/4 (I was too
lazy to debug some glitch issues on the clock sequencer). No pipelining
going on either, unlike on a real PIC.

By the way, the 74xx chips you see are actually implemented in terms of
gates, using the schematics found in the datasheets (74LS181 was a pain!
And I still don't know how it works.). Even so, logisim manages to
simulate the entire thing at a very reasonable rate.

--
Hector Martin (.....hectorKILLspamspam.....marcansoft.com)
Public Key: http://www.marcansoft.com/marcan.asc

2007\07\24@184619 by James Newtons Massmind

face picon face
Wow.

Thanks!

---
James.



{Quote hidden}

> -

2007\07\24@203631 by Hector Martin

flavicon
face
Here's the data file if you want to check it out :)
http://marcansoft.com/uploads/piccpu.circ

And here's the microcode "source code". This gets turned into a ROM
mapping the top 8 instruction bits to 16 control lines by a small Python
script. Only 13 control lines are used so far.
marcansoft.com/uploads/pic_cpu_ucode.txt
The hex microcodecode ROM data is already in the .circ file above. The
sample program ROM just runs a basic loop, using decfsz.

Note that I've basically tacked on two bits into the middle of the
standard 14-bit instruction word. For instructions that take an f-reg,
one bit is used as an extra addressing bit (this is part of the lower
word, not mapped into the microcode). For instructions that take an
8-bit literal, this is just a don't care (though it's inserted at a
different spot in the instruction word - here, the full lower word is
the literal, and the upper word has two don't care bits). The other bit
is unused in both of these cases. With instructions that load the PC,
these bits are used to provide 12-bit immediate PC addressing. The
opcodes are otherwise the same. This should make it fairly trivial to
write a converter to change a PIC hex file into this variation.

I've found that 181 ALUs are very flexible. Though they're pretty
cryptic to work with, they can implement almost every PIC ALU
instruction with no extra work. Only rrf needs an external mux to deal
with the rotation (rlf is just f+f, which the 181 ALU can do). A 3-to-8
decoder hooked up to the ALU input takes care of the b*f/btfs*
instructions as well. I haven't done swapf, since it would involve
another output MUX like rrf, and it isn't really used all that often.

Hope you find some use for it! I've found watching a "PIC" run through
code and seeing every signal to be pretty entertaining and educational,
if nothing else. I've showed it to other non-engineers, and they do get
a quick idea of the linear, step-based nature of sequential logic
systems like CPUs, just by watching the lines flicker on and off as the
PC steps through the code.

--
Hector Martin (KILLspamhectorKILLspamspammarcansoft.com)
Public Key: http://www.marcansoft.com/marcan.asc

2007\07\30@202747 by peter green

flavicon
face

> Any Java applet people out there? It wouldn't even need to include the part
> of the program that authors circuits, just the part that simulates them.
>
>  
Applets aren't too different from apps, basically the main differences
are you are working inside and existing window rather than creating a
new one and you are subject to a load of security restrictions.  If the
app is pure java and you have the source and you have some experiance
writing java the conversion shouldn't be too hard.


2007\07\30@213539 by James Newtons Massmind

face picon face
> > Any Java applet people out there? It wouldn't even need to
> include the
> > part of the program that authors circuits, just the part
> that simulates them.
> >
> >  
> Applets aren't too different from apps, basically the main
> differences are you are working inside and existing window
> rather than creating a new one and you are subject to a load
> of security restrictions.  If the app is pure java and you
> have the source and you have some experience writing java the
> conversion shouldn't be too hard.


"and you have some experience writing java" is the sticking point.

The source is GPL, and the program (LogicSim) is a lot less complex than the
more powerful program (LogiSim, note the missing "c") and so ideal for the
idea of a web site based Digital Logic introduction course, but a Java
programmer willing to spend the time on it would be required.

So far we have made a ton of circuits in it, almost enough to make a simple
microcontroller, including a programmable counter (I had forgotten how
complex that is!), ALU (4 functions: Add, Neg, Shift left and right), RAM
memory (8 nibbles!), Latches, Bus, Keyboard decoder, 7-Segment decoder, and
so on. All made with basic logic gates: NOT, AND, and OR in combinations.
These are then made into modules that are at the level of JK flip flops,
MUXs, binary-decimal decode/encode and those modules are used to make the
large modules. Pretty soon, we will try to take the large modules and make a
computer, first I want to make some "automatic" circuits like something that
increments a register by the value of another register. All of this is at a
maximum width of 4 bits so you can still see all the individual wires on the
screen without breaking your eyes.

---
James.


2007\07\31@085222 by Gerhard Fiedler

picon face
James Newtons Massmind wrote:

>> Applets aren't too different from apps, basically the main differences
>> are you are working inside and existing window rather than creating a
>> new one and you are subject to a load of security restrictions.  If the
>> app is pure java and you have the source and you have some experience
>> writing java the conversion shouldn't be too hard.
>
> "and you have some experience writing java" is the sticking point.
>
> The source is GPL, and the program (LogicSim) is a lot less complex than
> the more powerful program (LogiSim, note the missing "c") and so ideal
> for the idea of a web site based Digital Logic introduction course, but
> a Java programmer willing to spend the time on it would be required.

I did some Java, but I'm really swamped. You may get away with very simple
changes that you probably can do yourself (like here
<http://help.avs.com/OpenViz/deployment/elements/java/applet/applet.html>).

Possible problem areas however are anything that interfaces with storage,
especially when it requires write access (like loading and saving your
designs), because an applet runs in the protected browser environment and
has no direct local disk access.

OTOH you may consider what they say here about Java Web Start
<http://java.sun.com/docs/books/tutorial/deployment/applet/>. When you run
an applet in a page, you have to first download it. This is not any faster
nor much different from downloading the Java application.

I'm not sure what exactly the problem is you're trying to solve with the
conversion to an applet. Running a Java app can be as simple as downloading
the jar file and double-clicking on it, and you're done with it.

Gerhard

2007\07\31@130337 by James Newton, Host

face picon face
> I'm not sure what exactly the problem is you're trying to
> solve with the conversion to an applet. Running a Java app
> can be as simple as downloading the jar file and
> double-clicking on it, and you're done with it.

The issue is one of presentation. I don't want to type volumes of
explanatory text into the circuit design as text labels. And I would like
each of the samples to accompany the text in the web page. "As you can see
in the applet window below, the counter is formed from three JK flip flops
and their binary output is decoded to sequential (decimal) wires to enable
each of the different operations required in the processor in the proper
order."

In addition to the text, I want to include pictures of the real chips that
are being used in the circuit, links to sources and other web sites, and to
the next lesson or sample circuit.

I could take the hours required to produce GIF animations of the circuits
operating, but that would remove any user interaction. "press the button
labeled "Clock" to see the counter advance to the next value."

And it would be interesting to allow the user to modify or set up circuits
along the way. "What would happen if the circuit were changed to connect the
inverted clock signal to the first stage and the non-inverted clock to the
second stage? Try it and see: Just click on the wire from the clock to the
first stage and the inverter to the second stage and delete them. Then draw
new wires connecting the clock to the second stage and the inverter to the
first stage. Start the simulation and try the new circuit. Do you see the
difference?"

A student coming to the web page could instantly start learning about logic
circuits and see them operating, interact with them and change them with
guidance from the web site.

---
James Newton: PICList webmaster/Admin
RemoveMEjamesnewtonTakeThisOuTspampiclist.com  1-619-652-0593 phone
http://www.piclist.com/member/JMN-EFP-786
PIC/PICList FAQ: http://www.piclist.com



'[EE] Java to applet for web site.'
2007\08\01@081610 by Gerhard Fiedler
picon face
James Newton, Host wrote:

>> I'm not sure what exactly the problem is you're trying to solve with the
>> conversion to an applet. Running a Java app can be as simple as
>> downloading the jar file and double-clicking on it, and you're done
>> with it.
>
> The issue is one of presentation. I don't want to type volumes of
> explanatory text into the circuit design as text labels. And I would
> like each of the samples to accompany the text in the web page. "As you
> can see in the applet window below, the counter is formed from three JK
> flip flops and their binary output is decoded to sequential (decimal)
> wires to enable each of the different operations required in the
> processor in the proper order."

In that case, it seems you don't want the applet to necessarily allow
loading and saving arbitrary files. Loading files from the server would be
enough, and saving is not necessary. You could just take the source, follow
the few simple steps in that link I sent and see whether it works.
Depending on the app it just might... (The app supporting loading a
simulation file through the command line helps.)


Alternatively...

> In addition to the text, I want to include pictures of the real chips that
> are being used in the circuit, links to sources and other web sites, and to
> the next lesson or sample circuit.
>
> I could take the hours required to produce GIF animations of the circuits
> operating, but that would remove any user interaction. "press the button
> labeled "Clock" to see the counter advance to the next value."

You could make the page, with the text and pictures you would put there,
but instead of the applet there is a link to the simulation file that the
user is supposed to load in the app. After loading that file into the app,
they have basically the same thing: they see what you're talking about
live, but instead of it being in the same window, it is in a different
window. Which, from a user POV, may be an advantage. It is easier to
Alt-Tab back and forth between the app and the browser than it is to scroll
up and down all the time between the text and the applet.

Just as assurance for the doubtful that they have done the right thing and
loaded the correct simulation file you can include a simple screen shot,
without any interactivity. Serves also as teaser ("oh, looks cool, let me
try this"), and is not really much work (compared to setting all the rest
up).

> And it would be interesting to allow the user to modify or set up circuits
> along the way. "What would happen if the circuit were changed to connect the
> inverted clock signal to the first stage and the non-inverted clock to the
> second stage? Try it and see: Just click on the wire from the clock to the
> first stage and the inverter to the second stage and delete them. Then draw
> new wires connecting the clock to the second stage and the inverter to the
> first stage. Start the simulation and try the new circuit. Do you see the
> difference?"

Would still work, and much easier as the app doesn't have the headaches of
the applet when saving files locally.

> A student coming to the web page could instantly start learning about logic
> circuits and see them operating, interact with them and change them with
> guidance from the web site.

It would be a little bit less instant ("You need to download this .jar file
and double-click on it to run the application. Then you load this circuit
file"), but I think the difference is not that big.

In any case, it's something that could get this started even if the applet
thing doesn't work. And it is structured the exact same way, so if at some
point you decide to replace the screen shots with applets, not much else
changes.

Gerhard

More... (looser matching)
- Last day of these posts
- In 2007 , 2008 only
- Today
- New search...