summaryrefslogtreecommitdiffstatshomepage
path: root/nl_examples/bjt_eb.c
diff options
context:
space:
mode:
Diffstat (limited to 'nl_examples/bjt_eb.c')
-rw-r--r--nl_examples/bjt_eb.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/nl_examples/bjt_eb.c b/nl_examples/bjt_eb.c
new file mode 100644
index 00000000000..cff1783edf3
--- /dev/null
+++ b/nl_examples/bjt_eb.c
@@ -0,0 +1,36 @@
+/*
+ * 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_PARAM(Solver.ACCURACY, 1e-4)
+ NETDEV_ANALOG_CONST(V5, 5)
+ NETDEV_ANALOG_CONST(V3, 3.5)
+
+ /* NPN - example */
+
+ NETDEV_QNPN_EB(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.1, V3)
+ NET_C(RB.2, Q.B)
+ NET_C(Q.E, GND)
+
+ NETDEV_LOG(logB, Q.B)
+ NETDEV_LOG(logC, Q.C)
+
+NETLIST_END()