mame/nl_examples/ne555_astable.c
Couriersud a8a62c3212 Enhanced the netlist parser and cleaned pong.c. Also added a folder nl_examples which contains standalone netlist examples. [couriersud]
The examples have a ".c" suffix. In eclipse, I get automatic syntax parsing and error notifications. The parser treats "#" preprocessor defines/includes just as comments.

All of these examples can be run through nltool:

./nltool -f nl_examples/opamp.c -t 1 -l OUT

runs the opamp example for 1 second of emulation time and logs the terminal named "OUT" to "netlist_log_OUT.log".

I'll post a simple script to the list to visualize those logs using gnuplot.
2013-12-31 15:35:08 +00:00

49 lines
760 B
C

/*
* ne555_astable.c
*
*/
#include "netlist/devices/net_lib.h"
NETLIST_START(ne555_astable)
/*
* Astable ne555
*
*/
/* Standard stuff */
NETDEV_SOLVER(Solver)
NETDEV_PARAM(Solver.FREQ, 48000)
NETDEV_ANALOG_CONST(V5, 5) // 5V
/* Wiring up the ne555 */
// astable NE555, 1.13 ms period
NETDEV_R(RA, 5000)
NETDEV_R(RB, 3000)
NETDEV_C(C, 0.15e-6)
NETDEV_NE555(555)
NET_C(GND, 555.GND)
NET_C(V5, 555.VCC)
NET_C(V5, 555.RESET)
NET_C(RA.1, 555.VCC)
NET_C(RA.2, 555.DISCH)
NET_C(RB.1, 555.DISCH)
NET_C(RB.2, 555.TRIG)
NET_C(RB.2, 555.THRESH)
NET_C(555.TRIG, C.1)
NET_C(C.2, GND)
NETDEV_LOG(log2, C.1)
NETDEV_LOG(log3, 555.OUT)
NETLIST_END()