Voltage divider cheat sheet

16.09.2019 19:46

The two most common electrical measurements I do these days is measuring output impedance of a source and input impedance of a load. I don't have any special equipment for that. I'm not doing it so often that it would warrant buying or making a specialized tool. Since it's all either DC or around audio frequencies and I'm not interested in very precise values it's a really simple measurement. I usually just use an oscilloscope and whatever else is available around the shop to use as reference loads and sources.

Deriving unknown impedances or resistances from the voltage measurements and reference values is straightforward. It only takes a minute and I must have done it a hundred times at this point by inverting the voltage divider formula. I still don't know the resulting equations by heart though. So to avoid doing it the hundred and first time and the odd mistake, I've made myself a nice cheat sheet to stick above my desk. It contains the formulas for the three most common measurements I make.

Voltage divider measurements cheat sheet

PDF version

The notes about the best accuracy refer to the selection of the reference impedance such that the result is least affected by errors in voltage measurements (which, when measuring amplitudes with an oscilloscope, is the largest source of error in my case). The selection is quite obvious, but I guess I added it there for the sake of rigor.

The cheat sheet is made in LaTeX using the circuitikz package for schematics. I'm mostly putting it here for my own future reference, but maybe someone else will find it useful.

Posted by Tomaž | Categories: Analog | Comments »

z80dasm 1.1.6

09.09.2019 20:32

z80dasm is a command-line disassembler for the Z80 CPU. I initially released it way back in 2007 when I was first exploring Galaksija's ROM and other disassemblers I could find didn't do a good enough job for me. Since then it accumulated a few more improvements and bug fixes as I received feedback and patches from various contributors.

Version 1.1.6 is a release that has been way overdue. Most importantly, it fixes a segmentation fault bug that several people have reported. The patch for the bug has actually been committed to the git repository since June last year, but somehow I forgot to bump the version and roll up a new release.

The problem appeared when feeding a symbol file that was generated by z80dasm back as input to z80dasm (possibly after editing some symbol names). This is something that the man page explicitly mentions is supported. However, when this was done together with block definitions, it caused z80dasm to segfault with a NULL pointer dereference. Some code didn't expect that the symbol automatically generated to mark a block start could already be defined via the input symbol file. Thanks to J. B. Langston for first sending me the report and analysis of the crash.

I took this opportunity to review the rest of the symbol handling code and do some further clean ups. It has also led me to implement a feature that I have been asked for in the past. z80dasm now has the ability to sort the symbol table before writing it out to the symbol file.

More specifically, there is now a --sym-order command-line option that either takes a default or frequency argument. Default leaves the ordering as it was in the previous versions - ordered by symbol value. Frequency sorts the symbol table by how frequently a symbol is used in the disassembly. The most commonly used symbols are written at the start of the symbol file. When first approaching an unknown binary, this might help you to identify the most commonly used subroutines.

Anyway, the new release is available from the usual place. See the included README file for build and installation instructions. z80dasm is also included in Debian, however the new release is not in yet (if you're a Debian developer and would like to sponsor an upload, please get in touch).

Posted by Tomaž | Categories: Code | Comments »