2014-01-01 21:28:59 +01:00
|
|
|
/*
|
|
|
|
* bjt.c
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "netlist/devices/net_lib.h"
|
|
|
|
|
|
|
|
NETLIST_START(bjt)
|
|
|
|
/* Standard stuff */
|
|
|
|
|
2014-02-23 15:57:24 +01:00
|
|
|
CLOCK(clk, 1000) // 1000 Hz
|
|
|
|
SOLVER(Solver, 48000)
|
2014-01-19 16:51:25 +01:00
|
|
|
ANALOG_INPUT(V5, 5)
|
|
|
|
ANALOG_INPUT(V3, 3.5)
|
2014-01-01 21:28:59 +01:00
|
|
|
|
|
|
|
/* NPN - example */
|
|
|
|
|
2014-01-19 16:51:25 +01:00
|
|
|
QBJT_SW(Q, "BC237B")
|
|
|
|
RES(RB, 1000)
|
|
|
|
RES(RC, 1000)
|
2014-01-01 21:28:59 +01:00
|
|
|
|
|
|
|
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 */
|
|
|
|
|
2014-01-19 16:51:25 +01:00
|
|
|
QBJT_SW(Q1, "BC556B")
|
|
|
|
RES(RB1, 1000)
|
|
|
|
RES(RC1, 1000)
|
2014-01-01 21:28:59 +01:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
2014-01-19 16:51:25 +01:00
|
|
|
LOG(logB, Q.B)
|
|
|
|
LOG(logC, Q.C)
|
2014-01-01 21:28:59 +01:00
|
|
|
|
|
|
|
NETLIST_END()
|