LTSPICE simulation madness:  XR-2240/ua2240/LM2240 Programmable Counter Timer  - Page 1
Forum section: electronics / projects

author: Ian.M
author_rank: Super Contributor
timestamp: October 28, 2016, 02:36:36 pm
content: I found a Texas Instruments uA2240CN in my 'Odds & Sods' collection while sorting ICs, and was for a short time inspired to actually do something with it. For those unfamiliar with that part, it was originally designed by Exar, as the XR-2240:http://www.komponenten.es.aau.dk/fileadmin/komponenten/Data_Sheet/Linear/XR2240.pdfand compatible parts were introduced by Texas instruments:http://patrick.hiebel.free.fr/doc_semiconducteurs/lineaires/ua2240.pdfand National Semiconductor:https://www.digchip.com/datasheets/parts/datasheet/321/LM2240.phpHere's National's 'blurb' for it:QuotePure marketing puff as its basic accuracy assuming an ideal RC network is specced at +/-5%!I considered using it + a binary weighted resistor network to build a staircase generator I could use for a curve tracer, but I decided I didn't want to waste time, parts and solder on it! Instead I decided to simulate it in LTSPICE. . . .Attached is the fruit of an entirely misspent day - a reasonably faithful behavioural model of an uA2240 + that idiotic staircase generator extended to eight bits with absolute disregard for the component tolerance issuesthat would make it impractical.Here are the staircase generator and the results:There isn't much to it - just a uA2240, a s--tload of resistors, a sprinkling of capacitors and a pair of OPAMPs. There is some trickery going on in the waveform view - the top plot pane is showing logic traces, scaled and offset not to overlap by waveform arithmetic. Caution: this simulation is SSSS....LLLLL....OOOO....WWW!and here's the uA2240 - as a hierarchical sheet, not as a subcircuit to retain easy editability:As you can see its totally fugly - you should have seen version 1.0 before I bussed the eight output flipflops. As is usual with my larger simulations, it suffers from the lack of screen real-estate: when I am tiling the waveform and schematic windows, I tend to pack components as tightly as possible to keep it at a probeable scale without having to zoom in.The implementation was fairly simple - straight from the T.I. datasheet block diagram then tweaked till it actually worked as described over the full supply voltage range, then tweaked a bit more to minimise current from the LTSPICE logic which used a 'magic' supply rail so letting it out into the real world can cause anomalous results, and to get somewhat realistic propagation delays and supply current. The eight bit ripple counter was originally drawn in full, but I decided LTSPICE's undocumentedbussed componentnotation could save a lot of space on my screen.'Share and Enjoy!'

author: Zero999
author_rank: Super Contributor
timestamp: October 28, 2016, 08:39:08 pm
content: You must have been bored. lol Do you plan to build it?

author: Ian.M
author_rank: Super Contributor
timestamp: October 28, 2016, 08:52:52 pm
content: No. As I mentioned earlier, there are much better ways to generate a staircase. IMHO for a curve tracer 16 steps would be overkill, so I would only need a 4 bit DAC. Also I'm unhappy about the low reference voltage at the +in of the first OPAMP. As this sets the virtual earth voltage at the -in which is sourcing the current through the binary resistor array, it leaves very little headroom for the resistors and makes them unduly sensitive to variations in Vce_sat from output to output of the uA2240. Also a ripple counter + a direct resistor DAC is excessively glitchy.If you've got better ideas what to do with a genuine T.I. uA2240, I'd like to hear them.