So here's what I did. I created three modules, fab.php, scope.php and transistor.php. Fab creates/modifies transistors, and scope tests the input and outputs of the pins of our http transistor (oscilloscope, duh). Each site has a sqlite database of the transistors it serves, their configuration, and state.
A typical transistor has three pins: a collector, a base and the emitter. The collector and base are inputs, and the emitter is the output depending on the state of the two inputs. For mine, I just wired this as a logical AND which I'm pretty sure is not really what NPN transistors (for example) perform, but what the heck I'm not a real EE so I can make my base transistor perform the logic I want it to.
The way we change the pin inputs on our transistor is to inform the transistor of the pin's state using transitor.php:
http://mtcc.com/ee/transistor.php?id=1&pin=base&state=1
This tells the base of transistor 1 on mtcc.com that it's state is now a 1. If we want to change it:
http://mtcc.com/ee/transistor.php?id=1&pin=base&state=0
and now it's state is 0. Simple right? The trick here is to wire up a network of transistors like you would with a real circuit. That's where our wire -- http -- comes in. Inside our transistor is an output field which tells our transistor to contact its neighbor (if any, and in reality it should be one to many). If it has a neighbor a change in output state of the emitter causes it to curl:
http://mtcc.com/ee/transistor.php?id=2&pin=base&state=0
Note id=2 which is its neighbor, and the state=0 because our transistor is an AND function and the base is now zero. So when we change our emitter state on id=1 back to 1:
http://mtcc.com/ee/transistor.php?id=1&pin=base&state=1
assuming the collector is already 1, it will then contact id=2's base with state=1 causing id=2's emitter to now read 1!
Here's a diagram of a network I actually implemented:
No comments:
Post a Comment