summaryrefslogtreecommitdiffstatshomepage
path: root/nl_examples
diff options
context:
space:
mode:
author Couriersud <couriersud@users.noreply.github.com>2014-01-01 20:28:59 +0000
committer Couriersud <couriersud@users.noreply.github.com>2014-01-01 20:28:59 +0000
commit3b28221fd3d1e4f4976837380a228c79e30c30c8 (patch)
treee293040c43e6e1aacaba2902b1c5077961ee7f6d /nl_examples
parent1006bc5bd98fca34eb9f0631353e8c9b4e96a41b (diff)
Fixed PNP model and added test netlist (bjt.c) [Couriersud]
Diffstat (limited to 'nl_examples')
-rw-r--r--nl_examples/bjt.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/nl_examples/bjt.c b/nl_examples/bjt.c
new file mode 100644
index 00000000000..0a89303ec9a
--- /dev/null
+++ b/nl_examples/bjt.c
@@ -0,0 +1,46 @@
+/*
+ * bjt.c
+ *
+ */
+
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(bjt)
+ /* Standard stuff */
+
+ NETDEV_CLOCK(clk)
+ NETDEV_PARAM(clk.FREQ, 1000) // 1000 Hz
+ NETDEV_SOLVER(Solver)
+ NETDEV_PARAM(Solver.FREQ, 48000)
+ NETDEV_ANALOG_CONST(V5, 5)
+ NETDEV_ANALOG_CONST(V3, 3.5)
+
+ /* NPN - example */
+
+ NETDEV_QNPN(Q, BC237B)
+ NETDEV_R(RB, 1000)
+ NETDEV_R(RC, 1000)
+
+ NET_C(RC.1, V5)
+ NET_C(RC.2, Q.C)
+ NET_C(RB.1, clk)
+ NET_C(RB.2, Q.B)
+ NET_C(Q.E, GND)
+
+ /* PNP - example */
+
+ NETDEV_QPNP(Q1, BC556B)
+ NETDEV_R(RB1, 1000)
+ NETDEV_R(RC1, 1000)
+
+ NET_C(RC1.1, GND)
+ NET_C(RC1.2, Q1.C)
+ NET_C(RB1.1, clk)
+ NET_C(RB1.2, Q1.B)
+ NET_C(Q1.E, V3)
+
+ //NETDEV_LOG(logB, Q1.B)
+ //NETDEV_LOG(logC, Q1.C)
+
+NETLIST_END()