2016-03-05 10:29:28 +01:00
|
|
|
// license:GPL-2.0+
|
|
|
|
// copyright-holders:Couriersud
|
2014-01-06 15:40:43 +01:00
|
|
|
/*
|
|
|
|
* bjt.c
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "netlist/devices/net_lib.h"
|
2014-01-19 16:51:25 +01:00
|
|
|
#include "netlist/analog/nld_twoterm.h"
|
2014-01-06 15:40:43 +01:00
|
|
|
|
|
|
|
NETLIST_START(bjt)
|
|
|
|
/* Standard stuff */
|
|
|
|
|
2014-02-23 15:57:24 +01:00
|
|
|
CLOCK(clk, 10000) // 10000 Hz
|
|
|
|
SOLVER(Solver, 48000)
|
|
|
|
PARAM(Solver.ACCURACY, 1e-6)
|
|
|
|
PARAM(Solver.RESCHED_LOOPS, 30)
|
2014-01-19 16:51:25 +01:00
|
|
|
ANALOG_INPUT(V5, 5)
|
|
|
|
ANALOG_INPUT(V3, 3.5)
|
2014-01-06 15:40:43 +01:00
|
|
|
|
|
|
|
/* NPN - example */
|
|
|
|
|
2014-01-19 16:51:25 +01:00
|
|
|
QBJT_EB(Q, "BC237B")
|
|
|
|
RES(RB, 1000)
|
|
|
|
RES(RC, 1000)
|
2014-01-06 15:40:43 +01:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
2014-01-18 14:58:15 +01:00
|
|
|
// put some load on Q.C
|
|
|
|
|
2014-01-19 16:51:25 +01:00
|
|
|
RES(RCE, 150000)
|
2014-01-18 14:58:15 +01:00
|
|
|
NET_C(RCE.1, Q.C)
|
|
|
|
NET_C(RCE.2, GND)
|
|
|
|
|
2014-02-26 01:21:06 +01:00
|
|
|
//LOG(logB, Q.B)
|
|
|
|
//LOG(logC, Q.C)
|
2014-01-06 15:40:43 +01:00
|
|
|
|
|
|
|
NETLIST_END()
|