Browse Source

first commit

wareck 3 years ago
commit
6c21a2c5c5
100 changed files with 5841 additions and 0 deletions
  1. BIN
      Transistortester-Warehouse/Documentation/Czech/GM328A.pdf
  2. BIN
      Transistortester-Warehouse/Documentation/Czech/GM328A.tex.tar.gz
  3. BIN
      Transistortester-Warehouse/Documentation/Czech/Hiland-M644.pdf
  4. BIN
      Transistortester-Warehouse/Documentation/Czech/Hiland-M644.tex.tar.gz
  5. BIN
      Transistortester-Warehouse/Documentation/Czech/ctester-1.41m.pdf
  6. BIN
      Transistortester-Warehouse/Documentation/Czech/ctester-1.41m.tex.tar.gz
  7. BIN
      Transistortester-Warehouse/Documentation/Czech/ctester-1.42m.pdf
  8. BIN
      Transistortester-Warehouse/Documentation/Czech/ctester-1.42m.tex.tar.gz
  9. BIN
      Transistortester-Warehouse/Documentation/Czech/ctester-1.43m.pdf
  10. BIN
      Transistortester-Warehouse/Documentation/Czech/ctester-1.43m.tex.tar.gz
  11. BIN
      Transistortester-Warehouse/Documentation/Czech/ctester-1.44m.pdf
  12. BIN
      Transistortester-Warehouse/Documentation/Czech/ctester-1.44m.tex.tar.gz
  13. BIN
      Transistortester-Warehouse/Documentation/Czech/ttester-1.13k.Bohu.pdf
  14. BIN
      Transistortester-Warehouse/Documentation/Czech/ttester-1.13k.Bohu.tex.tar.gz
  15. BIN
      Transistortester-Warehouse/Documentation/English/Clone-Comparison-Chart.pdf
  16. BIN
      Transistortester-Warehouse/Documentation/English/ctester-1.41m.pdf
  17. BIN
      Transistortester-Warehouse/Documentation/English/ctester-1.41m.tex.tar.gz
  18. BIN
      Transistortester-Warehouse/Documentation/English/ctester-1.42m.pdf
  19. BIN
      Transistortester-Warehouse/Documentation/English/ctester-1.42m.tex.tar.gz
  20. BIN
      Transistortester-Warehouse/Documentation/English/ctester-1.43m.pdf
  21. BIN
      Transistortester-Warehouse/Documentation/English/ctester-1.43m.tex.tar.gz
  22. BIN
      Transistortester-Warehouse/Documentation/English/ctester-1.44m.pdf
  23. BIN
      Transistortester-Warehouse/Documentation/English/ctester-1.44m.tex.tar.gz
  24. BIN
      Transistortester-Warehouse/Documentation/English/ttester-1.13k.Bohu.pdf
  25. BIN
      Transistortester-Warehouse/Documentation/English/ttester-1.13k.Bohu.tex.tar.gz
  26. BIN
      Transistortester-Warehouse/Documentation/English/ttester-1.13k.pdf
  27. BIN
      Transistortester-Warehouse/Documentation/German/GM328A.pdf
  28. BIN
      Transistortester-Warehouse/Documentation/German/GM328A.tex.tar.gz
  29. BIN
      Transistortester-Warehouse/Documentation/German/Hiland-M644-1.13k.pdf
  30. BIN
      Transistortester-Warehouse/Documentation/German/Hiland-M644.pdf
  31. BIN
      Transistortester-Warehouse/Documentation/German/Hiland-M644.tex.tar.gz
  32. BIN
      Transistortester-Warehouse/Documentation/German/ctester-1.41m.pdf
  33. BIN
      Transistortester-Warehouse/Documentation/German/ctester-1.41m.tex.tar.gz
  34. BIN
      Transistortester-Warehouse/Documentation/German/ctester-1.42m.pdf
  35. BIN
      Transistortester-Warehouse/Documentation/German/ctester-1.42m.tex.tar.gz
  36. BIN
      Transistortester-Warehouse/Documentation/German/ctester-1.43m.pdf
  37. BIN
      Transistortester-Warehouse/Documentation/German/ctester-1.43m.tex.tar.gz
  38. BIN
      Transistortester-Warehouse/Documentation/German/ctester-1.44m.pdf
  39. BIN
      Transistortester-Warehouse/Documentation/German/ctester-1.44m.tex.tar.gz
  40. BIN
      Transistortester-Warehouse/Documentation/German/ttester-1.13k.Bohu.pdf
  41. BIN
      Transistortester-Warehouse/Documentation/German/ttester-1.13k.Bohu.tex.tar.gz
  42. BIN
      Transistortester-Warehouse/Documentation/German/ttester-1.13k.pdf
  43. BIN
      Transistortester-Warehouse/Documentation/Russian/Clone-Comparison-Chart.pdf
  44. BIN
      Transistortester-Warehouse/Documentation/Russian/ctester-1.41m.pdf
  45. BIN
      Transistortester-Warehouse/Documentation/Russian/ctester-1.42m.pdf
  46. BIN
      Transistortester-Warehouse/Documentation/Russian/ctester-1.43m.Bohu.pdf
  47. BIN
      Transistortester-Warehouse/Documentation/Russian/ctester-1.43m.Bohu.tex.tar.gz
  48. BIN
      Transistortester-Warehouse/Documentation/Russian/ctester-1.43m.pdf
  49. BIN
      Transistortester-Warehouse/Documentation/Russian/ctester-1.44m.Bohu.pdf
  50. BIN
      Transistortester-Warehouse/Documentation/Russian/ctester-1.44m.Bohu.tex.tar.gz
  51. BIN
      Transistortester-Warehouse/Documentation/Russian/ctester-1.44m.pdf
  52. BIN
      Transistortester-Warehouse/Documentation/Russian/ttester-1.13k.Bohu.pdf
  53. BIN
      Transistortester-Warehouse/Documentation/Russian/ttester-1.13k.Bohu.tex.tar.gz
  54. BIN
      Transistortester-Warehouse/Documentation/Russian/ttester-1.13k.pdf
  55. BIN
      Transistortester-Warehouse/Firmware/k-firmware/ttester-1.12k.zip
  56. BIN
      Transistortester-Warehouse/Firmware/k-firmware/ttester-snapshot-20200513.tar.gz
  57. BIN
      Transistortester-Warehouse/Firmware/k-firmware/ttester-snapshot-20201012.tar.gz
  58. BIN
      Transistortester-Warehouse/Firmware/k-firmware/ttester-snapshot-20210216.tar.gz
  59. BIN
      Transistortester-Warehouse/Firmware/m-firmware/ComponentTester-1.41m.tgz
  60. BIN
      Transistortester-Warehouse/Firmware/m-firmware/ComponentTester-1.42m.tgz
  61. BIN
      Transistortester-Warehouse/Firmware/m-firmware/ComponentTester-1.43m.tgz
  62. BIN
      Transistortester-Warehouse/Firmware/m-firmware/ComponentTester-1.44m.tgz
  63. BIN
      Transistortester-Warehouse/Hardware/ArduinoUno-Shield.tar.gz
  64. BIN
      Transistortester-Warehouse/Hardware/ComponentTester-HW-1.00m.tgz
  65. BIN
      Transistortester-Warehouse/Hardware/DevKit-644.kicad.tgz
  66. BIN
      Transistortester-Warehouse/Hardware/Encoder-FreqCounter-Adapter-1.00m.tgz
  67. BIN
      Transistortester-Warehouse/Hardware/LC-Meter-Option.pdf
  68. BIN
      Transistortester-Warehouse/Hardware/Opto-Coupler-Adapter-1.00m.tgz
  69. BIN
      Transistortester-Warehouse/Hardware/TC1-Mod.kicad.tgz
  70. BIN
      Transistortester-Warehouse/Hardware/Tester-Max.tar.gz
  71. BIN
      Transistortester-Warehouse/Hardware/mega328_ST7735-Jose.tar.gz
  72. BIN
      Transistortester-Warehouse/Hardware/strip-grid.tar.gz
  73. 15 0
      Transistortester-Warehouse/README.md
  74. BIN
      Transistortester-Warehouse/Software/m-firmware/Windows/tt-bjt-e05.zip
  75. BIN
      Transistortester-Warehouse/Software/m-firmware/Windows/tt-cap-e05.zip
  76. BIN
      Transistortester-Warehouse/Software/m-firmware/Windows/tt-jfet-e05.zip
  77. BIN
      Transistortester-Warehouse/Software/m-firmware/Windows/tt-res-e05.zip
  78. 2 0
      environement.sh
  79. 6 0
      flash.sh
  80. 1 0
      transistor-tester/.gitignore
  81. 244 0
      transistor-tester/README.md
  82. BIN
      transistor-tester/documents/AY-AT-J1.3.pdf
  83. BIN
      transistor-tester/documents/comparative_table_for_clone_tester.pdf
  84. BIN
      transistor-tester/documents/ctester-1.39m.English.pdf
  85. BIN
      transistor-tester/documents/ctester-1.42m.pdf
  86. BIN
      transistor-tester/documents/datasheet_ht7550.pdf
  87. BIN
      transistor-tester/documents/datasheet_lm4040-n.pdf
  88. BIN
      transistor-tester/documents/datasheet_mcp1702.pdf
  89. BIN
      transistor-tester/documents/datasheet_tl431a.pdf
  90. BIN
      transistor-tester/documents/transistor tester-user-manual.pdf
  91. BIN
      transistor-tester/documents/transistor-tester-assembly-instructions.pdf
  92. BIN
      transistor-tester/documents/ttester-1.13k.English.pdf
  93. 330 0
      transistor-tester/firmware/1.39m/Makefile
  94. 1254 0
      transistor-tester/firmware/1.39m/config.h
  95. 855 0
      transistor-tester/firmware/1.39m/config_328.h
  96. 387 0
      transistor-tester/firmware/1.42m/Makefile
  97. 1673 0
      transistor-tester/firmware/1.42m/config.h
  98. 1064 0
      transistor-tester/firmware/1.42m/config_328.h
  99. 4 0
      transistor-tester/firmware/ComponentTester.cfg
  100. 6 0
      transistor-tester/firmware/README.md

BIN
Transistortester-Warehouse/Documentation/Czech/GM328A.pdf


BIN
Transistortester-Warehouse/Documentation/Czech/GM328A.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/Czech/Hiland-M644.pdf


BIN
Transistortester-Warehouse/Documentation/Czech/Hiland-M644.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/Czech/ctester-1.41m.pdf


BIN
Transistortester-Warehouse/Documentation/Czech/ctester-1.41m.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/Czech/ctester-1.42m.pdf


BIN
Transistortester-Warehouse/Documentation/Czech/ctester-1.42m.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/Czech/ctester-1.43m.pdf


BIN
Transistortester-Warehouse/Documentation/Czech/ctester-1.43m.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/Czech/ctester-1.44m.pdf


BIN
Transistortester-Warehouse/Documentation/Czech/ctester-1.44m.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/Czech/ttester-1.13k.Bohu.pdf


BIN
Transistortester-Warehouse/Documentation/Czech/ttester-1.13k.Bohu.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/English/Clone-Comparison-Chart.pdf


BIN
Transistortester-Warehouse/Documentation/English/ctester-1.41m.pdf


BIN
Transistortester-Warehouse/Documentation/English/ctester-1.41m.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/English/ctester-1.42m.pdf


BIN
Transistortester-Warehouse/Documentation/English/ctester-1.42m.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/English/ctester-1.43m.pdf


BIN
Transistortester-Warehouse/Documentation/English/ctester-1.43m.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/English/ctester-1.44m.pdf


BIN
Transistortester-Warehouse/Documentation/English/ctester-1.44m.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/English/ttester-1.13k.Bohu.pdf


BIN
Transistortester-Warehouse/Documentation/English/ttester-1.13k.Bohu.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/English/ttester-1.13k.pdf


BIN
Transistortester-Warehouse/Documentation/German/GM328A.pdf


BIN
Transistortester-Warehouse/Documentation/German/GM328A.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/German/Hiland-M644-1.13k.pdf


BIN
Transistortester-Warehouse/Documentation/German/Hiland-M644.pdf


BIN
Transistortester-Warehouse/Documentation/German/Hiland-M644.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/German/ctester-1.41m.pdf


BIN
Transistortester-Warehouse/Documentation/German/ctester-1.41m.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/German/ctester-1.42m.pdf


BIN
Transistortester-Warehouse/Documentation/German/ctester-1.42m.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/German/ctester-1.43m.pdf


BIN
Transistortester-Warehouse/Documentation/German/ctester-1.43m.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/German/ctester-1.44m.pdf


BIN
Transistortester-Warehouse/Documentation/German/ctester-1.44m.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/German/ttester-1.13k.Bohu.pdf


BIN
Transistortester-Warehouse/Documentation/German/ttester-1.13k.Bohu.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/German/ttester-1.13k.pdf


BIN
Transistortester-Warehouse/Documentation/Russian/Clone-Comparison-Chart.pdf


BIN
Transistortester-Warehouse/Documentation/Russian/ctester-1.41m.pdf


BIN
Transistortester-Warehouse/Documentation/Russian/ctester-1.42m.pdf


BIN
Transistortester-Warehouse/Documentation/Russian/ctester-1.43m.Bohu.pdf


BIN
Transistortester-Warehouse/Documentation/Russian/ctester-1.43m.Bohu.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/Russian/ctester-1.43m.pdf


BIN
Transistortester-Warehouse/Documentation/Russian/ctester-1.44m.Bohu.pdf


BIN
Transistortester-Warehouse/Documentation/Russian/ctester-1.44m.Bohu.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/Russian/ctester-1.44m.pdf


BIN
Transistortester-Warehouse/Documentation/Russian/ttester-1.13k.Bohu.pdf


BIN
Transistortester-Warehouse/Documentation/Russian/ttester-1.13k.Bohu.tex.tar.gz


BIN
Transistortester-Warehouse/Documentation/Russian/ttester-1.13k.pdf


BIN
Transistortester-Warehouse/Firmware/k-firmware/ttester-1.12k.zip


BIN
Transistortester-Warehouse/Firmware/k-firmware/ttester-snapshot-20200513.tar.gz


BIN
Transistortester-Warehouse/Firmware/k-firmware/ttester-snapshot-20201012.tar.gz


BIN
Transistortester-Warehouse/Firmware/k-firmware/ttester-snapshot-20210216.tar.gz


BIN
Transistortester-Warehouse/Firmware/m-firmware/ComponentTester-1.41m.tgz


BIN
Transistortester-Warehouse/Firmware/m-firmware/ComponentTester-1.42m.tgz


BIN
Transistortester-Warehouse/Firmware/m-firmware/ComponentTester-1.43m.tgz


BIN
Transistortester-Warehouse/Firmware/m-firmware/ComponentTester-1.44m.tgz


BIN
Transistortester-Warehouse/Hardware/ArduinoUno-Shield.tar.gz


BIN
Transistortester-Warehouse/Hardware/ComponentTester-HW-1.00m.tgz


BIN
Transistortester-Warehouse/Hardware/DevKit-644.kicad.tgz


BIN
Transistortester-Warehouse/Hardware/Encoder-FreqCounter-Adapter-1.00m.tgz


BIN
Transistortester-Warehouse/Hardware/LC-Meter-Option.pdf


BIN
Transistortester-Warehouse/Hardware/Opto-Coupler-Adapter-1.00m.tgz


BIN
Transistortester-Warehouse/Hardware/TC1-Mod.kicad.tgz


BIN
Transistortester-Warehouse/Hardware/Tester-Max.tar.gz


BIN
Transistortester-Warehouse/Hardware/mega328_ST7735-Jose.tar.gz


BIN
Transistortester-Warehouse/Hardware/strip-grid.tar.gz


+ 15 - 0
Transistortester-Warehouse/README.md

@@ -0,0 +1,15 @@
+# Transistortester Warehouse
+
+The Transistortester is a device for identifying and checking electronic components.
+It also offers additional functionality like a PWM signal generator for example.
+And it's OSHW.
+
+This repo is meant to provide a convenient way to download firmware packages,
+documentation files, PCB files and more. Therefore it's structured differently
+from the main repo.
+
+The project's webpage is https://www.mikrocontroller.net/articles/AVR_Transistortester
+and the main repo is https://github.com/kubi48/TransistorTester-source.
+
+BTW, all the inexpensive Transistortesters sold on your favourite shopping platform
+are based on this project and can be updated with the original OSHW firmware versions.

BIN
Transistortester-Warehouse/Software/m-firmware/Windows/tt-bjt-e05.zip


BIN
Transistortester-Warehouse/Software/m-firmware/Windows/tt-cap-e05.zip


BIN
Transistortester-Warehouse/Software/m-firmware/Windows/tt-jfet-e05.zip


BIN
Transistortester-Warehouse/Software/m-firmware/Windows/tt-res-e05.zip


+ 2 - 0
environement.sh

@@ -0,0 +1,2 @@
+#!/bin/bash
+sudo apt-get install avrdude -y

+ 6 - 0
flash.sh

@@ -0,0 +1,6 @@
+#!/bin/bash
+
+sudo avrdude -pm328p -c usbasp -b 19200 -P /dev/ttyACM0 -e -U eeprom:w:1.25.eep -U flash:w:1.25.hex -U hfuse:w:0xd9 -U efuse:w:0xfc:m -U lfuse:w:0xf7:m
+
+
+

+ 1 - 0
transistor-tester/.gitignore

@@ -0,0 +1 @@
+.idea

+ 244 - 0
transistor-tester/README.md

@@ -0,0 +1,244 @@
+# transistor-tester
+
+Documentation of my modifications to the [AVR Transistortester](https://www.mikrocontroller.net/articles/AVR_Transistortester).
+
+A transistor tester is a device where you can insert different kinds of electronic components and have them analyzed. It not only reads transistors and tells you whether it's NPN or PNP, but it tells you the resistance of resistors or capacitance of capacitors, and more. There are many different types, and they are usually very cheap. 
+
+I have the [GM328 kit from Banggood](https://www.banggood.com/DIYAssembled-GM328-Transistor-Tester-Diode-Capacitance-LCR-Generator-With-Case-Kit-p-1163916.html?ID=530527&cur_warehouse=CN). It's usually called AY-AT instead, as it's not really a GM328.
+
+<img src="resources/gm328-kit.jpg" width="600px"/>
+
+Notable hardware:
+
+* ATmega328P with 8MHz crystal
+* ST7735 160x128px screen
+* Rotary encoder
+* 5.5mm x 2.1mm center positive barrel jack for 9V
+* Terminals for frequency generator, frequency counter and voltage reader
+* ZIF socket for analyzing components
+* Holtek HT7550-1 voltage regulator
+* WS TL431AA voltage reference
+
+
+## Modifications
+
+To improve the accuracy of the tester there are some simple modifications you can do.
+
+![](resources/AY-AT-J1.3.png)
+
+(Image from https://github.com/Upcycle-Electronics/AVR-Transistor-Tester)
+
+See also [this post on eevblog](https://www.eevblog.com/forum/testgear/$20-lcr-esr-transistor-checker-project/msg1286025/#msg1286025).
+
+From the [readme of the k-firmware](https://github.com/madires/Transistortester-Warehouse/blob/master/Documentation/English/ttester-1.13k.pdf):
+
+"_The resistors R1 to R6 are critical for measurements and this 680Ω and 470kΩ resistors should be
+ measurement type resistors (tolerance of 0.1%) to get the full accuracy._"
+ 
+"_The additional 2.5V precision voltage reference connected at pin PC4 (ADC4) can be used to check and calibrate the VCC voltage, but is not required. You can use a LM4040-AIZ2.5 (0.1%), a LT1004CZ-2.5 (0.8%) or a LM336-Z2.5 (0.8%) as voltage reference. If you don’t install the precision voltage reference and you don’t add the relay extension, you should install a pull up resistor R16 to PC4 with a higher resistance value (47kΩ). This helps the software to detect the missing voltage reference._"
+
+From the [readme of the m-firmware](https://github.com/madires/Transistortester-Warehouse/blob/master/Documentation/English/ctester-1.42m.pdf):
+ 
+"_The external 2.5V voltage reference should be only enabled if it's at least 10 times more precise than the voltage regulator. Otherwise it would make the results worse. If you're using a MCP1702 with a typical tolerance of 0.4% as voltage regulator you really don't need a 2.5V voltage reference._"
+ 
+ The part about R16 in the readme of the k-firmware is confusing since it's not mentioned in the readme of the m-firmware. [This post](https://www.eevblog.com/forum/testgear/$20-lcr-esr-transistor-checker-project/msg3005468/#msg3005468) confirms that it's only necessary for the k-firmware:
+ 
+"_For running the m-firmware you can skip step #3 or remove R16 (no need to replace it). When HW_REF25 is disabled (default setting) the firmware will ignore any external voltage reference. The k-firmware handles external references a little different and always checks for a 2.5V reference (no setting to disable that). Therefore the k-firmware needs the resistor mod (step #3) to make it believe that there isn't any reference._"
+
+I chose to order 0.1% resistors and just the MCP1702 voltage regulator, skipping the voltage reference. Also added a 16MHz crystal for increased speed:
+ 
+* 3x [TE Connectivity H8470KBZA - Metal Film Resistor 470K 0.1%](https://www.mouser.com/ProductDetail/279-H8470KBZA)
+* 3x [TE Connectivity H8680RBYA - Metal Film Resistor 680R 0.1%](https://www.mouser.com/ProductDetail/279-H8680RBYA) 
+* 1x [Microchip MCP1702-5002E/TO - LDO Voltage Regulator 5V 250mA 0.1%](https://www.mouser.com/ProductDetail/579-MCP1702-5002E-TO)  
+* 1x [IQD LFXTAL003240 - 16MHz Quartz](https://www.mouser.com/ProductDetail/LFXTAL003240Bulk) 
+
+The concrete changes, referenced to the schematics:
+
+* Y1: 16MHz crystal instead of 8Mhz
+* R1, R3, R5: 680R 0.1% tolerance instead of 1%
+* R2, R4, R6: 470k 0.1% tolerance instead of 1%
+* IC2: MCP1702 high precision voltage regulator instead of HT7550 low precision voltage regulator. Pin compatible.
+* IC3: TL431A voltage reference is not necessary because of MCP1702.
+* R16: Due to missing voltage reference, this 2k2 resistor is not necessary with the m-firmware.
+
+This is how it looks with these changes in place:
+
+<img src="resources/ay-at-no-screen.jpg" width="600px"/>
+
+The 0.1% resistors (black) are a bit thicker than the default (blue), so they overlap a little bit.
+
+
+## Firmware
+
+There are 2 different firmware choices for the transistor tester. The original is the k-firmware. The tester comes with version 1.12k (quite old), and the newest is 1.13k. Development of the k-firmware is currently on hold. It's been forked into the m-firmware, which is rewritten and with additional features, and still under active development.
+
+The k-firmware source is available [here](https://www.mikrocontroller.net/svnbrowser/transistortester/Software/trunk/), with precompiled firmware for the AY-AT in the [mega328_color_kit](https://www.mikrocontroller.net/svnbrowser/transistortester/Software/trunk/mega328_color_kit/) directory. There is also a Makefile there with the correct parameters. The source of the m-firmware is available [here](https://www.mikrocontroller.net/svnbrowser/transistortester/Software/Markus/), but only as tarballs. There are no precompiled versions. Both firmwares can also be found [here](https://github.com/madires/Transistortester-Warehouse/tree/master/Firmware).
+
+I chose to use the m-firmware, due to it still being actively developed. The newest version at the time of writing is 1.42m.
+
+
+### Configuration
+
+There are 3 configuration files in the firmware that needs to be adjusted. See the file "Clones" (from the firmware tgz) for the basic changes required to build a compatible firmware for the AY-AT. The additional changes I made are documented here. The files are also available in the [firmware](firmware) directory.
+
+
+##### config.h 
+
+* Disabled `HW_REF25` because I don't use the TL431A voltage reference or the recommended LM4040 replacement.
+* Disabled `SW_IR_RECEIVER` because the firmware was too large (105%) and wouldn't fit on the ATmega328P. The support for IR is not important to me so it was ok to disable.
+* Enabled `UI_AUTOHOLD` because continuous test mode was annoying. I'd rather take the time I need to read the result.
+* Enabled `POWER_OFF_TIMEOUT` so it turns off when idle.
+* Enabled `SW_POWER_OFF` so I can turn it off from the menu.
+
+
+##### config_328.h
+
+* Enabled `LCD_LATE_ON` because the screen is very garbled when initialized and this setting makes it look fine.
+
+
+##### Makefile
+
+* Changed `FREQ` to 16 because of my change from 8 to 16MHz crystal.
+
+
+##### Tip for unmodified AY-AT
+
+If you just want to build a new firmware, and don't care for any of the hardware modifications described here you can follow the configuration examples with these exceptions:
+
+* Enable `HW_REF25`
+* Keep `FREQ` set to 8
+
+This will give you a firmware that runs on a "stock" GM328 AY-AT from Banggood.
+
+
+### Building
+
+In addition to the build tools that was already installed, I had to add the following packages (in openSUSE):
+
+* `avr-libc`
+* `cross-avr-gcc9`
+
+Then `make` to build.
+
+When build is finished you should have these files, which make up the firmware:
+
+* `ComponentTester.eep`
+* `ComponentTester.hex`
+
+And the compiler output should end with something like this:
+
+```
+AVR Memory Usage
+----------------
+Device: atmega328
+
+Program:   32234 bytes (98.4% Full)
+(.text + .data + .bootloader)
+
+Data:        248 bytes (12.1% Full)
+(.data + .bss + .noinit)
+
+EEPROM:      738 bytes (72.1% Full)
+(.eeprom)
+```
+
+If any of these are more than 100% full you have too much enabled in the firmware and it will not work.
+
+
+### Flash firmware
+
+To flash the firmware we need 3 files. The 2 firmware-files from above, and [ComponentTester.cfg](firmware/ComponentTester.cfg). The last file contains the configuration of the fuses of the ATmega328P. The fuse configuration is extracted from the Makefile. To see what the fuses mean you can use this [online calculator](http://www.engbedded.com/fusecalc/).
+
+The AY-AT does not support firmware flashing out of the box. There are 2 ways around that.
+
+
+#### 1. Use a chip programmer with a ZIF socket
+
+The first option requires no more modfications to the transistor tester, but you have to remove the chip from the socket and insert it into the programmer every time you want to update the firmware.
+
+I use a [TL866II Plus](http://www.xgecu.com/en/TL866_main.html) universal programmer together with the [minipro](https://gitlab.com/DavidGriffith/minipro/) open source software for Linux. See https://github.com/blurpy/minipro for more about how to use.
+
+With the chip in the programmer, just run these commands:
+
+* Erase chip: `minipro -p "ATMEGA328P@DIP28" -E`
+* Write eeprom: `minipro -p "ATMEGA328P@DIP28" -c data -w ComponentTester.eep -e`
+* Write flash: `minipro -p "ATMEGA328P@DIP28" -c code -w ComponentTester.hex -e`
+* Write fuses: `minipro -p "ATMEGA328P@DIP28" -c config -w ComponentTester.cfg -e`
+
+That should be it.
+
+
+#### 2. Add In Circuit Serial Programming (ICSP) header pins
+
+The other option is to solder pins on the back of the circuit board to add the missing ICSP header that lets you flash the firmware in circuit. More work up front, but very useful if you update the firmware often.
+
+I added right angle header pins like this:
+
+<img src="resources/ay-at-icsp-pins.jpg" width="750px"/>
+
+This is the pinout (mirrored compared to above): 
+
+![](resources/atmega328-icsp.png)
+
+There are many different devices that can be used to flash with an ICSP header, like [this example](https://www.eevblog.com/forum/testgear/$20-lcr-esr-transistor-checker-project/msg1021401/#msg1021401) using an Arduino Uno as the programmer, but I'll be using the TL866II Plus mentioned above, as it also supports ICSP mode, with the following pinout:
+
+![](resources/icsp-connection.png)
+
+With wires hooked up between the transistor tester (with power removed) and the programmer, just run these commands:
+
+* Erase chip: `minipro -p "ATMEGA328P@DIP28" -E -i`
+* Write eeprom: `minipro -p "ATMEGA328P@DIP28" -c data -w ComponentTester.eep -e -i`
+* Write flash: `minipro -p "ATMEGA328P@DIP28" -c code -w ComponentTester.hex -e -i`
+* Write fuses: `minipro -p "ATMEGA328P@DIP28" -c config -w ComponentTester.cfg -e -i`
+
+That should be it.
+
+
+#### Result
+
+This is the finished result after flashing the new firmware:
+
+<img src="resources/ay-at-with-screen.jpg" width="600px"/>
+
+
+### Restore original firmware
+
+You can find the original firmware [here](firmware/original) if you want to restore to a known working firmware.
+
+
+## Troubleshooting
+
+
+### Flashing white screen
+
+I initially didn't pay any attention to the output after the compile step:
+
+```
+AVR Memory Usage
+----------------
+Device: atmega328
+
+Program:   34784 bytes (106.2% Full)
+```
+
+It worked fine to flash the firmware, however when trying to start the tester it would quickly flash white on the screen and then turn off. I thought it was a hardware issue at first, but when testing the original firmware it worked. After disabling enough features in this firmware to get below 100% memory it worked fine as well.
+
+
+### Persistent white screen
+
+When I forgot to configure the screen in `config_328.h` before compiling and flashing, the tester would turn on and display a white screen until power was removed. Easily fixed by adding the correct configuration and trying again.
+
+
+## Calibration
+
+After flashing a new firmware it's recommended to follow the steps described in the readme to run a self adjustment.
+
+Short summary of the steps:
+
+1. Power on the tester
+1. Measure a film capacitor with a value between 100nF and 3.3μF at least three times
+1. Go into the menu and select `Adjustment`
+1. Follow the steps
+1. Select `Save` in the menu and choose slot #1
+
+When asked to short the probes I used short breadboard wire between test point 1 and test point 2, and between test point 2 and test point 3 in the ZIF socket. 

BIN
transistor-tester/documents/AY-AT-J1.3.pdf


BIN
transistor-tester/documents/comparative_table_for_clone_tester.pdf


BIN
transistor-tester/documents/ctester-1.39m.English.pdf


BIN
transistor-tester/documents/ctester-1.42m.pdf


BIN
transistor-tester/documents/datasheet_ht7550.pdf


BIN
transistor-tester/documents/datasheet_lm4040-n.pdf


BIN
transistor-tester/documents/datasheet_mcp1702.pdf


BIN
transistor-tester/documents/datasheet_tl431a.pdf


BIN
transistor-tester/documents/transistor tester-user-manual.pdf


BIN
transistor-tester/documents/transistor-tester-assembly-instructions.pdf


BIN
transistor-tester/documents/ttester-1.13k.English.pdf


+ 330 - 0
transistor-tester/firmware/1.39m/Makefile

@@ -0,0 +1,330 @@
+#
+#  Makefile
+#
+#  (c) 2012-2020 by Markus Reschke
+#  based on code from Markus Frejek and Karl-Heinz Kübbeler
+#
+
+PROJECT = ComponentTester
+
+#
+# MCU settings
+# - Change to fit your setup!
+#
+
+# avr-gcc: MCU model
+# - ATmega 328/328P        : atmega328
+# - ATmega 324P/324PA      : atmega324p
+# - ATmega 324PB           : atmega328pb
+# - ATmega 644/644P/644PA  : atmega644
+# - ATmega 1284/1284P      : atmega1284
+MCU = atmega328
+
+# MCU freqency:
+# - 1MHz  : 1
+# - 8MHz  : 8
+# - 16MHz : 16
+# - 20MHz : 20
+FREQ = 16
+
+# oscillator type
+# - internal RC oscillator      : RC
+# - external full swing crystal : Crystal
+# - external low power crystal  : LowPower
+OSCILLATOR = Crystal
+
+# oscillator start-up cycles
+# - Crystal and LowPower could also be 1024 or 256 based on fuse settings
+ifeq (${OSCILLATOR},RC)
+  OSC_STARTUP = 6
+endif
+ifeq (${OSCILLATOR},Crystal)
+  OSC_STARTUP = 16384
+endif
+ifeq (${OSCILLATOR},LowPower)
+  OSC_STARTUP = 16384
+endif
+
+
+# avrdude: part number of MCU
+# - ATmega 328    : m328
+# - ATmega 328P   : m328p
+# - ATmega 328PB  : m328pb
+# - ATmega 324P   : m324p
+# - ATmega 324PA  : m324pa
+# - ATmega 644    : m644
+# - ATmega 644P   : m644p
+# - ATmega 644PA  : m644p
+# - ATmega 1284   : m1284
+# - ATmega 1284P  : m1284p
+PARTNO = m328p
+
+# avrdude: ISP programmer
+#PROGRAMMER = buspirate
+#PROGRAMMER = USBasp
+#PROGRAMMER = usbtiny
+#PROGRAMMER = stk500v2
+PROGRAMMER = avrispmkII
+
+# avrdude: port of ISP programmer
+#PORT = /dev/bus_pirate
+#PORT = /dev/ttyACM0
+PORT = usb
+
+# avrdude: bitclock
+BITCLOCK = 5.0
+#BITCLOCK = 10.0
+
+
+#
+#  global settings
+#
+
+# project name
+NAME = ComponentTester
+
+# name and version based on directory name
+DIST = $(notdir ${CURDIR})
+
+# compiler flags
+CC = avr-gcc
+CPP = avr-g++
+CFLAGS = -mmcu=${MCU} -Wall -mcall-prologues -I. -Ibitmaps
+CFLAGS += -DF_CPU=${FREQ}000000UL
+CFLAGS += -DOSC_STARTUP=${OSC_STARTUP}
+CFLAGS += -gdwarf-2 -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
+CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d
+#CFLAGS += -flto
+
+# linker flags
+LDFLAGS = -mmcu=${MCU} -Wl,-Map=${NAME}.map
+
+# hex file flags
+HEX_FLASH_FLAGS = -R .eeprom -R .fuse -R .lock -R .signature
+HEX_EEPROM_FLAGS = -j .eeprom
+HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load"
+HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings
+
+# header files
+HEADERS = config.h config_328.h config_644.h colors.h
+HEADERS += common.h variables.h $(wildcard var_*.h) functions.h
+HEADERS += OneWire.h
+HEADERS += HD44780.h ST7565R.h ILI9341.h PCD8544.h ST7735.h ST7920.h
+HEADERS += SSD1306.h ILI9163.h STE2007.h PCF8814.h ST7036.h ADS7843.h
+
+# objects
+OBJECTS_C = main.o user.o pause.o adjust.o ADC.o probes.o display.o
+OBJECTS_C += resistor.o cap.o semi.o inductor.o tools_misc.o tools_signal.o
+OBJECTS_C += SPI.o I2C.o serial.o commands.o OneWire.o
+OBJECTS_C += IR_RX.o IR_TX.o DHTxx.o
+OBJECTS_C += HD44780.o ST7565R.o ILI9341.o PCD8544.o ST7735.o ST7920.o
+OBJECTS_C += SSD1306.o ILI9163.o STE2007.o PCF8814.o ST7036.o VT100.o
+OBJECTS_C += ADS7843.o
+OBJECTS_S = wait.o
+OBJECTS = ${OBJECTS_C} ${OBJECTS_S}
+
+
+#
+#  build
+#
+
+all: ${NAME} ${NAME}.hex ${NAME}.eep ${NAME}.lss size
+
+
+#
+#  link
+#
+
+# link firmware
+$(NAME): ${OBJECTS}
+	 ${CC} ${LDFLAGS} ${OBJECTS} ${LIBDIRS} ${LIBS} -o ${NAME}
+
+# create hex file of firmware
+%.hex: ${NAME}
+	avr-objcopy -O ihex ${HEX_FLASH_FLAGS} $< $@
+
+# create hex file of EEPROM data
+%.eep: ${NAME}
+	-avr-objcopy ${HEX_EEPROM_FLAGS} -O ihex $< $@ || exit 0
+
+# create dump of firmware
+%.lss: ${NAME}
+	avr-objdump -h -S $< > $@
+
+# output size of firmware and stuff
+size: ${NAME}
+	@echo
+	@avr-size -C --mcu=${MCU} $<
+
+
+#
+#  compile source files
+#
+
+# rule for all c-files
+${OBJECTS_C}: %.o: %.c ${HEADERS} ${MAKEFILE_LIST}
+	${CC} ${CFLAGS} -c ${@:.o=.c}
+
+# rule for all S-files
+${OBJECTS_S}: %.o: %.S ${HEADERS} ${MAKEFILE_LIST}
+	${CC} ${CFLAGS} -c ${@:.o=.S}
+
+# external dependencies
+-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)
+
+
+#
+#  extras
+#
+
+# program firmware and EEPROM data
+upload: ${NAME} ${NAME}.hex ${NAME}.eep ${NAME}.lss size
+	avrdude -c ${PROGRAMMER} -B ${BITCLOCK} -p ${PARTNO} -P ${PORT} \
+	  -U flash:w:./${NAME}.hex:a -U eeprom:w:./${NAME}.eep:a
+
+# program firmware only
+prog_fw: ${NAME} ${NAME}.hex ${NAME}.lss size
+	avrdude -c ${PROGRAMMER} -B ${BITCLOCK} -p ${PARTNO} -P ${PORT} \
+	  -U flash:w:./${NAME}.hex:a
+
+# program EEPROM data only
+prog_ee: ${NAME} ${NAME}.eep ${NAME}.lss size
+	avrdude -c ${PROGRAMMER} -B ${BITCLOCK} -p ${PARTNO} -P ${PORT} \
+	  -U eeprom:w:./${NAME}.eep:a
+
+# create distribution package
+dist:
+	rm -f *.tgz
+	cd ..; tar -czf ${DIST}/${DIST}.tgz \
+	  ${DIST}/*.h ${DIST}/*.c ${DIST}/*.S ${DIST}/bitmaps/*.h \
+	  ${DIST}/Makefile ${DIST}/README ${DIST}/CHANGES \
+	  ${DIST}/README.de ${DIST}/CHANGES.de ${DIST}/Clones \
+	  ${DIST}/*.pdf
+
+# clean up
+clean:
+	-rm -rf ${OBJECTS} ${NAME} dep/* *.tgz
+	-rm -rf ${NAME}.hex ${NAME}.eep ${NAME}.lss ${NAME}.map
+
+
+#
+#  MCU fuse bytes
+#
+
+# ATmega 328/328P
+ifeq (${MCU},atmega328)
+  FAMILY = atmega328_324
+endif
+
+# ATmega 328PB
+ifeq (${MCU},atmega328pb)
+  FAMILY = atmega328pb
+endif
+
+# ATmega 324P/324PA
+ifeq (${MCU},atmega324p)
+  FAMILY = atmega328_324
+endif
+
+# ATmega 644/644P/644PA
+ifeq (${MCU},atmega644)
+  FAMILY = atmega328_324
+endif
+
+# ATmega 1284/1284P
+ifeq (${MCU},atmega1284)
+  FAMILY = atmega328_324
+endif
+
+# ATmega 328/324/644/1284
+ifeq (${FAMILY},atmega328_324)
+  # high byte: use default settings
+  HFUSE = -U hfuse:w:0xd9:m
+  # extended byte: BOD level 4.3V
+  EFUSE = -U efuse:w:0xfc:m
+  # low byte: clock settings
+  ifeq (${FREQ},1)
+    # internal RC oscillator (8MHz) and /1 clock divider
+    LFUSE_RC = -U lfuse:w:0x62:m
+    # external 8MHz full swing crystal and /8 clock divider
+    LFUSE_CRYSTAL = -U lfuse:w:0x77:m
+    # external 8MHz low power crystal and /8 clock divider
+    LFUSE_LOWPOWER = -U lfuse:w:0x7f:m
+  endif
+  ifeq (${FREQ},8)
+    # internal RC oscillator (8MHz) and /1 clock divider
+    LFUSE_RC = -U lfuse:w:0xe2:m
+    # external 8MHz full swing crystal and /1 clock divider
+    LFUSE_CRYSTAL = -U lfuse:w:0xf7:m
+    # external 8MHz low power crystal and /1 clock divider
+    LFUSE_LOWPOWER = -U lfuse:w:0xff:m
+  endif
+  ifeq (${FREQ},16)
+    # internal RC oscillator (8MHz) not possible
+    LFUSE_RC =
+    # external 16MHz full swing crystal and /1 clock divider
+    LFUSE_CRYSTAL = -U lfuse:w:0xf7:m
+    # external 16MHz low power crystal and /1 clock divider
+    LFUSE_LOWPOWER = -U lfuse:w:0xff:m
+  endif
+  ifeq (${FREQ},20)
+    # internal RC oscillator (8MHz) not possible
+    LFUSE_RC =
+    # external 20MHz full swing crystal and /1 clock divider
+    LFUSE_CRYSTAL = -U lfuse:w:0xf7:m
+    # external 20MHz low power crystal and /1 clock divider
+    LFUSE_LOWPOWER = -U lfuse:w:0xff:m
+  endif
+endif
+
+# ATmega 328PB
+ifeq (${FAMILY},atmega328pb)
+  # high byte: use default settings
+  HFUSE = -U hfuse:w:0xd9:m
+  # extended byte: BOD level 4.3V, CFD disabled
+  EFUSE = -U efuse:w:0xf4:m
+  # low byte: clock settings
+  ifeq (${FREQ},8)
+    # internal RC oscillator (8MHz) and /1 clock divider
+    LFUSE_RC = -U lfuse:w:0xe2:m
+    # full swing crystal not supported, use low power crystal
+    LFUSE_CRYSTAL = -U lfuse:w:0xff:m
+    # external 8MHz low power crystal and /1 clock divider
+    LFUSE_LOWPOWER = -U lfuse:w:0xff:m
+  endif
+  ifeq (${FREQ},16)
+    # internal RC oscillator (8MHz) not possible
+    LFUSE_RC =
+    # full swing crystal not supported, use low power crystal
+    LFUSE_CRYSTAL = -U lfuse:w:0xff:m
+    # external 16MHz low power crystal and /1 clock divider
+    LFUSE_LOWPOWER = -U lfuse:w:0xff:m
+  endif
+endif
+
+# select LFUSE
+ifeq (${OSCILLATOR},RC)
+  LFUSE = ${LFUSE_RC}
+endif
+ifeq (${OSCILLATOR},Crystal)
+  LFUSE = ${LFUSE_CRYSTAL}
+endif
+ifeq (${OSCILLATOR},LowPower)
+  LFUSE = ${LFUSE_LOWPOWER}
+endif
+
+# check fuses
+FUSES =
+ifneq ($(strip ${LFUSE}),)
+  ifneq ($(strip ${HFUSE}),)
+    FUSES = ${LFUSE} ${HFUSE} ${EFUSE}
+  endif
+endif
+
+# set fuses
+fuses:
+  ifeq ($(strip ${FUSES}),)
+	@echo Invalid fuse settings!
+  else
+	avrdude -c ${PROGRAMMER} -B ${BITCLOCK} -p ${PARTNO} -P ${PORT} ${FUSES}
+  endif

+ 1254 - 0
transistor-tester/firmware/1.39m/config.h

@@ -0,0 +1,1254 @@
+/* ************************************************************************
+ *
+ *   global configuration, setup and settings
+ *
+ *   (c) 2012-2019 by Markus Reschke
+ *   based on code from Markus Frejek and Karl-Heinz Kübbeler
+ *
+ * ************************************************************************ */
+
+
+/* source management */
+#define CONFIG_H
+
+
+/*
+ *  For MCU specific settings (port and pin assignments) and LCD display
+ *  settings please edit:
+ *  - ATmega328:           config_328.h
+ *  - ATmega324/644/1284:  config_644.h
+ */
+
+
+
+/* ************************************************************************
+ *   Hardware options
+ * ************************************************************************ */
+
+
+/*
+ *  rotary encoder for user interface
+ *  - default pins: PD2 & PD3 (ATmega 328)
+ *  - could be in parallel with LCD module
+ *  - see ENCODER_PORT for port pins (config-<MCU>.h)
+ *  - uncomment to enable and also set ENCODER_PULSES & ENCODER_STEPS below
+ *    to match your rotary encoder
+ */
+
+#define HW_ENCODER
+
+
+/*
+ *  Number of Gray code pulses per step or detent for the rotary encoder
+ *  - typical values: 2 or 4, rarely 1
+ *  - a rotary encoder's pulse is the complete sequence of 4 Gray code pulses
+ *  - adjust value to match your rotary encoder
+ */
+
+#define ENCODER_PULSES   4
+
+
+/*
+ *  Number of detents or steps
+ *  - this is used by the detection of the rotary encoder's turning velocity
+ *  - it doesn't have to match exactly and also allows you to finetune the
+ *    the feedback (higher: slow down, lower: speed up)
+ *  - typical values: 20, 24 or 30 
+ *  - adjust value to match your rotary encoder
+ */
+
+#define ENCODER_STEPS    20
+
+
+/*
+ *  increase/decrease push buttons for user interface
+ *  - alternative for rotary encoder
+ *  - see KEY_PORT for port pins (config-<MCU>.h)
+ *  - uncomment to enable
+ */
+
+//#define HW_INCDEC_KEYS
+
+
+/*
+ *  2.5V voltage reference for Vcc check
+ *  - default pin: PC4 (ATmega 328)
+ *  - should be at least 10 times more precise than the voltage regulator
+ *  - see TP_REF for port pin (config-<MCU>.h)
+ *  - uncomment to enable and also adjust UREF_25 below for your voltage
+ *    reference
+ */
+
+//#define HW_REF25 // Disabled because of MCP1702
+
+
+/*
+ *  Typical voltage of 2.5V voltage reference (in mV)
+ *  - see datasheet of the voltage reference
+ *  - or use >= 5.5 digit DMM to measure the voltage
+ */
+
+#define UREF_25           2495
+
+
+/*
+ *  Probe protection relay for discharging caps
+ *  - default pin: PC4 (ATmega 328)
+ *  - low signal: short circuit probe pins
+ *    high signal via external reference: remove short circuit 
+ *  - uncomment to enable
+ */
+
+//#define HW_DISCHARGE_RELAY
+
+
+/*
+ *  voltage measurement up to 50V DC / Zener check
+ *  - default pin: PC3 (ATmega 328)
+ *  - 10:1 voltage divider
+ *  - DC-DC boost converter controled by test push button
+ *  - see TP_ZENER for port pin
+ *  - uncomment to enable
+ */
+
+#define HW_ZENER
+
+
+/*
+ *  high resolution for Zener check
+ *  - 10mV instead of 0.1V
+ *  - uncomment to enable
+ */
+
+#define ZENER_HIGH_RES
+
+
+/*
+ *  fixed signal output
+ *  - in case the MCU's OC1B pin is wired as dedicated signal output
+ *    instead of driving the Rl probe resistor for test pin #2
+ *  - uncomment to enable
+ */
+
+//#define HW_FIXED_SIGNAL_OUTPUT
+
+
+/*
+ *  basic frequency counter
+ *  - default pin: T0 (PD4 ATmega 328)
+ *  - uses T0 directly as frequency input
+ *  - counts up to 1/4 of MCU clock rate
+ *  - might be in parallel with LCD module
+ *  - uncomment to enable
+ */
+
+#define HW_FREQ_COUNTER_BASIC
+
+
+/*
+ *  extended frequency counter
+ *  - low and high frequency crystal oscillators
+ *    and buffered frequency input
+ *  - prescalers 1:1 and 16:1 (32:1)
+ *  - see COUNTER_PORT for port pins (config-<MCU>.h)
+ *  - requires a display with more than 2 text lines
+ *  - uncomment to enable
+ *  - select the circuit's prescaler setting: either 16:1 or 32:1 
+ */
+
+//#define HW_FREQ_COUNTER_EXT
+#define FREQ_COUNTER_PRESCALER     16   /* 16:1 */
+//#define FREQ_COUNTER_PRESCALER     32   /* 32:1 */
+
+
+/*
+ *  event counter
+ *  - default pin: T0 (PD4 ATmega 328)
+ *  - uses T0 directly as event/pulse input (rising edge)
+ *  - no shared operation with displays possible for T0
+ *  - requires additional keys (e.g. rotary encoder) and a display with
+ *    more than 5 lines
+ *  - only for MCU clock of 8, 16 or 20MHz
+ *  - uncomment to enable
+ */
+
+//#define HW_EVENT_COUNTER
+
+
+/*
+ *  trigger output for event counter
+ *  - uses probe #2 as trigger output, probes #1 and #3 are Gnd
+ *  - sets trigger output to high while counting
+ *  - uncomment to enable
+ */
+
+//#define EVENT_COUNTER_TRIGGER_OUT
+
+
+/*
+ *  IR remote control detection/decoder (via dedicated MCU pin)
+ *  - requires IR receiver module, e.g. TSOP series
+ *  - module is connected to fixed I/O pin
+ *  - see IR_PORT for port pin (config-<MCU>.h)
+ *  - uncomment to enable
+ *  - for additional protocols also enable SW_IR_RX_EXTRA
+ */
+
+//#define HW_IR_RECEIVER
+
+
+/*
+ *  fixed cap for self-adjustment
+ *  - see TP_CAP and ADJUST_PORT for port pins (config-<MCU>.h)
+ *  - uncomment to enable
+ */
+
+//#define HW_ADJUST_CAP
+
+
+/*
+ *  relay for parallel cap (sampling ADC)
+ *  - uncomment to enable (not implemented yet)
+ */
+
+//#define HW_CAP_RELAY
+
+
+
+/* ************************************************************************
+ *   software options
+ * ************************************************************************ */
+
+
+/*
+ *  PWM generator with simple user interface
+ *  - signal output via OC1B
+ *  - uncomment to enable
+ */
+
+#define SW_PWM_SIMPLE
+
+
+/*
+ *  PWM generator with fancy user interface
+ *  - signal output via OC1B
+ *  - requires additional keys and display with more than 2 text lines
+ *  - uncomment to enable
+ */
+
+//#define SW_PWM_PLUS
+
+
+/*
+ *  Inductance measurement
+ *  - uncomment to enable
+ */
+
+#define SW_INDUCTOR
+
+
+/*
+ *  ESR measurement and in-circuit ESR measurement
+ *  - requires MCU clock >= 8 MHz
+ *  - choose SW_OLD_ESR for old method starting at 180nF
+ *  - uncomment to enable
+ */
+
+#define SW_ESR
+//#define SW_OLD_ESR
+
+
+/*
+ *  check for rotary encoders
+ *  - uncomment to enable
+ */
+
+//#define SW_ENCODER
+
+
+/*
+ *  squarewave signal generator
+ *  - signal output via OC1B
+ *  - requires additional keys
+ *  - uncomment to enable
+ */
+
+#define SW_SQUAREWAVE
+
+
+/*
+ *  IR remote control detection/decoder (via probes)
+ *  - requires IR receiver module, e.g. TSOP series
+ *  - module will be connected to probe leads
+ *  - uncomment to enable
+ */
+
+//#define SW_IR_RECEIVER // Disabled to be able to fit in memory
+
+
+/*
+ *  current limiting resistor for IR receiver module
+ *  - for 5V only modules
+ *  - Warning: any short circuit may destroy your MCU
+ *  - uncomment to disable resistor
+ */
+
+//#define SW_IR_DISABLE_RESISTOR
+
+
+/*
+ *  additional protocols for IR remote control detection/decoder
+ *  - uncommon protocols which will increase flash memory usage ;)
+ *  - uncomment to enable
+ */
+
+//#define SW_IR_RX_EXTRA
+
+
+/*
+ *  IR remote control sender
+ *  - signal output via OC1B
+ *  - requires additional keys and display with more than 4 text lines
+ *  - also requires an IR LED with a simple driver
+ *  - uncomment to enable
+ */
+
+//#define SW_IR_TRANSMITTER
+
+
+/*
+ *  Alternative delay loop for IR remote control sender
+ *  - in case the the C compiler screws up the default delay loop
+ *    and causes incorrect pulse/pause timings
+ *  - uncomment to enable
+ */
+
+//#define SW_IR_TX_ALTDELAY
+
+
+/*
+ *  additional protocols for IR remote control sender
+ *  - uncommon protocols which will increase flash memory usage ;)
+ *  - uncomment to enable
+ */
+
+//#define SW_IR_TX_EXTRA
+
+
+/*
+ *  check for opto couplers
+ *  - uncomment to enable
+ */
+
+#define SW_OPTO_COUPLER
+
+
+/*
+ *  check for Unijunction Transistors
+ *  - uncomment to enable
+ */
+
+#define SW_UJT
+
+
+
+/*
+ *  Servo Check
+ *  - signal output via OC1B
+ *  - requires additional keys and display with more than 2 text lines
+ *  - uncomment to enable
+ */
+
+//#define SW_SERVO
+
+
+/*
+ *  DS18B20 - OneWire temperature sensor 
+ *  - uncomment to enable
+ *  - also enable ONEWIRE_PROBES or ONEWIRE_IO_PIN (see section 'Busses')
+ */
+
+//#define SW_DS18B20
+
+
+/*
+ *  OneWire: read ROM codes of connected devices
+ *  - requires display with more than 2 text lines
+ *  - uncomment to enable
+ *  - also enable ONEWIRE_PROBES or ONEWIRE_IO_PIN (see section 'Busses')
+ */
+
+//#define SW_ONEWIRE_SCAN
+
+
+/*
+ *  capacitor leakage check
+ *  - requires display with more than two lines
+ *  - uncomment to enable
+ */
+
+//#define SW_CAP_LEAKAGE
+
+
+/*
+ *  display reverse hFE for BJTs
+ *  - hFE for collector and emitter reversed
+ *  - uncomment to enable
+ */
+
+#define SW_REVERSE_HFE
+
+
+/*
+ *  monitor resistance and inductance on probes #1 and #3
+ *  - uncomment to enable
+ */
+
+//#define SW_MONITOR_RL
+
+
+/*
+ *  monitor capacitance on probes #1 and #3
+ *  - uncomment to enable
+ */
+
+//#define SW_MONITOR_C
+
+
+/*
+ *  DHT11, DHT22 and compatible humidity & temperature sensors
+ *  - uncomment to enable
+ */
+
+//#define SW_DHTXX
+
+
+/*
+ *  display font for test purposes
+ *  - uncomment to enable
+ */
+
+//#define SW_FONT_TEST
+
+
+
+/* ************************************************************************
+ *   workarounds for some testers
+ * ************************************************************************ */
+
+
+/*
+ *  Disable hFE measurement with common collector circuit and Rl as
+ *  base resistor
+ *  - problem:
+ *    hFE values are too high because base voltage is measured too low
+ *  - affected testers:
+ *    Hiland M664 (under investigation)
+ *  - uncomment to enable
+ */
+
+//#define NO_HFE_C_RL
+
+
+
+/* ************************************************************************
+ *   workarounds for some IDEs 
+ * ************************************************************************ */
+
+
+/*
+ *  Oscillator startup cycles (after wakeup from power-safe mode):
+ *  - typical values
+ *    - internal RC:              6
+ *    - full swing crystal:   16384 (also 256 or 1024 based on fuse settings)
+ *    - low power crystal:    16384 (also 256 or 1024 based on fuse settings)
+ *  - Please change value if it doesn't match your tester!
+ */
+
+#ifndef OSC_STARTUP
+  #define OSC_STARTUP    16384
+#endif
+
+
+
+/* ************************************************************************
+ *   user interface
+ * ************************************************************************ */
+
+
+/*
+ *  Language of user interface. Available languages:
+ *  - English (default)
+ *  - Czech (based on ISO 8859-1)
+ *  - Czech 2 (with Czech characters based on ISO 8859-2)
+ *  - Danish
+ *  - German
+ *  - Polish (based on ISO 8859-1)
+ *  - Polish 2 (with Polish characters based on ISO 8859-2)
+ *  - Spanish
+ *  - Russian (with cyrillic characters based on Windows-1251)
+ *  - Russian 2 (with cyrillic characters based on Windows-1251)
+ */
+
+#define UI_ENGLISH
+//#define UI_CZECH
+//#define UI_CZECH_2
+//#define UI_DANISH
+//#define UI_GERMAN
+//#define UI_ITALIAN
+//#define UI_POLISH
+//#define UI_POLISH_2
+//#define UI_SPANISH
+//#define UI_RUSSIAN
+//#define UI_RUSSIAN_2
+
+
+/*
+ *  Use comma instead of dot to indicate a decimal fraction.
+ *  - uncomment to enable
+ */
+
+//#define UI_COMMA
+
+
+/*
+ *  Display temperatures in Fahrenheit instead of Celsius.
+ *  - uncomment to enable
+ */
+
+//#define UI_FAHRENHEIT
+
+
+/*
+ *  Set the default operation mode to auto-hold.
+ *  - instead of continous mode
+ *  - uncomment to enable
+ */
+
+#define UI_AUTOHOLD
+
+
+/*
+ *  Trigger the menu also by a short circuit of all three probes.
+ *  - former default behaviour
+ *  - uncomment to enable
+ */
+
+//#define UI_SHORT_CIRCUIT_MENU
+
+
+/*
+ *  Show key hints instead of cursor if available.
+ *  - currently only "Menu/Test"
+ *  - requires additional keys and display with a sufficient number of
+ *    text lines (recommended: >= 8 lines)
+ *  - uncomment to enable
+ */
+
+//#define UI_KEY_HINTS
+
+
+/*
+ *  Output components found also via TTL serial interface.
+ *  - uncomment to enable
+ *  - also enable SERIAL_BITBANG or SERIAL_HARDWARE (see section 'Busses')
+ */
+
+//#define UI_SERIAL_COPY
+
+
+/*
+ *  Control tester via TTL serial interface.
+ *  - uncomment to enable
+ *  - also enable SERIAL_BITBANG or SERIAL_HARDWARE, plus SERIAL_RW
+ *    (see section 'Busses') 
+ */
+
+//#define UI_SERIAL_COMMANDS
+
+
+/*
+ *  Maximum time to wait after probing (in ms).
+ *  - applies to continuous mode only
+ *  - Time between printing the result and starting a new probing cycle.
+ */
+
+#define CYCLE_DELAY      3000
+
+
+/*
+ *  Maximum number of probing runs without any component found in a row.
+ *  - applies to continuous mode only
+ *  - If this number is reached the tester will power off.
+ *  - When set to zero the tester will run only once and turn off
+ *    after CYCLE_DELAY.
+ */
+
+#define CYCLE_MAX        5
+
+
+/*
+ *  Automatic power-off when no button is pressed for a while (in s).
+ *  - applies to auto-hold mode only
+ *  - uncomment to enable, also adjust timeout (in s)
+ */
+
+#define POWER_OFF_TIMEOUT     60
+
+
+/*
+ *  color coding for probes
+ *  - requires color graphics LCD
+ *  - uncomment to enable
+ *  - edit colors.h to select correct probe colors
+ */
+
+#define SW_PROBE_COLORS
+
+
+/*
+ *  main menu: power off tester
+ *  - uncomment to enable
+ */
+
+#define SW_POWER_OFF
+
+
+/*
+ *  Round some values if appropriate.
+ *  - for
+ *    - DS18B20 (0.1 °C/F)
+ *  - uncomment to enable
+ */
+
+//#define UI_ROUND_DS18B20
+
+
+/*
+ *  storage of firmware data (texts, tables etc)
+ *  - self-adjustment data is always stored in EEPROM
+ *  - fonts and symbols are always stored in Flash
+ *  - uncomment one
+ */ 
+
+#define DATA_EEPROM           /* store data in EEPROM */
+//#define DATA_FLASH            /* store data in Flash */
+
+
+
+/* ************************************************************************
+ *   power management
+ * ************************************************************************ */
+
+
+/*
+ *  Battery monitoring mode:
+ *  - BAT_NONE     disable battery monitoring completely
+ *  - BAT_DIRECT   direct measurement of battary voltage (< 5V)
+ *  - BAT_DIVIDER  measurement via voltage divider
+ *  - uncomment one of the modes
+ */
+
+//#define BAT_NONE
+//#define BAT_DIRECT
+#define BAT_DIVIDER
+
+
+/*
+ *  Unmonitored optional external power supply
+ *  - Some circuits supporting an additional external power supply are designed
+ *    in a way that prevents the battery monitoring to measure the voltage of
+ *    the external power supply. This would trigger the low battery shut-down.
+ *    The switch below will prevent the shut-down when the measured voltage is
+ *    below 0.9V (caused by the diode's leakage current).
+ *  - uncomment to enable
+ */
+
+//#define BAT_EXT_UNMONITORED
+
+
+/*
+ *  Voltage divider for battery monitoring
+ *  - BAT_R1: top resistor in Ohms
+ *  - BAT_R2: bottom resistor in Ohms
+ */
+
+#define BAT_R1           10000
+#define BAT_R2           3300
+
+
+/*
+ *  Voltage drop by reverse voltage protection diode and power management
+ *  transistor (in mV):
+ *  - or any other circuitry in the power section
+ *  - Get your DMM and measure the voltage drop!
+ *  - Schottky diode about 200mV / PNP BJT about 100mV.
+ */  
+
+#define BAT_OFFSET       290
+
+
+/*
+ *  Battery weak voltage (in mV).
+ *  - Tester warns if BAT_WEAK is reached.
+ *  - Voltage drop BAT_OFFSET is considered in calculation.
+ */
+
+#define BAT_WEAK         7400
+
+
+/*
+ *  Battery low voltage (in mV).
+ *  - Tester powers off if BAT_LOW is reached.
+ *  - Voltage drop BAT_OFFSET is considered in calculation.
+ */
+
+#define BAT_LOW          6400 
+
+
+/*
+ *  Enter sleep mode when idle to save power.
+ *  - uncomment to enable
+ */
+
+#define SAVE_POWER
+
+
+
+/* ************************************************************************
+ *   measurement settings and offsets
+ * ************************************************************************ */
+
+
+/*
+ *  ADC voltage reference based on Vcc (in mV). 
+ */
+
+#define UREF_VCC         5001
+
+
+/*
+ * Offset for the internal bandgap voltage reference (in mV): -100 up to 100
+ *  - To compensate any difference between real value and measured value.
+ *  - The ADC has a resolution of about 4.88mV for V_ref = 5V (Vcc) and
+ *    1.07mV for V_ref = 1.1V (bandgap).
+ *  - Will be added to measured voltage of bandgap reference.
+ */
+
+#define UREF_OFFSET      0
+
+
+/*
+ *  Exact values of probe resistors.
+ *  - Standard value for Rl is 680 Ohms.
+ *  - Standard value for Rh is 470k Ohms.
+ */
+
+/* Rl in Ohms */
+#define R_LOW            680
+
+/* Rh in Ohms */
+#define R_HIGH           470000
+
+
+/*
+ *  Offset for systematic error of resistor measurement with Rh (470k) 
+ *  in Ohms.
+ *  - if resistors >20k measure too high or low adjust the offset accordingly
+ *  - standard offset is 350 Ohms
+ */
+
+#define RH_OFFSET        350
+
+
+/*
+ *  Resistance of probes (in 0.01 Ohms).
+ *  - default offset for PCB tracks and probe leads
+ *  - resistance of two probes in series
+ *  - assuming all probes have same/similar resistance
+ *  - will be updated by self-adjustment
+ */
+
+#define R_ZERO           20
+
+
+/*
+ *  Use probe pair specific resistance offsets instead of an
+ *  average value for all probes.
+ *  - uncomment to enable
+ */
+
+#define R_MULTIOFFSET
+
+
+/* 
+ *  Capacitance of probes (in pF).
+ *  - default offset for MCU, PCB tracks and probe leads
+ *  - Examples:
+ *    capacitance  length
+ *    -------------------------
+ *     3pF         about 10cm
+ *     9pF         about 30cm
+ *    15pF         about 50cm
+ *  - maximum value: 100
+ *  - will be updated by self-adjustment
+ */
+
+#define C_ZERO           43
+
+
+/*
+ *  Use probe pair specific capacitance offsets instead of an
+ *  average value for all probes.
+ *  - uncomment to enable
+ */
+
+//#define CAP_MULTIOFFSET
+
+
+/*
+ *  Maximum voltage at which we consider a capacitor being
+ *  discharged (in mV).
+ */
+
+#define CAP_DISCHARGED   2
+
+
+/*
+ *  Correction factors for capacitors (in 0.1%)
+ *  - positive factor increases capacitance value
+ *    negative factor decreases capacitance value
+ *  - CAP_FACTOR_SMALL for caps < 4.7µF
+ *  - CAP_FACTOR_MID for caps 4.7 - 47µF
+ *  - CAP_FACTOR_LARGE for caps > 47µF
+ */
+
+#define CAP_FACTOR_SMALL      0      /* no correction */ 
+#define CAP_FACTOR_MID        -40    /* -4.0% */
+#define CAP_FACTOR_LARGE      -90    /* -9.0% */
+
+
+/*
+ *  Number of ADC samples to perform for each mesurement.
+ *  - Valid values are in the range of 1 - 255.
+ */
+
+#define ADC_SAMPLES      25
+
+
+
+/* ************************************************************************
+ *   MCU specific setup to support different AVRs
+ * ************************************************************************ */
+
+
+/* MCU clock */
+#define CPU_FREQ    F_CPU
+
+
+/*
+ *  ATmega 328/328P
+ */
+
+#if defined(__AVR_ATmega328__)
+
+  #include "config_328.h"
+
+
+/*
+ *  ATmega 324P/324PA/644/644P/644PA/1284/1284P
+ */
+
+#elif defined(__AVR_ATmega324P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega1284__)
+
+  #include "config_644.h"
+
+
+/*
+ *  missing or unsupported MCU
+ */
+
+#else
+  #error <<< No or wrong MCU type selected! >>>
+#endif
+
+
+
+/* ************************************************************************
+ *   Busses
+ * ************************************************************************ */
+
+
+/*
+ *  I2C bus
+ *  - might be required by some hardware
+ *  - could be enabled already in display section (config_<MCU>.h)
+ *  - for bit-bang I2C port and pins see I2C_PORT (config_<MCU>.h)
+ *  - hardware I2C (TWI) uses automatically the proper MCU pins
+ *  - uncomment either I2C_BITBANG or I2C_HARDWARE to enable
+ *  - uncomment one of the bus speed modes
+ */
+
+//#define I2C_BITBANG                /* bit-bang I2C */
+//#define I2C_HARDWARE               /* MCU's hardware TWI */
+//#define I2C_STANDARD_MODE          /* 100kHz bus speed */
+//#define I2C_FAST_MODE              /* 400kHz bus speed */
+//#define I2C_RW                     /* enable I2C read support (untested) */
+
+
+/*
+ *  SPI bus
+ *  - might be required by some hardware
+ *  - could be enabled already in display section (config_<MCU>.h)
+ *  - for bit-bang SPI port and pins see SPI_PORT (config_<MCU>.h)
+ *  - hardware SPI uses automatically the proper MCU pins
+ *  - uncomment either SPI_BITBANG or SPI_HARDWARE to enable
+ */
+
+//#define SPI_BITBANG                /* bit-bang SPI */
+//#define SPI_HARDWARE               /* hardware SPI */
+//#define SPI_RW                     /* enable SPI read support */
+
+
+/*
+ *  TTL serial interface
+ *  - could be enabled already in display section (config_<MCU>.h)
+ *  - for bit-bang serial port and pins see SERIAL_PORT (config_<MCU>.h)
+ *  - hardware serial uses automatically the proper MCU pins
+ *  - uncomment either SERIAL_BITBANG or SERIAL_HARDWARE to enable
+ */
+
+//#define SERIAL_BITBANG             /* bit-bang serial */
+//#define SERIAL_HARDWARE            /* hardware serial */
+//#define SERIAL_RW                  /* enable serial read support */
+
+
+/*
+ *  OneWire bus
+ *  - for dedicated I/O pin please see ONEWIRE_PORT (config_<MCU>.h)
+ *  - uncomment either ONEWIRE_PROBES or ONEWIRE_IO_PIN to enable
+ */
+
+//#define ONEWIRE_PROBES             /* via probes */
+//#define ONEWIRE_IO_PIN             /* via dedicated I/O pin */
+
+
+
+/* ************************************************************************
+ *   ADC clock
+ * ************************************************************************ */
+
+
+/*
+ *  ADC clock 
+ *  - The ADC clock is 125000Hz by default.
+ *  - You could also set 250000Hz, but that exceeds the max. ADC clock
+ *    of 200kHz for 10 bit resolution!
+ *  - Special case for 20MHz MCU clock: 156250Hz
+ */
+
+#if CPU_FREQ == 20000000
+  /* 20MHz MCU clock */
+  #define ADC_FREQ    156250
+#else
+  /* all other MCU clocks */
+  #define ADC_FREQ    125000
+#endif
+
+
+/*
+ *  define clock divider
+ *  - supports 1MHz, 2MHz, 4MHz, 8MHz, 16MHz and 20MHz MCU clocks
+ *  - we got only 7 fixed prescalers from 2 up to 128
+ */
+
+/* 1MHz/250kHz */
+#if CPU_FREQ / ADC_FREQ == 4
+  #define ADC_CLOCK_DIV (1 << ADPS1) 
+#endif
+
+/* 1MHz/125kHz 2MHz/250kHz */
+#if CPU_FREQ / ADC_FREQ == 8
+  #define ADC_CLOCK_DIV (1 << ADPS1) | (1 << ADPS0)
+#endif
+
+/* 2MHz/125kHz 4MHz/250kHz */
+#if CPU_FREQ / ADC_FREQ == 16
+  #define ADC_CLOCK_DIV (1 << ADPS2)
+#endif
+
+/* 4MHz/125kHz 8MHz/250kHz */
+#if CPU_FREQ / ADC_FREQ == 32
+  #define ADC_CLOCK_DIV (1 << ADPS2) | (1 << ADPS0)
+#endif
+
+/* 8MHz/125kHz 16MHz/250kHz */
+#if CPU_FREQ / ADC_FREQ == 64
+  #define ADC_CLOCK_DIV (1 << ADPS2) | (1 << ADPS1)
+#endif
+
+/* 16MHz/125kHz 20MHz/156.25kHz */
+#if CPU_FREQ / ADC_FREQ == 128
+  #define ADC_CLOCK_DIV (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0)
+#endif
+
+
+
+/* ************************************************************************
+ *   derived values
+ * ************************************************************************ */
+
+
+/*
+ *  number of MCU cycles per µs
+ *  - min. 1 (for 1MHz)
+ *  - max. 20 (for 20MHz)
+ */
+
+#define MCU_CYCLES_PER_US     (CPU_FREQ / 1000000)
+
+
+/*
+ *  number of MCU cycles per ADC cycle
+ *  - min. 4
+ *  - max. 128
+ */ 
+
+#define MCU_CYCLES_PER_ADC    (CPU_FREQ / ADC_FREQ)
+
+
+/*
+ *  time of a MCU cycle (in 0.1 ns)
+ */
+
+#define MCU_CYCLE_TIME        (10000 / (CPU_FREQ / 1000000))
+
+
+
+/* ************************************************************************
+ *   options management
+ * ************************************************************************ */
+
+
+/*
+ *  storage of program data (EEPROM/Flash)
+ */
+
+#if defined (DATA_EEPROM)
+  /* memory type */
+  #define MEM_TYPE            EEMEM
+
+  /* read functions */
+  #define DATA_read_byte(addr)     eeprom_read_byte(addr)
+  #define DATA_read_word(addr)     eeprom_read_word(addr)
+#elif defined (DATA_FLASH)
+  /* memory type */
+  #define MEM_TYPE            PROGMEM
+
+  /* read functions */
+  #define DATA_read_byte(addr)     pgm_read_byte(addr)
+  #define DATA_read_word(addr)     pgm_read_word(addr)
+#endif
+
+
+/*
+ *  hardware/software options
+ */
+
+
+/* additional keys */
+/* rotary encoder, increase/decrease push buttons or touch screen */
+#if defined (HW_ENCODER) || defined (HW_INCDEC_KEYS) | defined (HW_TOUCH)
+  #define HW_KEYS
+#endif
+
+/* options which require additional keys */
+#ifndef HW_KEYS
+
+  /* key hints */
+  #ifdef UI_KEY_HINTS
+    #undef UI_KEY_HINTS
+  #endif
+
+  /* PWM+ */
+  #ifdef SW_PWM_PLUS
+    #undef SW_PWM_PLUS
+    #define SW_PWM_SIMPLE   
+  #endif
+
+  /* squarewave generator */
+  #ifdef SW_SQUAREWAVE
+    #undef SW_SQUAREWAVE
+  #endif
+
+  /* Servo Check */
+  #ifdef SW_SERVO
+    #undef SW_SERVO
+  #endif
+
+  /* IR Sender */
+  #ifdef SW_IR_TRANSMITTER
+    #undef SW_IR_TRANSMITTER
+  #endif
+
+#endif
+
+
+/* options which require a MCU clock >= 8MHz */
+#if CPU_FREQ < 8000000
+
+  /* ESR measurement */
+  #ifdef SW_ESR
+    #undef SW_ESR
+  #endif
+
+  /* old ESR measurement */
+  #ifdef SW_OLD_ESR
+    #undef SW_OLD_ESR
+  #endif
+
+#endif
+
+
+/* SPI */
+#if defined (SPI_BITBANG) || defined (SPI_HARDWARE)
+  #define HW_SPI
+#endif
+
+/* 9-Bit SPI requires bit-bang mode */
+#ifdef SPI_9
+  #ifndef SPI_BITBANG
+    #error <<< 9-Bit SPI requires bit-bang mode! >>>
+  #endif
+#endif
+
+
+/* I2C */
+#if defined (I2C_BITBANG) || defined (I2C_HARDWARE)
+  #define HW_I2C
+#endif
+
+
+/* TTL serial */
+#if defined (SERIAL_BITBANG) || defined (SERIAL_HARDWARE)
+  #define HW_SERIAL
+#endif
+
+/* VT100 display driver disables other options for serial interface */
+#ifdef LCD_VT100
+  #ifdef UI_SERIAL_COPY
+    #undef UI_SERIAL_COPY
+  #endif
+  #ifdef UI_SERIAL_COMMANDS
+    #undef UI_SERIAL_COMMANDS
+  #endif  
+#endif
+
+/* options which require TTL serial */
+#ifndef HW_SERIAL
+  #ifdef LCD_VT100
+    #undef LCD_VT100
+  #endif
+  #ifdef UI_SERIAL_COPY
+    #undef UI_SERIAL_COPY
+  #endif
+  #ifdef UI_SERIAL_COMMANDS
+    #undef UI_SERIAL_COMMANDS
+  #endif
+#endif
+
+/* options which require TTL serial RW */
+#ifndef SERIAL_RW
+  #ifdef UI_SERIAL_COMMANDS
+    #undef UI_SERIAL_COMMANDS
+  #endif
+#endif
+
+
+/* OneWire: probe leads prevail */
+#ifdef ONEWIRE_PROBES
+  #undef ONEWIRE_IO_PIN
+#endif
+#ifdef ONEWIRE_IO_PIN
+  #undef ONEWIRE_PROBES
+#endif
+
+/* options which require OneWire */
+#if ! defined (ONEWIRE_PROBES) && ! defined (ONEWIRE_IO_PIN)
+  #ifdef SW_DS18B20
+    #undef SW_DS18B20
+  #endif
+#endif
+
+
+/* touchscreen */
+#ifdef TOUCH_PORT
+  #define HW_TOUCH
+#endif
+
+
+/* LCD module */
+#ifdef LCD_CONTRAST
+  #define SW_CONTRAST
+#else
+  #define LCD_CONTRAST        0
+#endif
+
+
+/* color coding for probes requires a color graphics display */
+#ifdef SW_PROBE_COLORS
+  #ifndef LCD_COLOR
+    #undef SW_PROBE_COLORS
+  #endif
+#endif
+
+
+/* component symbols for fancy pinout */
+#if defined (SYMBOLS_24X24_H)
+  #define SW_SYMBOLS
+#endif
+#if defined (SYMBOLS_24X24_HF) || defined (SYMBOLS_30X32_HF) || defined (SYMBOLS_32X32_HF)
+  #define SW_SYMBOLS
+#endif
+#if defined (SYMBOLS_24X24_VFP)
+  #define SW_SYMBOLS
+#endif
+#if defined (SYMBOLS_24X24_VP_F)
+  #define SW_SYMBOLS
+#endif
+
+/* symbols require graphic display */
+#ifdef SW_SYMBOLS
+  #ifndef LCD_GRAPHIC
+    #undef SW_SYMBOLS
+  #endif
+#endif
+
+
+/* frequency counter */
+#if defined (HW_FREQ_COUNTER_BASIC) || defined (HW_FREQ_COUNTER_EXT)
+  #define HW_FREQ_COUNTER
+#endif
+
+
+/* IR detector/decoder: probe lead based decoder prevails */
+#ifdef SW_IR_RECEIVER
+  #undef HW_IR_RECEIVER
+#endif
+#ifdef HW_IR_RECEIVER
+  #undef SW_IR_RECEIVER
+#endif
+
+
+/* rounding for DS18B20 requires DS18B20 support */
+#ifdef UI_ROUND_DS18B20
+  #ifndef SW_DS18B20
+    #undef UI_ROUND_DS18B20
+  #endif
+#endif
+
+
+
+/* ************************************************************************
+ *   EOF
+ * ************************************************************************ */

+ 855 - 0
transistor-tester/firmware/1.39m/config_328.h

@@ -0,0 +1,855 @@
+/* ************************************************************************
+ *
+ *   ATmega 328 specific global configuration, setup and settings
+ *
+ *   (c) 2012-2020 by Markus Reschke
+ *   based on code from Markus Frejek and Karl-Heinz Kübbeler
+ *
+ * ************************************************************************ */
+
+
+/* source management */
+#define CONFIG_328_H
+
+
+
+/* ************************************************************************
+ *   LCD module
+ * ************************************************************************ */
+
+
+/*
+ *  LCD module / controller
+ *
+ *  Please uncomment the package matching your LCD module and adjust
+ *  settings. And comment out the default package if not used.
+ *
+ *  To uncomment, remove the enclosing "#if 0" and "#endif" or put
+ *  a "//" in front of both. To comment out, remove the "//" in front
+ *  of the "#if 0" and "#endif".
+ *
+ *  Individual settings can be enabled by removing the leading "//", or
+ *  disabled by placing a "//" in front of the setting.
+ */
+
+
+/*
+ *  HD44780, 4 bit parallel interface
+ *  - if you change LCD_DB4/5/6/7 comment out LCD_DB_STD!
+ */
+
+#if 0
+#define LCD_HD44780                     /* display controller HD44780 */
+#define LCD_TEXT                        /* character display */
+#define LCD_PAR_4                       /* 4 bit parallel interface */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_DB_STD                      /* use standard pins 0-3 for DB4-7 */
+#define LCD_DB4          PD0            /* port pin used for DB4 */
+#define LCD_DB5          PD1            /* port pin used for DB5 */
+#define LCD_DB6          PD2            /* port pin used for DB6 */
+#define LCD_DB7          PD3            /* port pin used for DB7 */
+#define LCD_RS           PD4            /* port pin used for RS */
+#define LCD_EN1          PD5            /* port pin used for E */
+#define LCD_CHAR_X       16             /* characters per line */
+#define LCD_CHAR_Y       2              /* number of lines */
+/* HD44780 has an internal 5x7 font */
+#define FONT_HD44780_INT                /* International font (English) */
+//#define FONT_HD44780_WIN1251            /* Cyrillic font (European) */
+#endif
+
+
+
+/*
+ *  HD44780, PCF8574 based backpack (bit-bang I2C)
+ *  - if you change LCD_DB4/5/6/7 comment out LCD_DB_STD!
+ *  - PCF8574T is 0x27, PCF8574AT is 0x3f
+ */
+
+#if 0
+#define LCD_HD44780                     /* display controller HD44780 */
+#define LCD_TEXT                        /* character display */
+#define LCD_PCF8574                     /* PCF8574 backpack */
+#define LCD_I2C_ADDR     0x3f           /* PCF8574's I2C address */
+#define LCD_DB_STD                      /* use standard pins 4-7 for DB4-7 */
+#define LCD_DB4          PCF8574_P4     /* port pin used for DB4 */
+#define LCD_DB5          PCF8574_P5     /* port pin used for DB5 */
+#define LCD_DB6          PCF8574_P6     /* port pin used for DB6 */
+#define LCD_DB7          PCF8574_P7     /* port pin used for DB7 */
+#define LCD_RS           PCF8574_P0     /* port pin used for RS */
+#define LCD_RW           PCF8574_P1     /* port pin used for RW */
+#define LCD_EN1          PCF8574_P2     /* port pin used for E */
+#define LCD_LED          PCF8574_P3     /* port pin used for backlight */
+#define LCD_CHAR_X       16             /* characters per line */
+#define LCD_CHAR_Y       2              /* number of lines */
+/* HD44780 has an internal 5x7 font */
+#define FONT_HD44780_INT                /* International font (English) */
+//#define FONT_HD44780_WIN1251             /* Cyrillic font (European) */
+#define I2C_BITBANG                     /* bit-bang I2C */
+#define I2C_STANDARD_MODE               /* 100kHz bus speed */
+#define I2C_PORT         PORTD          /* I2C port data register */
+#define I2C_DDR          DDRD           /* I2C port data direction register */
+#define I2C_PIN          PIND           /* I2C port input pins register */
+#define I2C_SDA          PD0            /* port pin used for SDA */
+#define I2C_SCL          PD1            /* port pin used for SCL */
+#endif
+
+
+
+/*
+ *  ST7565R, SPI interface (bit-bang)
+ *  - settings for Electronic Assembly EA DOGM/DOGL128-6
+ *  - uses LCD_CS to support rotary encoder in parallel at PD2/3
+ */
+
+#if 0
+#define LCD_ST7565R                     /* display controller ST7565R */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_SPI                         /* SPI interface */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RESET        PD0            /* port pin used for /RES (optional) */
+#define LCD_CS           PD5            /* port pin used for /CS1 (optional) */
+#define LCD_A0           PD1            /* port pin used for A0 */
+#define LCD_SCL          PD2            /* port pin used for SCL */
+#define LCD_SI           PD3            /* port pin used for SI (LCD's data input) */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       64             /* number of vertical dots */
+//#define LCD_FLIP_X                      /* enable horizontal flip */
+#define LCD_OFFSET_X                    /* enable x offset of 4 dots */
+#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_START_Y      0              /* start line (0-63) */
+#define LCD_CONTRAST     22             /* default contrast (0-63) */
+/* font and symbols: vertically aligned & flipped, bank-wise grouping */
+//#define FONT_6X8_VF                      /* 6x8 font */
+#define FONT_8X8_VF                     /* 8x8 font */
+//#define FONT_8X16_VFP                   /* 8x16 font */
+//#define FONT_6X8_ISO8859_2_VF           /* 6x8 Central European font */
+//#define FONT_8X8_ISO8859_2_VF           /* 8x8 Central European font */
+//#define FONT_8X12T_ISO8859_2_VFP        /* thin 8x12 Central European font */
+//#define FONT_8X16_ISO8859_2_VFP         /* 8x16 Central European font */
+//#define FONT_8X8_WIN1251_VF             /* 8x8 cyrillic font */
+//#define FONT_8X8T_WIN1251_VF            /* thin 8x8 cyrillic font */
+//#define FONT_8X12T_WIN1251_VFP          /* thin 8x12 cyrillic font */
+//#define FONT_8X16_WIN1251_VFP           /* 8x16 cyrillic font */
+#define SYMBOLS_24X24_VFP               /* 24x24 symbols */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCL        /* port pin used for SCK */
+#define SPI_MOSI         LCD_SI         /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  ILI9342, SPI interface (bit-bang)
+ */
+
+#if 0
+#define LCD_ILI9341                     /* display controller ILI9341/ILI9342 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_COLOR                       /* color display */
+#define LCD_SPI                         /* SPI interface */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RES          PD4            /* port pin used for /RES (optional) */
+#define LCD_CS           PD5            /* port pin used for /CS (optional) */
+#define LCD_DC           PD3            /* port pin used for D/C */
+#define LCD_SCK          PD2            /* port pin used for SCK */
+#define LCD_SDI          PD1            /* port pin used for SDI (LCD's data input) */
+//#define LCD_SDO          PD0            /* port pin used for SDO (LCD's data output) */
+#define LCD_DOTS_X       320            /* number of horizontal dots */
+#define LCD_DOTS_Y       240            /* number of vertical dots */
+//#define LCD_FLIP_X                      /* enable horizontal flip */
+//#define LCD_FLIP_Y                      /* enable vertical flip */
+//#define LCD_ROTATE                      /* switch X and Y (rotate by 90°) */
+/* font and symbols: horizontally aligned & flipped */
+#define FONT_16X26_HF                   /* 16x26 font */
+//#define FONT_16X26_ISO8859_2_HF         /* 16x26 Central European font */
+#define SYMBOLS_32X32_HF                /* 32x32 symbols */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCK        /* port pin used for SCK */
+#define SPI_MOSI         LCD_SDI        /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  ST7735, SPI interface (bit-bang, 4 wire)
+ */
+
+#if 1
+#define LCD_ST7735                      /* display controller ST7735 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_COLOR                       /* color display */
+#define LCD_SPI                         /* SPI interface */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RES          PD0            /* port pin used for /RESX (optional) */
+#define LCD_CS           PD5            /* port pin used for /CSX (optional) */
+#define LCD_DC           PD1            /* port pin used for D/CX */
+#define LCD_SCL          PD2            /* port pin used for SCL */
+#define LCD_SDA          PD3            /* port pin used for SDA */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       160            /* number of vertical dots */
+#define LCD_FLIP_X                      /* enable horizontal flip */
+//#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_ROTATE                      /* switch X and Y (rotate by 90°) */
+//#define LCD_OFFSET_X     4               /* enable x offset of 2 or 4 dots */
+//#define LCD_OFFSET_Y     2               /* enable y offset of 1 or 2 dots */
+#define LCD_LATE_ON                     /* turn on LCD after clearing it */
+/* font and symbols: horizontally aligned & flipped */
+#define FONT_10X16_HF                   /* 10x16 font */
+//#define FONT_10X16_ISO8859_2_HF         /* 10x16 Central European font */
+//#define FONT_8X16_WIN1251_HF            /* 8x16 cyrillic font */
+#define SYMBOLS_24X24_HF                /* 24x24 symbols */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCL        /* port pin used for SCK */
+#define SPI_MOSI         LCD_SDA        /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  PCD8544, SPI interface (bit-bang)
+ *  - for a 180° rotated display (LCD_ROT180)
+ *    - comment out "_VF" font and "_VFP" symbols
+ *    - uncomment "_V_F" font and "_VP_F" symbols
+ */
+
+#if 0
+#define LCD_PCD8544                     /* display controller PCD8544 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_SPI                         /* SPI interface */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RES          PD4            /* port pin used for /RES (optional) */
+#define LCD_SCE          PD5            /* port pin used for /SCE (optional) */
+#define LCD_DC           PD3            /* port pin used for D/C */
+#define LCD_SCLK         PD2            /* port pin used for SCLK */
+#define LCD_SDIN         PD1            /* port pin used for SDIN (LCD's data input) */
+#define LCD_DOTS_X       84             /* number of horizontal dots */
+#define LCD_DOTS_Y       48             /* number of vertical dots */
+#define LCD_CONTRAST     66             /* default contrast (1-127) */
+/* font and symbols: vertically aligned & flipped */
+#define FONT_6X8_VF                     /* 6x8 font */
+//#define FONT_6X8_ISO8859_2_VF         /* 6x8 Central Euopean font */
+#define SYMBOLS_24X24_VFP               /* 24x24 symbols, vertically aligned & flipped */
+//#define LCD_ROT180                      /* rotate output by 180° (not supported yet) */
+/* font and symbols: vertically aligned, bank-wise grouping, hor. flipped */
+//#define FONT_6X8_V_F                    /* 6x8 font */
+//#define FONT_6X8_ISO8859_2_V_F          /* 6x8 Central Euopean font */
+//#define SYMBOLS_24X24_VP_F              /* 24x24 symbols */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCLK       /* port pin used for SCK */
+#define SPI_MOSI         LCD_SDIN       /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  ST7920, SPI interface (bit-bang)
+ *  - for a 180° rotated display (LCD_ROT180)
+ *    - comment out "_H" font and symbols
+ *    - uncomment "_HF" font and symbols
+ */
+
+#if 0
+#define LCD_ST7920                      /* display controller ST7920 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_SPI                         /* SPI interface */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RESET        PD4            /* port pin used for /RESET (optional) */
+#define LCD_CS           PD5            /* port pin used for CS (optional) */
+#define LCD_SCLK         PD2            /* port pin used for SCLK */
+#define LCD_SID          PD1            /* port pin used for SID (LCD's data input) */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       64             /* number of vertical dots */
+/* font and symbols: horizonally aligned */
+#define FONT_8X8_H                      /* 8x8 font  */
+//#define FONT_8X8_ISO8859_2_H            /* 8x8 Central European font */
+#define SYMBOLS_24X24_H                 /* 24x24 symbols */
+//#define LCD_ROT180                      /* rotate output by 180° */
+/* font and symbols: horizonally aligned & flipped */
+//#define FONT_8X8_HF                     /* 8x8 font */
+//#define FONT_8X8_ISO8859_2_HF           /* 8x8 Central European font */
+//#define SYMBOLS_24X24_HF                /* 24x24 symbols */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCLK       /* port pin used for SCK */
+#define SPI_MOSI         LCD_SID        /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  ST7920, 4 bit parallel interface
+ *  - if you change LCD_DB4/5/6/7 comment out LCD_DB_STD!
+ *  - for a 180° rotated display (LCD_ROT180)
+ *    - comment out "_H" font and symbol
+ *    - uncomment "_HF" font and symbol
+ */
+
+#if 0
+#define LCD_ST7920                      /* display controller ST7920 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_PAR_4                       /* 4 bit parallel interface */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_DB_STD                      /* use standard pins 0-3 for DB4-7 */
+#define LCD_DB4          PD0            /* port pin used for DB4 */
+#define LCD_DB5          PD1            /* port pin used for DB5 */
+#define LCD_DB6          PD2            /* port pin used for DB6 */
+#define LCD_DB7          PD3            /* port pin used for DB7 */
+#define LCD_RS           PD4            /* port pin used for RS */
+#define LCD_EN           PD5            /* port pin used for E */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       64             /* number of vertical dots */
+/* font and symbols: horizonally aligned */
+#define FONT_8X8_H                      /* 8x8 font */
+#define SYMBOLS_24X24_H                 /* 24x24 symbols */
+//#define LCD_ROT180                      /* rotate output by 180° */
+/* font and symbols: horizonally aligned & flipped */
+//#define FONT_8X8_HF                     /* 8x8 font */
+//#define SYMBOLS_24X24_HF                /* 24x24 symbols */
+#endif
+
+
+/*
+ *  ILI9163, SPI interface (bit-bang, 4 wire)
+ */
+
+#if 0
+#define LCD_ILI9163                     /* display controller ILI9163 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_COLOR                       /* color display */
+#define LCD_SPI                         /* SPI interface */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RES          PD4            /* port pin used for /RESX (optional) */
+#define LCD_CS           PD5            /* port pin used for /CSX (optional) */
+#define LCD_DC           PD3            /* port pin used for D/CX */
+#define LCD_SCL          PD2            /* port pin used for SCL */
+#define LCD_SDA          PD1            /* port pin used for SDA/SDIO */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       128            /* number of vertical dots */
+#define LCD_OFFSET_X      32            /* x offset of 32 dots (160-128) */
+//#define LCD_FLIP_X                      /* enable horizontal flip */
+#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_ROTATE                      /* switch X and Y (rotate by 90°) */
+//#define LCD_LATE_ON                     /* turn on LCD after clearing it */
+/* font and symbols: horizonally aligned & flipped */
+#define FONT_8X8_HF                     /* 8x8 font */
+//#define FONT_10X16_HF                   /* 10x16 font */
+//#define FONT_8X8_ISO8859_2_HF           /* 8x8 Central European font */
+//#define FONT_8X16_WIN1251_HF            /* 8x16 cyrillic font */
+#define SYMBOLS_30X32_HF                /* 30x32 symbols */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCL        /* port pin used for SCK */
+#define SPI_MOSI         LCD_SDA        /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  SSD1306, SPI interface (bit-bang, 4 wire)
+ */
+
+#if 0
+#define LCD_SSD1306                     /* display controller SSD1306 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_SPI                         /* SPI interface */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RESET        PD4            /* port pin used for /RES (optional) */
+#define LCD_CS           PD5            /* port pin used for /CS (optional) */
+#define LCD_DC           PD3            /* port pin used for D/C */
+#define LCD_SCLK         PD2            /* port pin used for SCLK */
+#define LCD_SDIN         PD1            /* port pin used for SDIN (LCD's data input) */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       64             /* number of vertical dots */
+#define LCD_FLIP_X                      /* enable horizontal flip */
+#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_CONTRAST     127            /* default contrast (0-255) */
+/* font and symbols: vertically aligned & flipped, bank-wise grouping */
+//#define FONT_6X8_VF                      /* 6x8 font */
+#define FONT_8X8_VF                     /* 8x8 font */
+//#define FONT_8X16_VFP                   /* 8x16 font */
+//#define FONT_6X8_ISO8859_2_VF           /* 6x8 Central European font */
+//#define FONT_8X8_ISO8859_2_VF           /* 8x8 Central European font */
+//#define FONT_8X12T_ISO8859_2_VFP        /* thin 8x12 Central European font */
+//#define FONT_8X16_ISO8859_2_VFP         /* 8x16 Central European font */
+//#define FONT_8X8_WIN1251_VF             /* 8x8 cyrillic font */
+//#define FONT_8X8T_WIN1251_VF            /* thin 8x8 cyrillic font */
+//#define FONT_8X12T_WIN1251_VFP          /* thin 8x12 cyrillic font */
+//#define FONT_8X16_WIN1251_VFP           /* 8x16 cyrillic font */
+#define SYMBOLS_24X24_VFP               /* 24x24 symbols */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCLK       /* port pin used for SCK */
+#define SPI_MOSI         LCD_SDIN       /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  SSD1306, SPI interface (bit-bang, 3 wire)
+ */
+
+#if 0
+#define LCD_SSD1306                     /* display controller SSD1306 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_SPI                         /* SPI interface */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RESET        PD4            /* port pin used for /RES (optional) */
+#define LCD_CS           PD5            /* port pin used for /CS (optional) */
+#define LCD_SCLK         PD2            /* port pin used for SCLK */
+#define LCD_SDIN         PD1            /* port pin used for SDIN (LCD's data input) */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       64             /* number of vertical dots */
+#define LCD_FLIP_X                      /* enable horizontal flip */
+#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_CONTRAST     127            /* default contrast (0-255) */
+/* font and symbols: vertically aligned & flipped, bank-wise grouping */
+#define FONT_8X8_VF                     /* 8x8 font */
+#define SYMBOLS_24X24_VFP               /* 24x24 symbols */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_9                           /* support 9 bit frames */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCLK       /* port pin used for SCK */
+#define SPI_MOSI         LCD_SDIN       /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  SSD1306, I2C interface (bit-bang)
+ */
+
+#if 0
+#define LCD_SSD1306                     /* display controller SSD1306 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_I2C                         /* I2C interface */
+#define LCD_I2C_ADDR     0x3c           /* SSD1306's I2C address */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RESET        PD4            /* port pin used for /RES (optional) */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       64             /* number of vertical dots */
+#define LCD_FLIP_X                      /* enable horizontal flip */
+#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_CONTRAST     127            /* default contrast (0-255) */
+/* font and symbols: vertically aligned & flipped, bank-wise grouping */
+#define FONT_8X8_VF                     /* 8x8 font */
+#define SYMBOLS_24X24_VFP               /* 24x24 symbols */
+#define I2C_BITBANG                     /* bit-bang I2C */
+#define I2C_FAST_MODE                   /* 400kHz bus speed */
+#define I2C_PORT         PORTD          /* I2C port data register */
+#define I2C_DDR          DDRD           /* I2C port data direction register */
+#define I2C_PIN          PIND           /* I2C port input pins register */
+#define I2C_SDA          PD0            /* port pin used for SDA */
+#define I2C_SCL          PD1            /* port pin used for SCL */
+#endif
+
+
+
+/*
+ *  STE2007, SPI interface (bit-bang, 3 wire)
+ */
+
+#if 0
+#define LCD_STE2007                     /* display controller STE2007 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_SPI                         /* SPI interface */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RESET        PD4            /* port pin used for /RES (optional) */
+#define LCD_CS           PD5            /* port pin used for /CS (optional) */
+#define LCD_SCLK         PD2            /* port pin used for SCLK */
+#define LCD_SDIN         PD1            /* port pin used for SDIN (LCD's data input) */
+#define LCD_DOTS_X       96             /* number of horizontal dots */
+#define LCD_DOTS_Y       68             /* number of vertical dots */
+//#define LCD_FLIP_X                      /* enable horizontal flip */
+//#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_CONTRAST     16             /* default contrast (0-31) */
+/* font and symbols: vertically aligned & flipped */
+#define FONT_6X8_VF                     /* 6x8 font */
+//#define FONT_6X8_ISO8859_2_VF             /* 6x8 Central European font */
+#define SYMBOLS_24X24_VFP               /* 24x24 symbols  */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_9                           /* support 9 bit frames */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCLK       /* port pin used for SCK */
+#define SPI_MOSI         LCD_SDIN       /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  PCF8814, SPI interface (bit-bang, 3 wire)
+ */
+
+#if 0
+#define LCD_PCF8814                     /* display controller PCF8814 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_SPI                         /* SPI interface */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RESET        PD4            /* port pin used for /RES */
+#define LCD_CS           PD5            /* port pin used for /CS (optional) */
+#define LCD_SCLK         PD2            /* port pin used for SCLK */
+#define LCD_SDIN         PD1            /* port pin used for SDIN (LCD's data input) */
+#define LCD_DOTS_X       96             /* number of horizontal dots */
+#define LCD_DOTS_Y       65             /* number of vertical dots */
+//#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_CONTRAST     5              /* default contrast (0-255) */
+/* font and symbols: vertically aligned & flipped, page-wise grouping */
+#define FONT_6X8_VF                     /* 6x8 font */
+//#define FONT_6X8_ISO8859_2_VF             /* 6x8 Central European font */
+#define SYMBOLS_24X24_VFP               /* 24x24 symbols */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_9                           /* support 9 bit frames */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCLK       /* port pin used for SCK */
+#define SPI_MOSI         LCD_SDIN       /* port pin used for MOSI */
+#endif
+
+
+/*
+ *  ST7036, 4 bit parallel interface
+ *  - enable LCD_DB_STD when using port pins 0-3 for LCD_DB4/5/6/7
+ *  - untested!!!
+ */
+
+#if 0
+#define LCD_ST7036                      /* display controller ST7036 */
+#define LCD_TEXT                        /* character display */
+#define LCD_PAR_4                       /* 4 bit parallel interface */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+//#define LCD_DB_STD                      /* use standard pins 0-3 for DB4-7 */
+#define LCD_DB4          PD0            /* port pin used for DB4 */
+#define LCD_DB5          PD1            /* port pin used for DB5 */
+#define LCD_DB6          PD2            /* port pin used for DB6 */
+#define LCD_DB7          PD3            /* port pin used for DB7 */
+#define LCD_RS           PD4            /* port pin used for RS */
+#define LCD_EN           PD5            /* port pin used for E */
+//#define LCD_RW           ???            /* port pin used for R/W (optional) */
+//#define LCD_RESET        ???            /* port pin used for XRESET (optional) */
+#define LCD_CHAR_X       16             /* characters per line */
+#define LCD_CHAR_Y       3              /* number of lines */
+#define LCD_EXTENDED_CMD                /* extended instruction set (EXT pin high) */
+#define LCD_CONTRAST     32             /* default contrast (0-63) */
+/* ST7036 has internal 5x8 font */
+#define FONT_ST7036                     /* 5x8 font */
+#endif
+
+
+
+/*
+ *  ST7036, SPI interface (bit-bang, 4 wire)
+ *  - untested!!!
+ */
+
+#if 0
+#define LCD_ST7036                      /* display controller ST7036 */
+#define LCD_TEXT                        /* character display */
+#define LCD_SPI                         /* SPI interface */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RESET        PD4            /* port pin used for XRESET (optional) */
+#define LCD_CS           PD5            /* port pin used for CSB (optional) */
+#define LCD_RS           PD3            /* port pin used for RS */
+#define LCD_SCL          PD2            /* port pin used for SCL */
+#define LCD_SI           PD1            /* port pin used for SI (LCD's data input) */
+#define LCD_CHAR_X       16             /* characters per line */
+#define LCD_CHAR_Y       3              /* number of lines */
+#define LCD_EXTENDED_CMD                /* extended instruction set (EXT pin high) */
+#define LCD_CONTRAST     32             /* default contrast (0-63) */
+/* ST7036 has internal 5x8 font */
+#define FONT_ST7036                     /* 5x8 font */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCL        /* port pin used for SCK */
+#define SPI_MOSI         LCD_SI         /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  VT100 serial terminal, TTL serial
+ */
+
+#if 0
+#define LCD_VT100                       /* pseudo display VT100 */
+#define LCD_TEXT                        /* character display */
+#define LCD_COLOR                       /* color display */
+#define LCD_CHAR_X       40             /* characters per line */
+#define LCD_CHAR_Y       24             /* number of lines */
+#define SERIAL_BITBANG                  /* bit-bang serial */
+//#define SERIAL_HARDWARE                 /* hardware serial */
+#endif
+
+
+
+/*
+ *  check if a LCD module is specified
+ */
+
+#if !defined(LCD_TEXT) && !defined(LCD_GRAPHIC)
+  #error <<< No LCD module specified! >>>
+#endif
+
+
+
+/* ************************************************************************
+ *   port and pin assignments
+ * ************************************************************************ */
+
+
+/*
+ *  Test probes:
+ *  - Must be an ADC port
+ *  - Lower 3 pins of the port must be used for probe pins.
+ *  - Please don't change the definitions of TP1, TP2 and TP3!
+ *  - Don't share this port with POWER_CTRL or TEST_BUTTON!
+ */
+
+#define ADC_PORT         PORTC     /* ADC port data register */
+#define ADC_DDR          DDRC      /* ADC port data direction register */
+#define ADC_PIN          PINC      /* port input pins register */
+#define TP1              PC0       /* test pin 1 */
+#define TP2              PC1       /* test pin 2 */
+#define TP3              PC2       /* test pin 3 */
+
+#define TP_ZENER         PC3       /* test pin with 10:1 voltage divider */
+#define TP_REF           PC4       /* test pin with 2.5V reference and relay */
+#define TP_BAT           PC5       /* test pin with 4:1 voltage divider */
+
+
+/*
+ *  Probe resistors
+ *  - For PWM/squarewave output via probe #2 R_RL_2 has to be PB2/OC1B.
+ *  - Don't share this port with POWER_CTRL or TEST_BUTTON!
+ */
+
+#define R_PORT           PORTB     /* port data register */
+#define R_DDR            DDRB      /* port data direction register */
+#define R_RL_1           PB0       /* Rl (680R) for test pin #1 */
+#define R_RH_1           PB1       /* Rh (470k) for test pin #1 */
+#define R_RL_2           PB2       /* Rl (680R) for test pin #2 */
+#define R_RH_2           PB3       /* Rh (470k) for test pin #2 */
+#define R_RL_3           PB4       /* Rl (680R) for test pin #3 */
+#define R_RH_3           PB5       /* Rh (470k) for test pin #3 */
+
+
+/*
+ *  dedicated signal output via OC1B
+ *  - don't change this!
+ */
+
+#define SIGNAL_PORT      PORTB     /* port data register */
+#define SIGNAL_DDR       DDRB      /* port data direction register */
+#define SIGNAL_OUT       PB2       /* MCU's OC1B pin */
+
+
+/*
+ *  power control
+ *  - can't be same port as ADC_PORT or R_PORT
+ */
+
+#define POWER_PORT       PORTD     /* port data register */
+#define POWER_DDR        DDRD      /* port data direction register */
+#define POWER_CTRL       PD6       /* controls power (1: on / 0: off) */
+
+
+/*
+ *  test push button 
+ *  - can't be same port as ADC_PORT or R_PORT
+ */
+
+#define BUTTON_PORT      PORTD     /* port data register */
+#define BUTTON_DDR       DDRD      /* port data direction register */
+#define BUTTON_PIN       PIND      /* port input pins register */
+#define TEST_BUTTON      PD7       /* test/start push button (low active) */
+
+
+/*
+ *  rotary encoder
+ */
+
+#define ENCODER_PORT     PORTD     /* port data register */
+#define ENCODER_DDR      DDRD      /* port data direction register */
+#define ENCODER_PIN      PIND      /* port input pins register */
+#define ENCODER_A        PD1       /* rotary encoder A signal */
+#define ENCODER_B        PD3       /* rotary encoder B signal */
+
+
+/*
+ *  increase/decrease push buttons
+ */
+
+#define KEY_PORT         PORTD     /* port data register */
+#define KEY_DDR          DDRD      /* port data direction register */
+#define KEY_PIN          PIND      /* port input pins register */
+#define KEY_INC          PD2       /* increase push button (low active) */
+#define KEY_DEC          PD3       /* decrease push button (low active) */
+
+
+/*
+ *  frequency counter
+ *  - input must be pin PD4/T0
+ */
+
+#define COUNTER_PORT     PORTD     /* port data register */
+#define COUNTER_DDR      DDRD      /* port data direction register */
+#define COUNTER_IN       PD4       /* signal input T0 */
+
+
+/*
+ *  IR detector/decoder
+ *  - fixed module connected to dedicated I/O pin
+ */
+
+#define IR_PORT          PORTC     /* port data register */
+#define IR_DDR           DDRC      /* port data direction register */
+#define IR_PIN           PINC      /* port input pins register */
+#define IR_DATA          PC6       /* data signal */
+
+
+/*
+ *  SPI
+ *  - hardware SPI uses PB5, PB3 and PB4
+ *  - could be already set in display section
+ */
+
+/* for bit-bang SPI */
+#ifndef SPI_PORT
+#define SPI_PORT         PORTB     /* port data register */
+#define SPI_DDR          DDRB      /* port data direction register */
+#define SPI_PIN          PINB      /* port input pins register */
+#define SPI_SCK          PB5       /* pin for SCK */
+#define SPI_MOSI         PB3       /* pin for MOSI */
+#define SPI_MISO         PB4       /* pin for MISO */
+#endif
+
+
+/*
+ *  I2C
+ *  - hardware I2C (TWI) uses PC4 & PC5
+ *  - could be already set in display section
+ */
+
+/* for bit-bang I2C */
+#ifndef I2C_PORT
+#define I2C_PORT         PORTC     /* port data register */
+#define I2C_DDR          DDRC      /* port data direction register */
+#define I2C_PIN          PINC      /* port input pins register */
+#define I2C_SDA          PC4       /* pin for SDA */
+#define I2C_SCL          PC5       /* pin for SCL */
+#endif
+
+
+/*
+ *  TTL serial interface
+ *  - hardware USART0 uses PD0 & PD1
+ */
+
+/* for hardware RS232 */
+#define SERIAL_USART     0         /* use USART0 */
+/* for bit-bang RS232 */
+#define SERIAL_PORT      PORTD     /* port data register */
+#define SERIAL_DDR       DDRD      /* port data direction register */
+#define SERIAL_PIN       PIND      /* port input pins register */
+#define SERIAL_TX        PD1       /* pin for Tx (transmit) */
+#define SERIAL_RX        PD0       /* pin for Rx (receive) */
+#define SERIAL_PCINT     16        /* PCINT# for Rx pin */
+
+
+/*
+ *  OneWire
+ *  - dedicated I/O pin
+ */
+
+#define ONEWIRE_PORT     PORTC     /* port data register */
+#define ONEWIRE_DDR      DDRC      /* port data direction register */
+#define ONEWIRE_PIN      PINC      /* port input pins register */
+#define ONEWIRE_DQ       PC6       /* DQ (data line) */
+
+
+
+/* ************************************************************************
+ *   internal stuff
+ * ************************************************************************ */
+
+
+/* ADC reference selection: AVcc */
+#define ADC_REF_VCC           (1 << REFS0)
+
+/* ADC reference selection: internal 1.1V bandgap */
+#define ADC_REF_BANDGAP       ((1 << REFS1) | (1 << REFS0))
+
+/* ADC reference selection bit mask */
+#define ADC_REF_MASK          ((1 << REFS1) | (1 << REFS0))
+
+/* ADC MUX channel for internal 1.1V bandgap reference */
+#define ADC_BANDGAP      0x0e      /* 1110 */
+
+
+
+/* ************************************************************************
+ *   MCU specific setup to support different AVRs
+ * ************************************************************************ */
+
+
+/*
+ *  ATmega 328/328P
+ */
+
+#if defined(__AVR_ATmega328__)
+
+  /* estimated internal resistance of port to GND (in 0.1 Ohms) */
+  #define R_MCU_LOW           200
+
+  /* estimated internal resistance of port to VCC (in 0.1 Ohms) */
+  #define R_MCU_HIGH          220
+
+  /* voltage offset of MCU's analog comparator (in mV): -50 up to 50 */
+  #define COMPARATOR_OFFSET   0
+
+  /* this MCU has 32kB Flash, 1kB EEPROM and 2kB RAM (enable extra features) */
+  #define RES_FLASH           32
+  #define RES_EEPROM          1
+  #define RES_RAM             2
+
+
+/*
+ *  missing or unsupported MCU
+ */
+
+#else
+  #error <<< No or wrong MCU type selected! >>>
+#endif
+
+
+
+/* ************************************************************************
+ *   EOF
+ * ************************************************************************ */

+ 387 - 0
transistor-tester/firmware/1.42m/Makefile

@@ -0,0 +1,387 @@
+#
+#  Makefile
+#
+#  (c) 2012-2020 by Markus Reschke
+#  based on code from Markus Frejek and Karl-Heinz K�bbeler
+#
+
+PROJECT = ComponentTester
+
+
+#
+# MCU settings
+# - Edit to match your setup!
+#
+
+# avr-gcc: MCU model
+# - ATmega 328/328P        : atmega328
+# - ATmega 328PB           : atmega328pb
+# - ATmega 324P/324PA      : atmega324p
+# - ATmega 640             : atmega640
+# - ATmega 644/644P/644PA  : atmega644
+# - ATmega 1280            : atmega1280
+# - ATmega 1284/1284P      : atmega1284
+# - ATmega 2560            : atmega2560
+MCU = atmega328
+
+# MCU freqency:
+# - 1MHz  : 1
+# - 8MHz  : 8
+# - 16MHz : 16
+# - 20MHz : 20
+FREQ = 16
+
+# oscillator type
+# - internal RC oscillator      : RC
+# - external full swing crystal : Crystal
+# - external low power crystal  : LowPower
+OSCILLATOR = Crystal
+
+# oscillator start-up cycles
+# - Crystal and LowPower could also be 1024 or 256 based on fuse settings
+ifeq (${OSCILLATOR},RC)
+  OSC_STARTUP = 6
+endif
+ifeq (${OSCILLATOR},Crystal)
+  OSC_STARTUP = 16384
+endif
+ifeq (${OSCILLATOR},LowPower)
+  OSC_STARTUP = 16384
+endif
+
+
+#
+# avrdude settings
+# - Edit to match your setup!
+#
+
+# avrdude: part number of MCU
+# - ATmega 328    : m328
+# - ATmega 328P   : m328p
+# - ATmega 328PB  : m328pb
+# - ATmega 324P   : m324p
+# - ATmega 324PA  : m324pa
+# - ATmega 640    : m640
+# - ATmega 644    : m644
+# - ATmega 644P   : m644p
+# - ATmega 644PA  : m644p
+# - ATmega 1280   : m1280
+# - ATmega 1284   : m1284
+# - ATmega 1284P  : m1284p
+# - ATmega 2560   : m2560
+PARTNO = m328p
+
+# avrdude: ISP programmer, port and options
+
+# Arduino as ISP
+#PROGRAMMER = stk500v1
+#PORT = /dev/ttyACM0
+#OPTIONS = -b 19200
+
+# Bus Pirate
+#PROGRAMMER = buspirate
+#PORT = /dev/bus_pirate
+#OPTIONS = -B 10.0
+
+# Diamex ALL-AVR/AVR-Prog
+PROGRAMMER = avrispmkII
+PORT = usb
+OPTIONS = -B 1.0
+
+# Pololu USB AVR Programmer
+#PROGRAMMER = stk500v2
+#PORT = /dev/ttyACM0
+#OPTIONS = -B 1.0
+
+# USBasp
+#PROGRAMMER = usbasp
+#PORT = usb
+#OPTIONS = -B 20
+
+# USBtinyISP
+#PROGRAMMER = usbtiny
+#PORT = usb
+#OPTIONS = -B 5.0
+
+# Arduino Uno bootloader via serial/USB
+#PROGRAMMER = arduino
+#PORT = /dev/ttyACM0
+#OPTIONS = -D -b 115200
+
+# Arduino Mega2560 bootloader via serial/USB
+#PROGRAMMER = wiring
+#PORT = /dev/ttyACM0
+#OPTIONS = -D -b 115200
+
+
+#
+#  global settings
+#
+
+# project name
+NAME = ComponentTester
+
+# name and version based on directory name
+DIST = $(notdir ${CURDIR})
+
+# compiler flags
+CC = avr-gcc
+CPP = avr-g++
+CFLAGS = -mmcu=${MCU} -Wall -I. -Ibitmaps
+CFLAGS += -DF_CPU=${FREQ}000000UL
+CFLAGS += -DOSC_STARTUP=${OSC_STARTUP}
+CFLAGS += -gdwarf-2 -std=gnu99 -Os -mcall-prologues
+CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
+#CFLAGS += -flto
+CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d
+
+# linker flags
+LDFLAGS = -mmcu=${MCU} -Wl,-Map=${NAME}.map
+
+# hex file flags
+HEX_FLASH_FLAGS = -R .eeprom -R .fuse -R .lock -R .signature
+HEX_EEPROM_FLAGS = -j .eeprom
+HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load"
+HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings
+
+# header files
+HEADERS = config.h config_328.h config_644.h config_1280.h
+HEADERS += colors.h common.h functions.h variables.h $(wildcard var_*.h)
+HEADERS += OneWire.h ADS7843.h
+HEADERS += HD44780.h ILI9163.h ILI9341.h ILI9481.h ILI9486.h ILI9488.h
+HEADERS += PCD8544.h PCF8814.h SH1106.h SSD1306.h
+HEADERS += ST7036.h ST7565R.h ST7735.h ST7920.h STE2007.h
+
+# objects
+OBJECTS_C = main.o user.o pause.o adjust.o ADC.o probes.o display.o
+OBJECTS_C += resistor.o cap.o semi.o inductor.o
+OBJECTS_C += tools_misc.o tools_signal.o tools_LC_Meter.o
+OBJECTS_C += SPI.o I2C.o serial.o commands.o OneWire.o
+OBJECTS_C += IR_RX.o IR_TX.o DHTxx.o ADS7843.o
+OBJECTS_C += HD44780.o ILI9163.o ILI9341.o ILI9481.o ILI9486.o ILI9488.o
+OBJECTS_C += PCD8544.o PCF8814.o SH1106.o SSD1306.o
+OBJECTS_C += ST7036.o ST7565R.o ST7735.o ST7920.o
+OBJECTS_C += STE2007.o VT100.o TestDisplay.o
+OBJECTS_S = wait.o
+OBJECTS = ${OBJECTS_C} ${OBJECTS_S}
+
+
+#
+#  build
+#
+
+all: ${NAME} ${NAME}.hex ${NAME}.eep ${NAME}.lss size
+
+
+#
+#  link
+#
+
+# link firmware
+$(NAME): ${OBJECTS}
+	 ${CC} ${LDFLAGS} ${OBJECTS} ${LIBDIRS} ${LIBS} -o ${NAME}
+
+# create hex file of firmware
+%.hex: ${NAME}
+	avr-objcopy -O ihex ${HEX_FLASH_FLAGS} $< $@
+
+# create hex file of EEPROM data
+%.eep: ${NAME}
+	-avr-objcopy ${HEX_EEPROM_FLAGS} -O ihex $< $@ || exit 0
+
+# create dump of firmware
+%.lss: ${NAME}
+	avr-objdump -h -S $< > $@
+
+# output size of firmware and stuff
+size: ${NAME}
+	@echo
+	@avr-size -C --mcu=${MCU} $<
+
+
+#
+#  compile source files
+#
+
+# rule for all c-files
+${OBJECTS_C}: %.o: %.c ${HEADERS} ${MAKEFILE_LIST}
+	${CC} ${CFLAGS} -c ${@:.o=.c}
+
+# rule for all S-files
+${OBJECTS_S}: %.o: %.S ${HEADERS} ${MAKEFILE_LIST}
+	${CC} ${CFLAGS} -c ${@:.o=.S}
+
+# external dependencies
+-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)
+
+
+#
+#  extras
+#
+
+# program firmware and EEPROM data
+upload: ${NAME} ${NAME}.hex ${NAME}.eep ${NAME}.lss size
+	avrdude -c ${PROGRAMMER} -P ${PORT} -p ${PARTNO} ${OPTIONS} \
+	  -U flash:w:./${NAME}.hex:a -U eeprom:w:./${NAME}.eep:a
+
+# program firmware only
+prog_fw: ${NAME} ${NAME}.hex ${NAME}.lss size
+	avrdude -c ${PROGRAMMER} -P ${PORT} -p ${PARTNO} ${OPTIONS} \
+	  -U flash:w:./${NAME}.hex:a
+
+# program EEPROM data only
+prog_ee: ${NAME} ${NAME}.eep ${NAME}.lss size
+	avrdude -c ${PROGRAMMER} -P ${PORT} -p ${PARTNO} ${OPTIONS} \
+	  -U eeprom:w:./${NAME}.eep:a
+
+# create distribution package
+dist:
+	rm -f *.tgz
+	cd ..; tar -czf ${DIST}/${DIST}.tgz \
+	  ${DIST}/*.h ${DIST}/*.c ${DIST}/*.S ${DIST}/bitmaps/*.h \
+	  ${DIST}/Makefile ${DIST}/README ${DIST}/CHANGES \
+	  ${DIST}/README.de ${DIST}/CHANGES.de ${DIST}/Clones \
+	  ${DIST}/*.pdf
+
+# clean up
+clean:
+	-rm -rf ${OBJECTS} ${NAME} dep/* *.tgz
+	-rm -rf ${NAME}.hex ${NAME}.eep ${NAME}.lss ${NAME}.map
+
+
+#
+#  MCU fuses
+#
+
+# ATmega 328/328P
+ifeq (${MCU},atmega328)
+  FAMILY = atmega328_324_640
+endif
+
+# ATmega 328PB
+ifeq (${MCU},atmega328pb)
+  FAMILY = atmega328pb
+endif
+
+# ATmega 324P/324PA
+ifeq (${MCU},atmega324p)
+  FAMILY = atmega328_324_640
+endif
+
+# ATmega 640
+ifeq (${MCU},atmega640)
+  FAMILY = atmega328_324_640
+endif
+
+# ATmega 644/644P/644PA
+ifeq (${MCU},atmega644)
+  FAMILY = atmega328_324_640
+endif
+
+# ATmega 1280
+ifeq (${MCU},atmega1280)
+  FAMILY = atmega328_324_640
+endif
+
+# ATmega 1284/1284P
+ifeq (${MCU},atmega1284)
+  FAMILY = atmega328_324_640
+endif
+
+# ATmega 2560
+ifeq (${MCU},atmega2560)
+  FAMILY = atmega328_324_640
+endif
+
+# ATmega 328/324/640/644/1280/1284/2560
+ifeq (${FAMILY},atmega328_324_640)
+  # high byte: use default settings, disable JTAG
+  HFUSE = -U hfuse:w:0xd9:m
+  # extended byte: BOD level 4.3V
+  EFUSE = -U efuse:w:0xfc:m
+  # low byte: clock settings
+  ifeq (${FREQ},1)
+    # internal RC oscillator (8MHz) and /1 clock divider
+    LFUSE_RC = -U lfuse:w:0x62:m
+    # external 8MHz full swing crystal and /8 clock divider
+    LFUSE_CRYSTAL = -U lfuse:w:0x77:m
+    # external 8MHz low power crystal and /8 clock divider
+    LFUSE_LOWPOWER = -U lfuse:w:0x7f:m
+  endif
+  ifeq (${FREQ},8)
+    # internal RC oscillator (8MHz) and /1 clock divider
+    LFUSE_RC = -U lfuse:w:0xe2:m
+    # external 8MHz full swing crystal and /1 clock divider
+    LFUSE_CRYSTAL = -U lfuse:w:0xf7:m
+    # external 8MHz low power crystal and /1 clock divider
+    LFUSE_LOWPOWER = -U lfuse:w:0xff:m
+  endif
+  ifeq (${FREQ},16)
+    # internal RC oscillator (8MHz) not possible
+    LFUSE_RC =
+    # external 16MHz full swing crystal and /1 clock divider
+    LFUSE_CRYSTAL = -U lfuse:w:0xf7:m
+    # external 16MHz low power crystal and /1 clock divider
+    LFUSE_LOWPOWER = -U lfuse:w:0xff:m
+  endif
+  ifeq (${FREQ},20)
+    # internal RC oscillator (8MHz) not possible
+    LFUSE_RC =
+    # external 20MHz full swing crystal and /1 clock divider
+    LFUSE_CRYSTAL = -U lfuse:w:0xf7:m
+    # external 20MHz low power crystal and /1 clock divider
+    LFUSE_LOWPOWER = -U lfuse:w:0xff:m
+  endif
+endif
+
+# ATmega 328PB
+ifeq (${FAMILY},atmega328pb)
+  # high byte: use default settings
+  HFUSE = -U hfuse:w:0xd9:m
+  # extended byte: BOD level 4.3V, CFD disabled
+  EFUSE = -U efuse:w:0xf4:m
+  # low byte: clock settings
+  ifeq (${FREQ},8)
+    # internal RC oscillator (8MHz) and /1 clock divider
+    LFUSE_RC = -U lfuse:w:0xe2:m
+    # full swing crystal not supported, use low power crystal
+    LFUSE_CRYSTAL = -U lfuse:w:0xff:m
+    # external 8MHz low power crystal and /1 clock divider
+    LFUSE_LOWPOWER = -U lfuse:w:0xff:m
+  endif
+  ifeq (${FREQ},16)
+    # internal RC oscillator (8MHz) not possible
+    LFUSE_RC =
+    # full swing crystal not supported, use low power crystal
+    LFUSE_CRYSTAL = -U lfuse:w:0xff:m
+    # external 16MHz low power crystal and /1 clock divider
+    LFUSE_LOWPOWER = -U lfuse:w:0xff:m
+  endif
+endif
+
+# select low fuse byte
+ifeq (${OSCILLATOR},RC)
+  LFUSE = ${LFUSE_RC}
+endif
+ifeq (${OSCILLATOR},Crystal)
+  LFUSE = ${LFUSE_CRYSTAL}
+endif
+ifeq (${OSCILLATOR},LowPower)
+  LFUSE = ${LFUSE_LOWPOWER}
+endif
+
+# check fuses
+FUSES =
+ifneq ($(strip ${LFUSE}),)
+  ifneq ($(strip ${HFUSE}),)
+    FUSES = ${LFUSE} ${HFUSE} ${EFUSE}
+  endif
+endif
+
+# set fuses
+fuses:
+  ifeq ($(strip ${FUSES}),)
+	@echo Invalid fuse settings!
+  else
+	avrdude -c ${PROGRAMMER} -P ${PORT} -p ${PARTNO} ${OPTIONS} ${FUSES}
+  endif

+ 1673 - 0
transistor-tester/firmware/1.42m/config.h

@@ -0,0 +1,1673 @@
+/* ************************************************************************
+ *
+ *   global configuration, setup and settings
+ *
+ *   (c) 2012-2020 by Markus Reschke
+ *   based on code from Markus Frejek and Karl-Heinz K�bbeler
+ *
+ * ************************************************************************ */
+
+
+/* source management */
+#define CONFIG_H
+
+
+/*
+ *  For MCU specific settings (port and pin assignments) and display
+ *  settings please edit also:
+ *  - ATmega328:            config_328.h
+ *  - ATmega324/644/1284:   config_644.h
+ *  - ATmega640/1280/2560:  config_1280.h
+ */
+
+
+
+/* ************************************************************************
+ *   Hardware options
+ * ************************************************************************ */
+
+
+/*
+ *  rotary encoder for user interface
+ *  - default pins: PD2 & PD3 (ATmega 328)
+ *  - could be in parallel with LCD module
+ *  - see ENCODER_PORT in config-<MCU>.h for port pins
+ *  - uncomment to enable and also set ENCODER_PULSES & ENCODER_STEPS below
+ *    to match your rotary encoder
+ */
+
+#define HW_ENCODER
+
+
+/*
+ *  Number of Gray code pulses per step or detent for the rotary encoder
+ *  - typical values: 2 or 4, rarely 1
+ *  - a rotary encoder's pulse is the complete sequence of 4 Gray code pulses
+ *  - adjust value to match your rotary encoder
+ */
+
+#define ENCODER_PULSES   4
+
+
+/*
+ *  Number of detents or steps
+ *  - this is used by the detection of the rotary encoder's turning velocity
+ *  - it doesn't have to match exactly and also allows you to finetune the
+ *    the feedback (higher: slow down, lower: speed up)
+ *  - typical values: 20, 24 or 30 
+ *  - adjust value to match your rotary encoder
+ */
+
+#define ENCODER_STEPS    20
+
+
+/*
+ *  increase/decrease push buttons for user interface
+ *  - alternative for rotary encoder
+ *  - see KEY_PORT in config-<MCU>.h for port pins
+ *  - uncomment to enable
+ */
+
+//#define HW_INCDEC_KEYS
+
+
+/*
+ *  2.5V voltage reference for Vcc check
+ *  - default pin: PC4 (ATmega 328)
+ *  - should be at least 10 times more precise than the voltage regulator
+ *  - see TP_REF in config-<MCU>.h for port pin
+ *  - uncomment to enable and also adjust UREF_25 below for your voltage
+ *    reference
+ */
+
+//#define HW_REF25 // Disabled because of MCP1702
+
+
+/*
+ *  Typical voltage of 2.5V voltage reference (in mV)
+ *  - see datasheet of the voltage reference
+ *  - or use >= 5.5 digit DMM to measure the voltage
+ */
+
+#define UREF_25           2495
+
+
+/*
+ *  Probe protection relay for discharging caps
+ *  - default pin: PC4 (ATmega 328)
+ *  - low signal: short circuit probe pins
+ *    high signal via external reference: remove short circuit
+ *  - see TP_REF in config_<MCU>.h for port pin
+ *  - uncomment to enable
+ */
+
+//#define HW_DISCHARGE_RELAY
+
+
+/*
+ *  Zener check / voltage measurement up to 50V DC
+ *  - default pin: PC3 (ATmega 328)
+ *  - 10:1 voltage divider
+ *  - DC-DC boost converter controled by test push button
+ *  - see TP_ZENER in config_<MCU>.h for port pin
+ *  - uncomment to enable
+ */
+
+#define HW_ZENER
+
+
+/*
+ *  alternative mode for Zener check: don't switch boost converter
+ *  - when the DC-DC boost converter runs all the time
+ *  - when measuring an external voltage (circuit without boost converter)
+ *  - uncomment to enable
+ */
+
+//#define ZENER_UNSWITCHED
+
+
+/*
+ *  high resolution for Zener check
+ *  - 10mV instead of 0.1V
+ *  - uncomment to enable
+ */
+
+#define ZENER_HIGH_RES
+
+
+/*
+ *  fixed signal output
+ *  - in case the MCU's OC1B pin is wired as dedicated signal output
+ *    instead of driving the Rl probe resistor for test pin #2
+ *  - uncomment to enable
+ */
+
+//#define HW_FIXED_SIGNAL_OUTPUT
+
+
+/*
+ *  basic frequency counter
+ *  - default pin: T0 (PD4 ATmega 328)
+ *  - uses T0 directly as frequency input
+ *  - counts up to 1/4 of MCU clock rate
+ *  - might be in parallel with LCD module
+ *  - uncomment to enable
+ */
+
+#define HW_FREQ_COUNTER_BASIC
+
+
+/*
+ *  extended frequency counter
+ *  - low and high frequency crystal oscillators
+ *    and buffered frequency input
+ *  - prescalers 1:1 and 16:1 (32:1)
+ *  - uses T0 directly as frequency input
+ *  - see COUNTER_CTRL_PORT in config-<MCU>.h for port pins
+ *  - requires a display with more than 2 text lines
+ *  - uncomment to enable
+ *  - select the circuit's prescaler setting: either 16:1 or 32:1 
+ */
+
+//#define HW_FREQ_COUNTER_EXT
+#define FREQ_COUNTER_PRESCALER     16   /* 16:1 */
+//#define FREQ_COUNTER_PRESCALER     32   /* 32:1 */
+
+
+/*
+ *  event counter
+ *  - default pin: T0 (PD4 ATmega 328)
+ *  - uses T0 directly as event/pulse input (rising edge)
+ *  - no shared operation with displays possible for T0
+ *  - requires additional keys (e.g. rotary encoder) and a display with
+ *    more than 5 lines
+ *  - only for MCU clock of 8, 16 or 20MHz
+ *  - uncomment to enable
+ */
+
+//#define HW_EVENT_COUNTER
+
+
+/*
+ *  trigger output for event counter
+ *  - uses probe #2 as trigger output, probes #1 and #3 are Gnd
+ *  - sets trigger output to high while counting
+ *  - uncomment to enable
+ */
+
+//#define EVENT_COUNTER_TRIGGER_OUT
+
+
+/*
+ *  IR remote control detection/decoder (via dedicated MCU pin)
+ *  - requires IR receiver module, e.g. TSOP series
+ *  - module is connected to fixed I/O pin
+ *  - see IR_PORT in config-<MCU>.h for port pin
+ *  - uncomment to enable
+ *  - for additional protocols also enable SW_IR_RX_EXTRA
+ */
+
+//#define HW_IR_RECEIVER
+
+
+/*
+ *  fixed cap for self-adjustment
+ *  - see TP_CAP and ADJUST_PORT in config-<MCU>.h for port pins
+ *  - uncomment to enable
+ */
+
+//#define HW_ADJUST_CAP
+
+
+/*
+ *  L/C meter hardware option
+ *  - uses T0 directly as frequency input
+ *  - see LC_CTRL_PORT in config-<MCU>.h for port pins
+ *  - uncomment to enable
+ */
+
+//#define HW_LC_METER
+
+
+/*
+ *  L/C meter: value of reference capacitor C_p (in 0.1 pF)
+ *  - should be around 1000pF
+ */
+
+#define LC_METER_C_REF        10000
+
+
+/*
+ *  L/C meter: also display frequency of LC oscillator
+ *  - helps to spot the oscillator's frequency drifting 
+ *  - requires display with more than two text lines
+ *  - uncomment to enable
+ */
+
+//#define LC_METER_SHOW_FREQ
+
+
+/*
+ *  relay for parallel cap (sampling ADC)
+ *  - uncomment to enable (not implemented yet)
+ */
+
+//#define HW_CAP_RELAY
+
+
+
+/* ************************************************************************
+ *   software options
+ * ************************************************************************ */
+
+
+/*
+ *  PWM generator with simple user interface
+ *  - signal output via OC1B
+ *  - uncomment to enable
+ */
+
+#define SW_PWM_SIMPLE
+
+
+/*
+ *  PWM generator with fancy user interface
+ *  - signal output via OC1B
+ *  - requires additional keys and display with more than 2 text lines
+ *  - uncomment to enable
+ */
+
+//#define SW_PWM_PLUS
+
+
+/*
+ *  Inductance measurement
+ *  - uncomment to enable
+ */
+
+#define SW_INDUCTOR
+
+
+/*
+ *  ESR measurement
+ *  - requires MCU clock >= 8 MHz
+ *  - choose SW_OLD_ESR for old method starting at 180nF
+ *  - uncomment to enable
+ */
+
+#define SW_ESR
+//#define SW_OLD_ESR
+
+
+/*
+ *  ESR Tool (in-circuit ESR measurement)
+ *  - requires SW_ESR or SW_OLD_ESR to be enabled
+ *  - uncomment to enable
+ */
+
+//#define SW_ESR_TOOL
+
+
+/*
+ *  check for rotary encoders
+ *  - uncomment to enable
+ */
+
+//#define SW_ENCODER
+
+
+/*
+ *  squarewave signal generator
+ *  - signal output via OC1B
+ *  - requires additional keys
+ *  - uncomment to enable
+ */
+
+#define SW_SQUAREWAVE
+
+
+/*
+ *  IR remote control detection/decoder (via probes)
+ *  - requires IR receiver module, e.g. TSOP series
+ *  - module will be connected to probe leads
+ *  - uncomment to enable
+ */
+
+//#define SW_IR_RECEIVER // Disabled to be able to fit in memory
+
+
+/*
+ *  current limiting resistor for IR receiver module
+ *  - for 5V only modules
+ *  - Warning: any short circuit may destroy your MCU
+ *  - uncomment to disable resistor
+ */
+
+//#define SW_IR_DISABLE_RESISTOR
+
+
+/*
+ *  additional protocols for IR remote control detection/decoder
+ *  - uncommon protocols which will increase flash memory usage ;)
+ *  - uncomment to enable
+ */
+
+//#define SW_IR_RX_EXTRA
+
+
+/*
+ *  IR remote control sender
+ *  - signal output via OC1B
+ *  - requires additional keys and display with more than 4 text lines
+ *  - also requires an IR LED with a simple driver
+ *  - uncomment to enable
+ */
+
+//#define SW_IR_TRANSMITTER
+
+
+/*
+ *  Alternative delay loop for IR remote control sender
+ *  - in case the the C compiler screws up the default delay loop
+ *    and causes incorrect pulse/pause timings
+ *  - uncomment to enable
+ */
+
+//#define SW_IR_TX_ALTDELAY
+
+
+/*
+ *  additional protocols for IR remote control sender
+ *  - uncommon protocols which will increase flash memory usage ;)
+ *  - uncomment to enable
+ */
+
+//#define SW_IR_TX_EXTRA
+
+
+/*
+ *  check for opto couplers
+ *  - uncomment to enable
+ */
+
+#define SW_OPTO_COUPLER
+
+
+/*
+ *  check for Unijunction Transistor
+ *  - uncomment to enable
+ */
+
+#define SW_UJT
+
+
+/*
+ *  check for Schottky Transistor (Schottky-clamped BJT)
+ *  - uncomment to enable
+ */
+
+#define SW_SCHOTTKY_BJT
+
+
+/*
+ *  Servo Check
+ *  - signal output via OC1B
+ *  - requires additional keys and display with more than 2 text lines
+ *  - uncomment to enable
+ */
+
+//#define SW_SERVO
+
+
+/*
+ *  DS18B20 - OneWire temperature sensor 
+ *  - uncomment to enable
+ *  - also enable ONEWIRE_PROBES or ONEWIRE_IO_PIN (see section 'Busses')
+ */
+
+//#define SW_DS18B20
+
+
+/*
+ *  OneWire: read and display ROM code
+ *  - option for OneWire related tools
+ *  - requires display with more than 2 text lines
+ *  - uncomment to enable
+ */
+
+//#define ONEWIRE_READ_ROM
+
+
+/*
+ *  scan OneWire bus for devices and list their ROM codes
+ *  - requires display with more than 2 text lines
+ *  - uncomment to enable
+ *  - also enable ONEWIRE_PROBES or ONEWIRE_IO_PIN (see section 'Busses')
+ */
+
+//#define SW_ONEWIRE_SCAN
+
+
+/*
+ *  capacitor leakage check
+ *  - requires display with more than two lines
+ *  - uncomment to enable
+ */
+
+//#define SW_CAP_LEAKAGE
+
+
+/*
+ *  display reverse hFE for BJTs
+ *  - hFE for collector and emitter reversed
+ *  - uncomment to enable
+ */
+
+//#define SW_REVERSE_HFE
+
+
+/*
+ *  display I_C/I_E test current for hFE measurement
+ *  - I_C for common emitter circuit
+ *    I_E for common collector circuit
+ *  - uncomment to enable
+ */
+
+//#define SW_HFE_CURRENT
+
+
+/*
+ *  R/C/L monitors
+ *  - monitor passive components connected to probes #1 and #3
+ *  - monitors for L require SW_INDUCTOR to be enabled
+ *  - for ESR either SW_ESR or SW_OLD_ESR needs to be enabled
+ *  - uncomment to enable (one or more)
+ */
+
+//#define SW_MONITOR_R          /* just R */
+//#define SW_MONITOR_C          /* just C plus ESR */
+//#define SW_MONITOR_L          /* just L */
+//#define SW_MONITOR_RCL        /* R plus L, or C plus ESR */
+//#define SW_MONITOR_RL         /* R plus L */
+
+
+/*
+ *  DHT11, DHT22 and compatible humidity & temperature sensors
+ *  - uncomment to enable
+ */
+
+//#define SW_DHTXX
+
+
+/*
+ *  display font for test purposes
+ *  - uncomment to enable
+ */
+
+//#define SW_FONT_TEST
+
+
+/*
+ *  check resistor for matching E series norm value
+ *  - requires a display with more than 2 text lines
+ *  - color-code mode requires a color graphics display
+ *  - uncomment to enable (one or more)
+ */
+
+//#define SW_R_E24_5_T          /* E24 5% tolerance, text */
+//#define SW_R_E24_5_CC         /* E24 5% tolerance, color-code */
+//#define SW_R_E24_1_T          /* E24 1% tolerance, text */
+//#define SW_R_E24_1_CC         /* E24 1% tolerance, color-code */
+//#define SW_R_E96_T            /* E96 1% tolerance, text */
+//#define SW_R_E96_CC           /* E96 1% tolerance, color-code */
+
+
+/*
+ *  check capacitor for matching E series norm value
+ *  - requires a display with more than 2 text lines
+ *  - uncomment to enable (one or more)
+ */
+
+//#define SW_C_E6_T             /* E6 20% tolerance, text */
+//#define SW_C_E12_T            /* E12 10% tolerance, text */
+
+
+/*
+ *  check inductor for matching E series norm value
+ *  - requires a display with more than 2 text lines
+ *  - uncomment to enable (one or more)
+ */
+
+//#define SW_L_E6_T             /* E6 20% tolerance, text */
+//#define SW_L_E12_T            /* E12 10% tolerance, text */
+
+
+
+/* ************************************************************************
+ *   workarounds for some testers
+ * ************************************************************************ */
+
+
+/*
+ *  Disable hFE measurement with common collector circuit and Rl as
+ *  base resistor.
+ *  - problem:
+ *    hFE values are way too high.
+ *  - affected testers:
+ *    Hiland M644 (under investigation)
+ *  - uncomment to enable
+ */
+
+//#define NO_HFE_C_RL
+
+
+
+/* ************************************************************************
+ *   workarounds for some IDEs 
+ * ************************************************************************ */
+
+
+/*
+ *  Oscillator startup cycles (after wakeup from power-safe mode):
+ *  - typical values
+ *    - internal RC:              6
+ *    - full swing crystal:   16384 (also 256 or 1024 based on fuse settings)
+ *    - low power crystal:    16384 (also 256 or 1024 based on fuse settings)
+ *  - Please change value if it doesn't match your tester!
+ */
+
+#ifndef OSC_STARTUP
+  #define OSC_STARTUP    16384
+#endif
+
+
+
+/* ************************************************************************
+ *   user interface
+ * ************************************************************************ */
+
+
+/*
+ *  Language of user interface. Available languages:
+ *  - English (default)
+ *  - Czech (based on ISO 8859-1)
+ *  - Czech 2 (with Czech characters based on ISO 8859-2)
+ *  - Danish
+ *  - German
+ *  - Polish (based on ISO 8859-1)
+ *  - Polish 2 (with Polish characters based on ISO 8859-2)
+ *  - Spanish
+ *  - Romanian
+ *  - Russian (with cyrillic characters based on Windows-1251)
+ *  - Russian 2 (with cyrillic characters based on Windows-1251)
+ */
+
+#define UI_ENGLISH
+//#define UI_CZECH
+//#define UI_CZECH_2
+//#define UI_DANISH
+//#define UI_GERMAN
+//#define UI_ITALIAN
+//#define UI_POLISH
+//#define UI_POLISH_2
+//#define UI_ROMANIAN
+//#define UI_RUSSIAN
+//#define UI_RUSSIAN_2
+//#define UI_SPANISH
+
+
+/*
+ *  Use comma instead of dot to indicate a decimal fraction.
+ *  - uncomment to enable
+ */
+
+//#define UI_COMMA
+
+
+/*
+ *  Display temperatures in Fahrenheit instead of Celsius.
+ *  - uncomment to enable
+ */
+
+//#define UI_FAHRENHEIT
+
+
+/*
+ *  Display hexadecimal values in uppercase instead of lowercase
+ *  - uncomment to enable
+ */
+
+//#define UI_HEX_UPPERCASE
+
+
+/*
+ *  Set the default operation mode to auto-hold.
+ *  - instead of continous mode
+ *  - uncomment to enable
+ */
+
+#define UI_AUTOHOLD
+
+
+/*
+ *  Trigger the menu also by a short circuit of all three probes.
+ *  - former default behaviour
+ *  - uncomment to enable
+ */
+
+//#define UI_SHORT_CIRCUIT_MENU
+
+
+/*
+ *  Show key hints instead of cursor if available.
+ *  - currently only "Menu/Test"
+ *  - requires additional keys and display with a sufficient number of
+ *    text lines (recommended: >= 8 lines)
+ *  - uncomment to enable
+ */
+
+//#define UI_KEY_HINTS
+
+
+/*
+ *  Enter menu to select adjustment profile after powering on.
+ *  - uncomment to enable
+ */
+
+//#define UI_CHOOSE_PROFILE
+
+
+/*
+ *  Output components found also via TTL serial interface.
+ *  - uncomment to enable
+ *  - also enable SERIAL_BITBANG or SERIAL_HARDWARE (see section 'Busses')
+ */
+
+//#define UI_SERIAL_COPY
+
+
+/*
+ *  Control tester via TTL serial interface.
+ *  - uncomment to enable
+ *  - also enable SERIAL_BITBANG or SERIAL_HARDWARE, plus SERIAL_RW
+ *    (see section 'Busses') 
+ */
+
+//#define UI_SERIAL_COMMANDS
+
+
+/*
+ *  Maximum time to wait after probing (in ms).
+ *  - applies to continuous mode only
+ *  - Time between printing the result and starting a new probing cycle.
+ */
+
+#define CYCLE_DELAY      3000
+
+
+/*
+ *  Maximum number of probing runs without any component found in a row.
+ *  - applies to continuous mode only
+ *  - If this number is reached the tester will power off.
+ *  - When set to zero the tester will run only once and turn off
+ *    after CYCLE_DELAY.
+ *  - When set to 255 this feature will be disabled and the tester runs
+ *    until it's powered off manually.
+ */
+
+#define CYCLE_MAX        5
+
+
+/*
+ *  Automatic power-off when no button is pressed for a while (in s).
+ *  - applies to auto-hold mode only
+ *  - uncomment to enable, also adjust timeout (in s)
+ */
+
+#define POWER_OFF_TIMEOUT     60
+
+
+/*
+ *  component symbols for fancy pinout
+ *  - for 3-pin semiconductors
+ *  - requires graphics display and symbol bitmap
+ *  - uncomment to enable
+ */
+
+#define SW_SYMBOLS
+
+
+/*
+ *  color coding for probes
+ *  - requires color graphics LCD
+ *  - uncomment to enable
+ *  - edit colors.h to select correct probe colors
+ */
+
+#define SW_PROBE_COLORS
+
+
+/*
+ *  main menu: power off tester
+ *  - uncomment to enable
+ */
+
+#define SW_POWER_OFF
+
+
+/*
+ *  Round some values if appropriate.
+ *  - for
+ *    - DS18B20 (0.1 �C/F)
+ *  - uncomment to enable
+ */
+
+//#define UI_ROUND_DS18B20
+
+
+/*
+ *  storage of firmware data (texts, tables etc)
+ *  - self-adjustment data is always stored in EEPROM
+ *  - fonts and symbols are always stored in Flash
+ *  - uncomment one
+ */ 
+
+#define DATA_EEPROM           /* store data in EEPROM */
+//#define DATA_FLASH            /* store data in Flash */
+
+
+
+/* ************************************************************************
+ *   power management
+ * ************************************************************************ */
+
+
+/*
+ *  type of power switch
+ *  - soft-latching power switch (default)
+ *    - as in the tester's reference circuit 
+ *    - tester is able to power itself off
+ *  - manual power switch
+ *    - tester isn't able to power itself off
+ *  - enable one
+ */
+
+#define POWER_SWITCH_SOFT
+//#define POWER_SWITCH_MANUAL
+
+
+/*
+ *  Battery monitoring mode:
+ *  - BAT_NONE     disable battery monitoring completely
+ *  - BAT_DIRECT   direct measurement of battary voltage (< 5V)
+ *  - BAT_DIVIDER  measurement via voltage divider
+ *  - uncomment one of the modes
+ */
+
+//#define BAT_NONE
+//#define BAT_DIRECT
+#define BAT_DIVIDER
+
+
+/*
+ *  Unmonitored optional external power supply
+ *  - Some circuits supporting an additional external power supply are designed
+ *    in a way that prevents the battery monitoring to measure the voltage of
+ *    the external power supply. This would trigger the low battery shut-down.
+ *    The switch below will prevent the shut-down when the measured voltage is
+ *    below 0.9V (caused by the diode's leakage current).
+ *  - uncomment to enable
+ */
+
+//#define BAT_EXT_UNMONITORED
+
+
+/*
+ *  Voltage divider for battery monitoring
+ *  - BAT_R1: top resistor in Ohms
+ *  - BAT_R2: bottom resistor in Ohms
+ */
+
+#define BAT_R1           10000
+#define BAT_R2           3300
+
+
+/*
+ *  Voltage drop by reverse voltage protection diode and power management
+ *  transistor (in mV):
+ *  - or any other circuitry in the power section
+ *  - Get your DMM and measure the voltage drop!
+ *  - Schottky diode about 200mV / PNP BJT about 100mV.
+ */  
+
+#define BAT_OFFSET       290
+
+
+/*
+ *  Battery weak voltage (in mV).
+ *  - Tester warns if BAT_WEAK is reached.
+ *  - Voltage drop BAT_OFFSET is considered in calculation.
+ */
+
+#define BAT_WEAK         7400
+
+
+/*
+ *  Battery low voltage (in mV).
+ *  - Tester powers off if BAT_LOW is reached.
+ *  - Voltage drop BAT_OFFSET is considered in calculation.
+ */
+
+#define BAT_LOW          6400 
+
+
+/*
+ *  Enter sleep mode when idle to save power.
+ *  - uncomment to enable
+ */
+
+#define SAVE_POWER
+
+
+
+/* ************************************************************************
+ *   measurement settings and offsets
+ * ************************************************************************ */
+
+
+/*
+ *  ADC voltage reference based on Vcc (in mV). 
+ */
+
+#define UREF_VCC         5001
+
+
+/*
+ * Offset for the internal bandgap voltage reference (in mV): -100 up to 100
+ *  - To compensate any difference between real value and measured value.
+ *  - The ADC has a resolution of about 4.88mV for V_ref = 5V (Vcc) and
+ *    1.07mV for V_ref = 1.1V (bandgap).
+ *  - Will be added to measured voltage of bandgap reference.
+ */
+
+#define UREF_OFFSET      0
+
+
+/*
+ *  Exact values of probe resistors.
+ *  - Standard value for Rl is 680 Ohms.
+ *  - Standard value for Rh is 470k Ohms.
+ */
+
+/* Rl in Ohms */
+#define R_LOW            680
+
+/* Rh in Ohms */
+#define R_HIGH           470000
+
+
+/*
+ *  Offset for systematic error of resistor measurement with Rh (470k) 
+ *  in Ohms.
+ *  - if resistors >20k measure too high or low adjust the offset accordingly
+ *  - standard offset is 350 Ohms
+ */
+
+#define RH_OFFSET        350
+
+
+/*
+ *  Resistance of probes (in 0.01 Ohms).
+ *  - default offset for PCB tracks and probe leads
+ *  - resistance of two probes in series
+ *  - assuming all probes have same/similar resistance
+ *  - will be updated by self-adjustment
+ */
+
+#define R_ZERO           20
+
+
+/*
+ *  Use probe pair specific resistance offsets instead of an
+ *  average value for all probes.
+ *  - uncomment to enable
+ */
+
+//#define R_MULTIOFFSET
+
+
+/* 
+ *  Capacitance of probes (in pF).
+ *  - default offset for MCU, PCB tracks and probe leads
+ *  - Examples:
+ *    capacitance  length
+ *    -------------------------
+ *     3pF         about 10cm
+ *     9pF         about 30cm
+ *    15pF         about 50cm
+ *  - maximum value: 100
+ *  - will be updated by self-adjustment
+ */
+
+#define C_ZERO           43
+
+
+/*
+ *  Use probe pair specific capacitance offsets instead of an
+ *  average value for all probes.
+ *  - uncomment to enable
+ */
+
+//#define CAP_MULTIOFFSET
+
+
+/*
+ *  Maximum voltage at which we consider a capacitor being
+ *  discharged (in mV).
+ */
+
+#define CAP_DISCHARGED   2
+
+
+/*
+ *  Correction factors for capacitors (in 0.1%)
+ *  - positive factor increases capacitance value
+ *    negative factor decreases capacitance value
+ *  - CAP_FACTOR_SMALL for caps < 4.7�F
+ *  - CAP_FACTOR_MID for caps 4.7 - 47�F
+ *  - CAP_FACTOR_LARGE for caps > 47�F
+ */
+
+#define CAP_FACTOR_SMALL      0      /* no correction */ 
+#define CAP_FACTOR_MID        -40    /* -4.0% */
+#define CAP_FACTOR_LARGE      -90    /* -9.0% */
+
+
+/*
+ *  Number of ADC samples to perform for each mesurement.
+ *  - Valid values are in the range of 1 - 255.
+ */
+
+#define ADC_SAMPLES      25
+
+
+/*
+ *  100nF AREF buffer capacitor
+ *  - used by some MCU boards
+ *  - will increase measurement time
+ *  - recommendation: replace with 1nF capacitor
+ *  - uncomment to enable
+ */
+
+//#define ADC_LARGE_BUFFER_CAP
+
+
+
+/* ************************************************************************
+ *   R & D - meant for firmware developers
+ * ************************************************************************ */
+
+
+/*
+ *  Enable read functions for display module.
+ *  - display driver and interface settings have to support this
+ *  - uncomment to enable
+ */
+
+//#define LCD_READ
+
+
+/*
+ *  Read ID of display controller.
+ *  - ID is shown at welcome screen (after firmware version)
+ *  - requires display read functions (LCD_READ)
+ *  - recommended: serial output (UI_SERIAL_COPY)
+ *  - uncomment to enable
+ */
+
+//#define SW_DISPLAY_ID
+
+
+/*
+ *  Read registers of display controller and output them via TTL serial.
+ *  - requires display read functions (LCD_READ) and
+ *    serial output (UI_SERIAL_COPY)
+ *  - uncomment to enable
+ */
+
+//#define SW_DISPLAY_REG
+
+
+
+/* ************************************************************************
+ *   MCU specific setup to support different AVRs
+ * ************************************************************************ */
+
+
+/* MCU clock */
+#define CPU_FREQ    F_CPU
+
+
+/*
+ *  ATmega 328/328P
+ */
+
+#if defined(__AVR_ATmega328__)
+  #include "config_328.h"
+
+
+/*
+ *  ATmega 324P/324PA/644/644P/644PA/1284/1284P
+ */
+
+#elif defined(__AVR_ATmega324P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega1284__)
+  #include "config_644.h"
+
+
+/*
+ *  ATmega 640/1280/2560
+ */
+
+#elif defined(__AVR_ATmega640__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
+  #include "config_1280.h"
+
+
+/*
+ *  missing or unsupported MCU
+ */
+
+#else
+  #error <<< No or wrong MCU type selected! >>>
+#endif
+
+
+
+/* ************************************************************************
+ *   Busses
+ * ************************************************************************ */
+
+
+/*
+ *  I2C bus
+ *  - might be required by some hardware
+ *  - could be enabled already in display section (config_<MCU>.h)
+ *  - for bit-bang I2C port and pins see I2C_PORT (config_<MCU>.h)
+ *  - hardware I2C (TWI) uses automatically the proper MCU pins
+ *  - uncomment either I2C_BITBANG or I2C_HARDWARE to enable
+ *  - uncomment one of the bus speed modes
+ */
+
+//#define I2C_BITBANG                /* bit-bang I2C */
+//#define I2C_HARDWARE               /* MCU's hardware TWI */
+//#define I2C_STANDARD_MODE          /* 100kHz bus speed */
+//#define I2C_FAST_MODE              /* 400kHz bus speed */
+//#define I2C_RW                     /* enable I2C read support (untested) */
+
+
+/*
+ *  SPI bus
+ *  - might be required by some hardware
+ *  - could be enabled already in display section (config_<MCU>.h)
+ *  - for bit-bang SPI port and pins see SPI_PORT (config_<MCU>.h)
+ *  - hardware SPI uses automatically the proper MCU pins
+ *  - uncomment either SPI_BITBANG or SPI_HARDWARE to enable
+ */
+
+//#define SPI_BITBANG                /* bit-bang SPI */
+//#define SPI_HARDWARE               /* hardware SPI */
+//#define SPI_RW                     /* enable SPI read support */
+
+
+/*
+ *  TTL serial interface
+ *  - could be enabled already in display section (config_<MCU>.h)
+ *  - for bit-bang serial port and pins see SERIAL_PORT (config_<MCU>.h)
+ *  - hardware serial uses automatically the proper MCU pins
+ *  - uncomment either SERIAL_BITBANG or SERIAL_HARDWARE to enable
+ */
+
+//#define SERIAL_BITBANG             /* bit-bang serial */
+//#define SERIAL_HARDWARE            /* hardware serial */
+//#define SERIAL_RW                  /* enable serial read support */
+
+
+/*
+ *  OneWire bus
+ *  - for dedicated I/O pin please see ONEWIRE_PORT (config_<MCU>.h)
+ *  - uncomment either ONEWIRE_PROBES or ONEWIRE_IO_PIN to enable
+ */
+
+//#define ONEWIRE_PROBES             /* via probes */
+//#define ONEWIRE_IO_PIN             /* via dedicated I/O pin */
+
+
+
+/* ************************************************************************
+ *   ADC clock
+ * ************************************************************************ */
+
+
+/*
+ *  ADC clock 
+ *  - The ADC clock is 125000Hz by default.
+ *  - You could also set 250000Hz, but that exceeds the max. ADC clock
+ *    of 200kHz for 10 bit resolution!
+ *  - Special case for 20MHz MCU clock: 156250Hz
+ */
+
+#if CPU_FREQ == 20000000
+  /* 20MHz MCU clock */
+  #define ADC_FREQ    156250
+#else
+  /* all other MCU clocks */
+  #define ADC_FREQ    125000
+#endif
+
+
+/*
+ *  define clock divider
+ *  - supports 1MHz, 2MHz, 4MHz, 8MHz, 16MHz and 20MHz MCU clocks
+ *  - we got only 7 fixed prescalers from 2 up to 128
+ */
+
+/* 1MHz/250kHz */
+#if CPU_FREQ / ADC_FREQ == 4
+  #define ADC_CLOCK_DIV (1 << ADPS1) 
+#endif
+
+/* 1MHz/125kHz 2MHz/250kHz */
+#if CPU_FREQ / ADC_FREQ == 8
+  #define ADC_CLOCK_DIV (1 << ADPS1) | (1 << ADPS0)
+#endif
+
+/* 2MHz/125kHz 4MHz/250kHz */
+#if CPU_FREQ / ADC_FREQ == 16
+  #define ADC_CLOCK_DIV (1 << ADPS2)
+#endif
+
+/* 4MHz/125kHz 8MHz/250kHz */
+#if CPU_FREQ / ADC_FREQ == 32
+  #define ADC_CLOCK_DIV (1 << ADPS2) | (1 << ADPS0)
+#endif
+
+/* 8MHz/125kHz 16MHz/250kHz */
+#if CPU_FREQ / ADC_FREQ == 64
+  #define ADC_CLOCK_DIV (1 << ADPS2) | (1 << ADPS1)
+#endif
+
+/* 16MHz/125kHz 20MHz/156.25kHz */
+#if CPU_FREQ / ADC_FREQ == 128
+  #define ADC_CLOCK_DIV (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0)
+#endif
+
+
+
+/* ************************************************************************
+ *   derived values
+ * ************************************************************************ */
+
+
+/*
+ *  number of MCU cycles per �s
+ *  - min. 1 (for 1MHz)
+ *  - max. 20 (for 20MHz)
+ */
+
+#define MCU_CYCLES_PER_US     (CPU_FREQ / 1000000)
+
+
+/*
+ *  number of MCU cycles per ADC cycle
+ *  - min. 4
+ *  - max. 128
+ */ 
+
+#define MCU_CYCLES_PER_ADC    (CPU_FREQ / ADC_FREQ)
+
+
+/*
+ *  time of a MCU cycle (in 0.1 ns)
+ */
+
+#define MCU_CYCLE_TIME        (10000 / (CPU_FREQ / 1000000))
+
+
+
+/* ************************************************************************
+ *   options management
+ * ************************************************************************ */
+
+
+/*
+ *  storage of program data (EEPROM/Flash)
+ */
+
+#if defined (DATA_EEPROM)
+  /* memory type */
+  #define MEM_TYPE            EEMEM
+
+  /* read functions */
+  #define DATA_read_byte(addr)     eeprom_read_byte(addr)
+  #define DATA_read_word(addr)     eeprom_read_word(addr)
+#elif defined (DATA_FLASH)
+  /* memory type */
+  #define MEM_TYPE            PROGMEM
+
+  /* read functions */
+  #define DATA_read_byte(addr)     pgm_read_byte(addr)
+  #define DATA_read_word(addr)     pgm_read_word(addr)
+#endif
+
+
+
+/*
+ *  hardware/software options
+ */
+
+/* power switch: prefer soft-latching type */
+#ifdef POWER_SWITCH_SOFT
+  #ifdef POWER_SWITCH_MANUAL
+    #undef POWER_SWITCH_MANUAL
+  #endif
+#endif
+
+
+/* additional keys */
+/* rotary encoder, increase/decrease push buttons or touch screen */
+#if defined (HW_ENCODER) || defined (HW_INCDEC_KEYS) | defined (HW_TOUCH)
+  #define HW_KEYS
+#endif
+
+/* options which require additional keys */
+#ifndef HW_KEYS
+
+  /* key hints */
+  #ifdef UI_KEY_HINTS
+    #undef UI_KEY_HINTS
+  #endif
+
+  /* PWM+ */
+  #ifdef SW_PWM_PLUS
+    #undef SW_PWM_PLUS
+    #define SW_PWM_SIMPLE   
+  #endif
+
+  /* squarewave generator */
+  #ifdef SW_SQUAREWAVE
+    #undef SW_SQUAREWAVE
+  #endif
+
+  /* Servo Check */
+  #ifdef SW_SERVO
+    #undef SW_SERVO
+  #endif
+
+  /* IR Sender */
+  #ifdef SW_IR_TRANSMITTER
+    #undef SW_IR_TRANSMITTER
+  #endif
+
+#endif
+
+
+/* options which require inductance measurement */
+#ifndef SW_INDUCTOR
+
+  /* L monitor */
+  #ifdef SW_MONITOR_L
+    #undef SW_MONITOR_L
+  #endif
+
+  /* RCL Monitor */
+  #ifdef SW_MONITOR_RCL
+    #undef SW_MONITOR_RCL
+  #endif
+
+  /* RL Monitor */
+  #ifdef SW_MONITOR_RL
+    #undef SW_MONITOR_RL
+  #endif
+
+#endif
+
+
+/* options which require ESR measurement */
+#if ! defined (SW_ESR) && ! defined (SW_OLD_ESR)
+  /* ESR tool */
+  #ifdef SW_ESR_TOOL
+    #undef SW_ESR_TOOL
+  #endif
+#endif
+
+
+/* options which require a MCU clock >= 8MHz */
+#if CPU_FREQ < 8000000
+
+  /* ESR measurement */
+  #ifdef SW_ESR
+    #undef SW_ESR
+  #endif
+
+  /* old ESR measurement */
+  #ifdef SW_OLD_ESR
+    #undef SW_OLD_ESR
+  #endif
+
+#endif
+
+
+/* SPI */
+#if defined (SPI_BITBANG) && defined (SPI_HARDWARE)
+  #error <<< Select either bitbang or hardware SPI! >>>
+#endif
+
+#if defined (SPI_BITBANG) || defined (SPI_HARDWARE)
+  #define HW_SPI
+#endif
+
+/* 9-Bit SPI requires bit-bang mode */
+#ifdef SPI_9
+  #ifndef SPI_BITBANG
+    #error <<< 9-Bit SPI requires bit-bang mode! >>>
+  #endif
+#endif
+
+
+/* I2C */
+#if defined (I2C_BITBANG) && defined (I2C_HARDWARE)
+  #error <<< Select either bitbang or hardware I2C! >>>
+#endif
+
+#if defined (I2C_BITBANG) || defined (I2C_HARDWARE)
+  #define HW_I2C
+#endif
+
+
+/* TTL serial */
+#if defined (SERIAL_BITBANG) && defined (SERIAL_HARDWARE)
+  #error <<< Select either bitbang or hardware serial interface! >>>
+#endif
+
+#if defined (SERIAL_BITBANG) || defined (SERIAL_HARDWARE)
+  #define HW_SERIAL
+#endif
+
+/* VT100 display driver disables other options for serial interface */
+#ifdef LCD_VT100
+  #ifdef UI_SERIAL_COPY
+    #undef UI_SERIAL_COPY
+  #endif
+  #ifdef UI_SERIAL_COMMANDS
+    #undef UI_SERIAL_COMMANDS
+  #endif  
+#endif
+
+/* options which require TTL serial */
+#ifndef HW_SERIAL
+  /* VT100 display */
+  #ifdef LCD_VT100
+    #undef LCD_VT100
+  #endif
+  /* serial copy */
+  #ifdef UI_SERIAL_COPY
+    #undef UI_SERIAL_COPY
+  #endif
+  /* remote commands */
+  #ifdef UI_SERIAL_COMMANDS
+    #undef UI_SERIAL_COMMANDS
+  #endif
+#endif
+
+/* options which require TTL serial RW */
+#ifndef SERIAL_RW
+  #ifdef UI_SERIAL_COMMANDS
+    #undef UI_SERIAL_COMMANDS
+  #endif
+#endif
+
+
+/* OneWire */
+#if defined (ONEWIRE_PROBES) && defined (ONEWIRE_IO_PIN)
+  #error <<< Select either probes or dedicated IO pin for Onewire! >>>
+#endif
+
+/* options which require OneWire */
+#if ! defined (ONEWIRE_PROBES) && ! defined (ONEWIRE_IO_PIN)
+
+  /* DS18B20 */
+  #ifdef SW_DS18B20
+    #undef SW_DS18B20
+  #endif
+
+  /* OneWire scan */
+  #ifdef SW_ONEWIRE_SCAN
+    #undef SW_ONEWIRE_SCAN
+  #endif
+
+#endif
+
+
+/* touchscreen */
+#ifdef TOUCH_PORT
+  #define HW_TOUCH
+#endif
+
+
+/* LCD module */
+#ifdef LCD_CONTRAST
+  #define SW_CONTRAST
+#else
+  #define LCD_CONTRAST        0
+#endif
+
+
+/* options which require a color display */
+#ifndef LCD_COLOR
+
+  /* color coding for probes */
+  #ifdef SW_PROBE_COLORS
+    #undef SW_PROBE_COLORS
+  #endif
+
+#endif
+
+
+/* options which require a color graphics display */
+#if ! defined (LCD_COLOR) || ! defined (LCD_GRAPHIC)
+
+  /* resistor color-codes */
+  #ifdef SW_R_E24_5_CC
+    #undef SW_R_E24_5_CC
+  #endif
+  #ifdef SW_R_E24_1_CC
+    #undef SW_R_E24_1_CC
+  #endif
+  #ifdef SW_R_E96_CC
+    #undef SW_R_E96_CC
+  #endif
+
+#endif
+
+
+/* component symbols for fancy pinout */
+#if defined (SYMBOLS_24X24_H)
+  #define SYMBOLS_SELECTED
+#endif
+#if defined (SYMBOLS_24X24_HF) || defined (SYMBOLS_30X32_HF) || defined (SYMBOLS_32X32_HF)
+  #define SYMBOLS_SELECTED
+#endif
+#if defined (SYMBOLS_24X24_VFP)
+  #define SYMBOLS_SELECTED
+#endif
+#if defined (SYMBOLS_24X24_VP_F)
+  #define SYMBOLS_SELECTED
+#endif
+
+/* fancy pinout requires graphic display and symbol set */
+#ifdef SW_SYMBOLS
+
+  /* graphic display */
+  #ifndef LCD_GRAPHIC
+    #undef SW_SYMBOLS
+  #endif
+
+  /* symbol set */
+  #ifndef SYMBOLS_SELECTED
+    #undef SW_SYMBOLS
+  #endif
+
+#endif
+
+
+/* frequency counter */
+#if defined (HW_FREQ_COUNTER_BASIC) || defined (HW_FREQ_COUNTER_EXT)
+  #define HW_FREQ_COUNTER
+#endif
+
+
+/* IR detector/decoder */
+#if defined (SW_IR_RECEIVER) && defined (HW_IR_RECEIVER)
+  #error <<< Select either probes or dedicated IO pin for IR detector! >>>
+#endif
+
+
+/* rounding for DS18B20 requires DS18B20 support */
+#ifdef UI_ROUND_DS18B20
+  #ifndef SW_DS18B20
+    #undef UI_ROUND_DS18B20
+  #endif
+#endif
+
+
+/* read functions for display require bus with read support enabled */
+#ifdef LCD_READ
+  #if defined(LCD_SPI) && ! defined(SPI_RW)
+    #undef LCD_READ
+  #endif
+  #if defined(LCD_I2C) && ! defined(I2C_RW)
+    #undef LCD_READ
+  #endif
+  /* can't check parallel busses */
+#endif
+
+/* display ID requires read functions for display */
+#ifdef SW_DISPLAY_ID
+  #ifndef LCD_READ
+    #undef SW_DISPLAY_ID
+  #endif
+#endif
+
+/* output of display registers requires read functions for display
+   and serial output */
+#ifdef SW_DISPLAY_REG
+  #ifndef LCD_READ
+    #undef SW_DISPLAY_REG
+  #endif
+  #ifndef UI_SERIAL_COPY
+    #undef SW_DISPLAY_REG
+  #endif
+#endif
+
+
+
+/* ************************************************************************
+ *   simplify ifdefs
+ * ************************************************************************ */
+
+
+/* E6 norm values */
+#if defined (SW_C_E6_T) || defined (SW_L_E6_T)
+  #define SW_E6
+#endif
+
+/* E12 norm values */
+#if defined (SW_C_E12_T) || defined (SW_L_E12_T)
+  #define SW_E12
+#endif
+
+/* E24 norm values */
+#if defined (SW_R_E24_5_T) || defined (SW_R_E24_5_CC) || defined (SW_R_E24_1_T) || defined (SW_R_E24_1_CC)
+  #define SW_E24
+#endif
+
+/* E96 norm values */
+#if defined (SW_R_E96_T) || defined (SW_R_E96_CC)
+  #define SW_E96
+#endif
+
+
+/* Show_ENormValues(), Display_EValue() */
+#if defined (SW_R_E24_5_T) || defined (SW_R_E24_1_T) || defined (SW_R_E96_T)
+  #ifndef FUNC_EVALUE
+    #define FUNC_EVALUE
+  #endif
+  #ifndef SW_R_EXX
+    #define SW_R_EXX
+  #endif
+#endif
+
+#if defined (SW_C_E6_T) || defined (SW_C_E12_T) || defined (SW_L_E6_T) || defined (SW_L_E12_T)
+  #ifndef FUNC_EVALUE
+    #define FUNC_EVALUE
+  #endif
+#endif
+
+
+/* Show_ENormCodes(), Display_ColorCode() */
+#if defined (SW_R_E24_5_CC) || defined (SW_R_E24_1_CC) || defined (SW_R_E96_CC)
+  #ifndef FUNC_COLORCODE
+    #define FUNC_COLORCODE
+  #endif
+  #ifndef SW_R_EXX
+    #define SW_R_EXX
+  #endif
+#endif
+
+
+/* SmoothLongKeyPress() */
+#if defined (SW_PWM_PLUS) || defined (SW_SERVO) || defined (HW_EVENT_COUNTER) || defined (HW_LC_METER)
+  #ifndef FUNC_SMOOTHLONGKEYPRESS
+    #define FUNC_SMOOTHLONGKEYPRESS
+  #endif
+#endif
+
+
+/* Display_FullValue() */
+#if defined (SW_SQUAREWAVE) || defined (SW_PWM_PLUS) || defined (HW_FREQ_COUNTER_EXT) || defined (SW_SERVO)
+  #ifndef FUNC_DISPLAY_FULLVALUE
+    #define FUNC_DISPLAY_FULLVALUE
+  #endif
+#endif
+
+#if defined (SW_DS18B20) || defined (HW_EVENT_COUNTER) || defined (SW_DHTXX)
+  #ifndef FUNC_DISPLAY_FULLVALUE
+    #define FUNC_DISPLAY_FULLVALUE
+  #endif
+#endif
+
+#if defined (FUNC_EVALUE) || defined (FUNC_COLORCODE) || defined (LC_METER_SHOW_FREQ)
+  #ifndef FUNC_DISPLAY_FULLVALUE
+    #define FUNC_DISPLAY_FULLVALUE
+  #endif
+#endif
+
+
+/* Display_HexByte() */
+#if defined (SW_IR_RECEIVER) || defined (HW_IR_RECEIVER) || defined (ONEWIRE_READ_ROM) || defined (SW_ONEWIRE_SCAN) || defined (SW_FONT_TEST) || defined (SW_DISPLAY_REG)
+  #ifndef FUNC_DISPLAY_HEXBYTE
+    #define FUNC_DISPLAY_HEXBYTE
+  #endif
+#endif
+
+/* Display_HexValue() */
+#if defined (SW_IR_TRANSMITTER) || defined (SW_DISPLAY_ID)
+  #ifndef FUNC_DISPLAY_HEXVALUE
+    #define FUNC_DISPLAY_HEXVALUE
+  #endif
+#endif
+
+
+
+/* ************************************************************************
+ *   EOF
+ * ************************************************************************ */

+ 1064 - 0
transistor-tester/firmware/1.42m/config_328.h

@@ -0,0 +1,1064 @@
+/* ************************************************************************
+ *
+ *   ATmega 328 specific global configuration, setup and settings
+ *
+ *   (c) 2012-2020 by Markus Reschke
+ *   based on code from Markus Frejek and Karl-Heinz K�bbeler
+ *
+ * ************************************************************************ */
+
+
+/* source management */
+#define CONFIG_328_H
+
+
+
+/* ************************************************************************
+ *   display module
+ * ************************************************************************ */
+
+
+/*
+ *  display module / controller
+ *
+ *  Please uncomment the package matching your LCD/OLED module and adjust
+ *  settings. And comment out the default package if not used.
+ *
+ *  To uncomment, remove the enclosing "#if 0" and "#endif" or put
+ *  a "//" in front of both. To comment out, remove the "//" in front
+ *  of the "#if 0" and "#endif".
+ *
+ *  Individual settings can be enabled by removing the leading "//", or
+ *  disabled by placing a "//" in front of the setting.
+ */
+
+
+/*
+ *  HD44780
+ *  - 4 bit parallel interface
+ *  - if you change LCD_DB4/5/6/7 comment out LCD_DB_STD!
+ */
+
+#if 0
+#define LCD_HD44780                     /* display controller HD44780 */
+#define LCD_TEXT                        /* character display */
+#define LCD_PAR_4                       /* 4 bit parallel interface */
+/* control and data lines */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_DB_STD                      /* use standard pins 0-3 for DB4-7 */
+#define LCD_DB4          PD0            /* port pin used for DB4 */
+#define LCD_DB5          PD1            /* port pin used for DB5 */
+#define LCD_DB6          PD2            /* port pin used for DB6 */
+#define LCD_DB7          PD3            /* port pin used for DB7 */
+#define LCD_RS           PD4            /* port pin used for RS */
+#define LCD_EN1          PD5            /* port pin used for E */
+/* display settings */
+#define LCD_CHAR_X       16             /* characters per line */
+#define LCD_CHAR_Y       2              /* number of lines */
+/* HD44780 has an internal 5x7 font */
+#define FONT_HD44780_INT                /* International font (English) */
+//#define FONT_HD44780_WIN1251            /* Cyrillic font (European) */
+#endif
+
+
+
+/*
+ *  HD44780 plus PCF8574 based backpack
+ *  - I2C interface using bit-bang I2C
+ *  - if you change LCD_DB4/5/6/7 comment out LCD_DB_STD!
+ *  - PCF8574T is 0x27, PCF8574AT is 0x3f
+ */
+
+#if 0
+#define LCD_HD44780                     /* display controller HD44780 */
+#define LCD_TEXT                        /* character display */
+#define LCD_PCF8574                     /* PCF8574 backpack */
+#define LCD_I2C_ADDR     0x3f           /* PCF8574's I2C address */
+/* control and data lines */
+#define LCD_DB_STD                      /* use standard pins 4-7 for DB4-7 */
+#define LCD_DB4          PCF8574_P4     /* port pin used for DB4 */
+#define LCD_DB5          PCF8574_P5     /* port pin used for DB5 */
+#define LCD_DB6          PCF8574_P6     /* port pin used for DB6 */
+#define LCD_DB7          PCF8574_P7     /* port pin used for DB7 */
+#define LCD_RS           PCF8574_P0     /* port pin used for RS */
+#define LCD_RW           PCF8574_P1     /* port pin used for RW */
+#define LCD_EN1          PCF8574_P2     /* port pin used for E */
+#define LCD_LED          PCF8574_P3     /* port pin used for backlight */
+/* display settings */
+#define LCD_CHAR_X       16             /* characters per line */
+#define LCD_CHAR_Y       2              /* number of lines */
+/* HD44780 has an internal 5x7 font */
+#define FONT_HD44780_INT                /* International font (English) */
+//#define FONT_HD44780_WIN1251             /* Cyrillic font (European) */
+/* I2C bus */
+#define I2C_BITBANG                     /* bit-bang I2C */
+#define I2C_STANDARD_MODE               /* 100kHz bus speed */
+#define I2C_PORT         PORTD          /* I2C port data register */
+#define I2C_DDR          DDRD           /* I2C port data direction register */
+#define I2C_PIN          PIND           /* I2C port input pins register */
+#define I2C_SDA          PD0            /* port pin used for SDA */
+#define I2C_SCL          PD1            /* port pin used for SCL */
+#endif
+
+
+
+/*
+ *  ILI9163
+ *  - 4 wire SPI interface using bit-bang SPI
+ */
+
+#if 0
+#define LCD_ILI9163                     /* display controller ILI9163 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_COLOR                       /* color display */
+#define LCD_SPI                         /* SPI interface */
+/* control and data lines */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RES          PD4            /* port pin used for /RESX (optional) */
+#define LCD_CS           PD5            /* port pin used for /CSX (optional) */
+#define LCD_DC           PD3            /* port pin used for D/CX */
+#define LCD_SCL          PD2            /* port pin used for SCL */
+#define LCD_SDA          PD1            /* port pin used for SDA/SDIO */
+/* display settings */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       128            /* number of vertical dots */
+#define LCD_OFFSET_X      32            /* x offset of 32 dots (160-128) */
+//#define LCD_FLIP_X                      /* enable horizontal flip */
+#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_ROTATE                      /* switch X and Y (rotate by 90�) */
+#define LCD_BGR                         /* reverse red and blue color channels */
+//#define LCD_LATE_ON                     /* turn on LCD after clearing it */
+/* font and symbols: horizonally aligned & flipped */
+#define FONT_8X8_HF                     /* 8x8 font */
+//#define FONT_10X16_HF                   /* 10x16 font */
+//#define FONT_8X8_ISO8859_2_HF           /* 8x8 Central European font */
+//#define FONT_10X16_ISO8859_2_HF         /* 10x16 Central European font */
+//#define FONT_8X16_WIN1251_HF            /* 8x16 cyrillic font */
+//#define FONT_8X16ALT_WIN1251_HF         /* 8x16 alternative cyrillic font */
+#define SYMBOLS_30X32_HF                /* 30x32 symbols */
+/* SPI bus */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCL        /* port pin used for SCK */
+#define SPI_MOSI         LCD_SDA        /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  ILI9342
+ *  - SPI interface using bit-bang SPI
+ */
+
+#if 0
+#define LCD_ILI9341                     /* display controller ILI9341/ILI9342 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_COLOR                       /* color display */
+#define LCD_SPI                         /* SPI interface */
+/* control and data lines */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RES          PD4            /* port pin used for /RES (optional) */
+#define LCD_CS           PD5            /* port pin used for /CS (optional) */
+#define LCD_DC           PD3            /* port pin used for D/C */
+#define LCD_SCK          PD2            /* port pin used for SCK */
+#define LCD_SDI          PD1            /* port pin used for SDI (data input) */
+//#define LCD_SDO          PD0            /* port pin used for SDO (data output) */
+/* display settings */
+#define LCD_DOTS_X       320            /* number of horizontal dots */
+#define LCD_DOTS_Y       240            /* number of vertical dots */
+//#define LCD_FLIP_X                      /* enable horizontal flip */
+//#define LCD_FLIP_Y                      /* enable vertical flip */
+//#define LCD_ROTATE                      /* switch X and Y (rotate by 90�) */
+//#define LCD_BGR                         /* reverse red and blue color channels */
+//#define LCD_EXT_CMD_OFF                 /* extended commands disabled */
+/* font and symbols: horizontally aligned & flipped */
+#define FONT_16X26_HF                   /* 16x26 font */
+//#define FONT_16X26_ISO8859_2_HF         /* 16x26 Central European font */
+//#define FONT_16X26_WIN1251_HF           /* 16x26 cyrillic font */
+#define SYMBOLS_32X32_HF                /* 32x32 symbols */
+/* SPI bus */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCK        /* port pin used for SCK */
+#define SPI_MOSI         LCD_SDI        /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  PCD8544
+ *  - SPI interface using bit-bang SPI
+ *  - for a 180� rotated display (LCD_ROT180)
+ *    - comment out "_VF" font and "_VFP" symbols
+ *    - uncomment "_V_F" font and "_VP_F" symbols
+ */
+
+#if 0
+#define LCD_PCD8544                     /* display controller PCD8544 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_SPI                         /* SPI interface */
+/* control and data lines */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RES          PD4            /* port pin used for /RES (optional) */
+#define LCD_SCE          PD5            /* port pin used for /SCE (optional) */
+#define LCD_DC           PD3            /* port pin used for D/C */
+#define LCD_SCLK         PD2            /* port pin used for SCLK */
+#define LCD_SDIN         PD1            /* port pin used for SDIN (data input) */
+/* display settings */
+#define LCD_DOTS_X       84             /* number of horizontal dots */
+#define LCD_DOTS_Y       48             /* number of vertical dots */
+#define LCD_CONTRAST     66             /* default contrast (1-127) */
+/* font and symbols: vertically aligned & flipped */
+#define FONT_6X8_VF                     /* 6x8 font */
+//#define FONT_6X8_ISO8859_2_VF         /* 6x8 Central Euopean font */
+#define SYMBOLS_24X24_VFP               /* 24x24 symbols, vertically aligned & flipped */
+//#define LCD_ROT180                      /* rotate output by 180� (not supported yet) */
+/* font and symbols: vertically aligned, bank-wise grouping, hor. flipped */
+//#define FONT_6X8_V_F                    /* 6x8 font */
+//#define FONT_6X8_ISO8859_2_V_F          /* 6x8 Central Euopean font */
+//#define SYMBOLS_24X24_VP_F              /* 24x24 symbols */
+/* SPI bus */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCLK       /* port pin used for SCK */
+#define SPI_MOSI         LCD_SDIN       /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  PCF8814
+ *  - 3 wire SPI interface using bit-bang SPI
+ */
+
+#if 0
+#define LCD_PCF8814                     /* display controller PCF8814 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_SPI                         /* SPI interface */
+/* control and data lines */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RESET        PD4            /* port pin used for /RES */
+#define LCD_CS           PD5            /* port pin used for /CS (optional) */
+#define LCD_SCLK         PD2            /* port pin used for SCLK */
+#define LCD_SDIN         PD1            /* port pin used for SDIN (data input) */
+/* display settings */
+#define LCD_DOTS_X       96             /* number of horizontal dots */
+#define LCD_DOTS_Y       65             /* number of vertical dots */
+//#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_CONTRAST     5              /* default contrast (0-255) */
+/* font and symbols: vertically aligned & flipped, page-wise grouping */
+#define FONT_6X8_VF                     /* 6x8 font */
+//#define FONT_6X8_ISO8859_2_VF             /* 6x8 Central European font */
+#define SYMBOLS_24X24_VFP               /* 24x24 symbols */
+/* SPI bus */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_9                           /* support 9 bit frames */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCLK       /* port pin used for SCK */
+#define SPI_MOSI         LCD_SDIN       /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  SH1106
+ *  - 4 wire SPI interface using bit-bang SPI
+ *  - untested
+ */
+
+#if 0
+#define LCD_SH1106                      /* display controller SH1106 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_SPI                         /* SPI interface */
+/* control and data lines */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RESET        PD4            /* port pin used for /RES (optional) */
+#define LCD_CS           PD5            /* port pin used for /CS (optional) */
+#define LCD_A0           PD3            /* port pin used for A0 */
+#define LCD_SCL          PD2            /* port pin used for SCL */
+#define LCD_SI           PD1            /* port pin used for SI (data input) */
+/* display settings */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       64             /* number of vertical dots */
+#define LCD_OFFSET_X     2              /* enable x offset of 2 or 4 dots */
+#define LCD_FLIP_X                      /* enable horizontal flip */
+#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_CONTRAST     127            /* default contrast (0-255) */
+/* font and symbols: vertically aligned & flipped, bank-wise grouping */
+//#define FONT_6X8_VF                      /* 6x8 font */
+#define FONT_8X8_VF                     /* 8x8 font */
+//#define FONT_8X16_VFP                   /* 8x16 font */
+//#define FONT_6X8_ISO8859_2_VF           /* 6x8 Central European font */
+//#define FONT_8X8_ISO8859_2_VF           /* 8x8 Central European font */
+//#define FONT_8X12T_ISO8859_2_VFP        /* thin 8x12 Central European font */
+//#define FONT_8X16_ISO8859_2_VFP         /* 8x16 Central European font */
+//#define FONT_8X8_WIN1251_VF             /* 8x8 cyrillic font */
+//#define FONT_8X8ALT_WIN1251_VF          /* 8x8 alternative cyrillic font */
+//#define FONT_8X8T_WIN1251_VF            /* thin 8x8 cyrillic font */
+//#define FONT_8X12T_WIN1251_VFP          /* thin 8x12 cyrillic font */
+//#define FONT_8X16_WIN1251_VFP           /* 8x16 cyrillic font */
+#define SYMBOLS_24X24_VFP               /* 24x24 symbols */
+/* SPI bus */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCL        /* port pin used for SCK */
+#define SPI_MOSI         LCD_SI         /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  SH1106
+ *  - 3 wire SPI interface using bit-bang SPI
+ *  - untested
+ */
+
+#if 0
+#define LCD_SH1106                      /* display controller SH1106 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_SPI                         /* SPI interface */
+/* control and data lines */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RESET        PD4            /* port pin used for /RES (optional) */
+#define LCD_CS           PD5            /* port pin used for /CS (optional) */
+#define LCD_SCL          PD2            /* port pin used for SCL */
+#define LCD_SI           PD1            /* port pin used for SI (data input) */
+/* display settings */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       64             /* number of vertical dots */
+#define LCD_OFFSET_X     2              /* enable x offset of 2 or 4 dots */
+#define LCD_FLIP_X                      /* enable horizontal flip */
+#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_CONTRAST     127            /* default contrast (0-255) */
+/* font and symbols: vertically aligned & flipped, bank-wise grouping */
+#define FONT_8X8_VF                     /* 8x8 font */
+#define SYMBOLS_24X24_VFP               /* 24x24 symbols */
+/* SPI bus */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_9                           /* support 9 bit frames */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCL        /* port pin used for SCK */
+#define SPI_MOSI         LCD_SI         /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  SH1106
+ *  - I2C interface using bit-bang I2C
+ */
+
+#if 0
+#define LCD_SH1106                      /* display controller SH1106 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_I2C                         /* I2C interface */
+#define LCD_I2C_ADDR     0x3c           /* SH1106's I2C address */
+/* control lines */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+//#define LCD_RESET        PD4            /* port pin used for /RES (optional) */
+/* display settings */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       64             /* number of vertical dots */
+#define LCD_OFFSET_X     2              /* enable x offset of 2 or 4 dots */
+#define LCD_FLIP_X                      /* enable horizontal flip */
+#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_CONTRAST     127            /* default contrast (0-255) */
+/* font and symbols: vertically aligned & flipped, bank-wise grouping */
+#define FONT_8X8_VF                     /* 8x8 font */
+#define SYMBOLS_24X24_VFP               /* 24x24 symbols */
+/* I2C bus */
+#define I2C_BITBANG                     /* bit-bang I2C */
+#define I2C_FAST_MODE                   /* 400kHz bus speed */
+#define I2C_PORT         PORTD          /* I2C port data register */
+#define I2C_DDR          DDRD           /* I2C port data direction register */
+#define I2C_PIN          PIND           /* I2C port input pins register */
+#define I2C_SDA          PD0            /* port pin used for SDA */
+#define I2C_SCL          PD1            /* port pin used for SCL */
+#endif
+
+
+
+/*
+ *  SSD1306
+ *  - 4 wire SPI interface using bit-bang SPI
+ */
+
+#if 0
+#define LCD_SSD1306                     /* display controller SSD1306 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_SPI                         /* SPI interface */
+/* control and data lines */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RESET        PD4            /* port pin used for /RES (optional) */
+#define LCD_CS           PD5            /* port pin used for /CS (optional) */
+#define LCD_DC           PD3            /* port pin used for D/C */
+#define LCD_SCLK         PD2            /* port pin used for SCLK */
+#define LCD_SDIN         PD1            /* port pin used for SDIN (data input) */
+/* display settings */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       64             /* number of vertical dots */
+#define LCD_FLIP_X                      /* enable horizontal flip */
+#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_CONTRAST     127            /* default contrast (0-255) */
+/* font and symbols: vertically aligned & flipped, bank-wise grouping */
+//#define FONT_6X8_VF                      /* 6x8 font */
+#define FONT_8X8_VF                     /* 8x8 font */
+//#define FONT_8X16_VFP                   /* 8x16 font */
+//#define FONT_6X8_ISO8859_2_VF           /* 6x8 Central European font */
+//#define FONT_8X8_ISO8859_2_VF           /* 8x8 Central European font */
+//#define FONT_8X12T_ISO8859_2_VFP        /* thin 8x12 Central European font */
+//#define FONT_8X16_ISO8859_2_VFP         /* 8x16 Central European font */
+//#define FONT_8X8_WIN1251_VF             /* 8x8 cyrillic font */
+//#define FONT_8X8ALT_WIN1251_VF          /* 8x8 alternative cyrillic font */
+//#define FONT_8X8T_WIN1251_VF            /* thin 8x8 cyrillic font */
+//#define FONT_8X12T_WIN1251_VFP          /* thin 8x12 cyrillic font */
+//#define FONT_8X16_WIN1251_VFP           /* 8x16 cyrillic font */
+#define SYMBOLS_24X24_VFP               /* 24x24 symbols */
+/* SPI bus */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCLK       /* port pin used for SCK */
+#define SPI_MOSI         LCD_SDIN       /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  SSD1306
+ *  - 3 wire SPI interface using bit-bang SPI
+ */
+
+#if 0
+#define LCD_SSD1306                     /* display controller SSD1306 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_SPI                         /* SPI interface */
+/* control and data lines */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RESET        PD4            /* port pin used for /RES (optional) */
+#define LCD_CS           PD5            /* port pin used for /CS (optional) */
+#define LCD_SCLK         PD2            /* port pin used for SCLK */
+#define LCD_SDIN         PD1            /* port pin used for SDIN (data input) */
+/* display settings */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       64             /* number of vertical dots */
+#define LCD_FLIP_X                      /* enable horizontal flip */
+#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_CONTRAST     127            /* default contrast (0-255) */
+/* font and symbols: vertically aligned & flipped, bank-wise grouping */
+#define FONT_8X8_VF                     /* 8x8 font */
+#define SYMBOLS_24X24_VFP               /* 24x24 symbols */
+/* SPI bus */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_9                           /* support 9 bit frames */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCLK       /* port pin used for SCK */
+#define SPI_MOSI         LCD_SDIN       /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  SSD1306
+ *  - I2C interface using bit-bang I2C
+ */
+
+#if 0
+#define LCD_SSD1306                     /* display controller SSD1306 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_I2C                         /* I2C interface */
+#define LCD_I2C_ADDR     0x3c           /* SSD1306's I2C address */
+/* control lines */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RESET        PD4            /* port pin used for /RES (optional) */
+/* display settings */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       64             /* number of vertical dots */
+#define LCD_FLIP_X                      /* enable horizontal flip */
+#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_CONTRAST     127            /* default contrast (0-255) */
+/* font and symbols: vertically aligned & flipped, bank-wise grouping */
+#define FONT_8X8_VF                     /* 8x8 font */
+#define SYMBOLS_24X24_VFP               /* 24x24 symbols */
+/* I2C bus */
+#define I2C_BITBANG                     /* bit-bang I2C */
+#define I2C_FAST_MODE                   /* 400kHz bus speed */
+#define I2C_PORT         PORTD          /* I2C port data register */
+#define I2C_DDR          DDRD           /* I2C port data direction register */
+#define I2C_PIN          PIND           /* I2C port input pins register */
+#define I2C_SDA          PD0            /* port pin used for SDA */
+#define I2C_SCL          PD1            /* port pin used for SCL */
+#endif
+
+
+
+/*
+ *  ST7036
+ *  - 4 bit parallel interface
+ *  - enable LCD_DB_STD when using port pins 0-3 for LCD_DB4/5/6/7
+ *  - untested!!!
+ */
+
+#if 0
+#define LCD_ST7036                      /* display controller ST7036 */
+#define LCD_TEXT                        /* character display */
+#define LCD_PAR_4                       /* 4 bit parallel interface */
+/* control and data lines */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+//#define LCD_DB_STD                      /* use standard pins 0-3 for DB4-7 */
+#define LCD_DB4          PD0            /* port pin used for DB4 */
+#define LCD_DB5          PD1            /* port pin used for DB5 */
+#define LCD_DB6          PD2            /* port pin used for DB6 */
+#define LCD_DB7          PD3            /* port pin used for DB7 */
+#define LCD_RS           PD4            /* port pin used for RS */
+#define LCD_EN           PD5            /* port pin used for E */
+//#define LCD_RW           ???            /* port pin used for R/W (optional) */
+//#define LCD_RESET        ???            /* port pin used for XRESET (optional) */
+/* display settings */
+#define LCD_CHAR_X       16             /* characters per line */
+#define LCD_CHAR_Y       3              /* number of lines */
+#define LCD_EXTENDED_CMD                /* extended instruction set (EXT pin high) */
+#define LCD_CONTRAST     32             /* default contrast (0-63) */
+/* ST7036 has internal 5x8 font */
+#define FONT_ST7036                     /* 5x8 font */
+#endif
+
+
+
+/*
+ *  ST7036
+ *  - 4 wire SPI interface using bit-bang SPI
+ *  - untested!!!
+ */
+
+#if 0
+#define LCD_ST7036                      /* display controller ST7036 */
+#define LCD_TEXT                        /* character display */
+#define LCD_SPI                         /* SPI interface */
+/* control and data lines */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RESET        PD4            /* port pin used for XRESET (optional) */
+#define LCD_CS           PD5            /* port pin used for CSB (optional) */
+#define LCD_RS           PD3            /* port pin used for RS */
+#define LCD_SCL          PD2            /* port pin used for SCL */
+#define LCD_SI           PD1            /* port pin used for SI (data input) */
+/* display settings */
+#define LCD_CHAR_X       16             /* characters per line */
+#define LCD_CHAR_Y       3              /* number of lines */
+#define LCD_EXTENDED_CMD                /* extended instruction set (EXT pin high) */
+#define LCD_CONTRAST     32             /* default contrast (0-63) */
+/* ST7036 has internal 5x8 font */
+#define FONT_ST7036                     /* 5x8 font */
+/* SPI bus */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCL        /* port pin used for SCK */
+#define SPI_MOSI         LCD_SI         /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  ST7565R
+ *  - SPI interface using bit-bang SPI
+ *  - settings for Electronic Assembly EA DOGM/DOGL128-6
+ *  - uses LCD_CS to support rotary encoder in parallel at PD2/3
+ */
+
+#if 0
+#define LCD_ST7565R                     /* display controller ST7565R */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_SPI                         /* SPI interface */
+/* control and data lines */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RESET        PD0            /* port pin used for /RES (optional) */
+#define LCD_CS           PD5            /* port pin used for /CS1 (optional) */
+#define LCD_A0           PD1            /* port pin used for A0 */
+#define LCD_SCL          PD2            /* port pin used for SCL */
+#define LCD_SI           PD3            /* port pin used for SI (data input) */
+/* display settings */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       64             /* number of vertical dots */
+#define LCD_OFFSET_X                    /* enable x offset of 4 dots */
+//#define LCD_FLIP_X                      /* enable horizontal flip */
+#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_START_Y      0              /* start line (0-63) */
+#define LCD_CONTRAST     22             /* default contrast (0-63) */
+/* font and symbols: vertically aligned & flipped, bank-wise grouping */
+//#define FONT_6X8_VF                      /* 6x8 font */
+#define FONT_8X8_VF                     /* 8x8 font */
+//#define FONT_8X16_VFP                   /* 8x16 font */
+//#define FONT_6X8_ISO8859_2_VF           /* 6x8 Central European font */
+//#define FONT_8X8_ISO8859_2_VF           /* 8x8 Central European font */
+//#define FONT_8X12T_ISO8859_2_VFP        /* thin 8x12 Central European font */
+//#define FONT_8X16_ISO8859_2_VFP         /* 8x16 Central European font */
+//#define FONT_8X8_WIN1251_VF             /* 8x8 cyrillic font */
+//#define FONT_8X8ALT_WIN1251_VF          /* 8x8 alternative cyrillic font */
+//#define FONT_8X8T_WIN1251_VF            /* thin 8x8 cyrillic font */
+//#define FONT_8X12T_WIN1251_VFP          /* thin 8x12 cyrillic font */
+//#define FONT_8X16_WIN1251_VFP           /* 8x16 cyrillic font */
+#define SYMBOLS_24X24_VFP               /* 24x24 symbols */
+/* SPI bus */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCL        /* port pin used for SCK */
+#define SPI_MOSI         LCD_SI         /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  ST7735
+ *  - 4 wire SPI interface using bit-bang SPI
+ */
+
+#if 1
+#define LCD_ST7735                      /* display controller ST7735 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_COLOR                       /* color display */
+#define LCD_SPI                         /* SPI interface */
+/* control and data lines */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RES          PD0            /* port pin used for /RESX (optional) */
+#define LCD_CS           PD5            /* port pin used for /CSX (optional) */
+#define LCD_DC           PD1            /* port pin used for D/CX */
+#define LCD_SCL          PD2            /* port pin used for SCL */
+#define LCD_SDA          PD3            /* port pin used for SDA */
+/* display settings */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       160            /* number of vertical dots */
+//#define LCD_OFFSET_X     4               /* enable x offset of 2 or 4 dots */
+//#define LCD_OFFSET_Y     2               /* enable y offset of 1 or 2 dots */
+#define LCD_FLIP_X                      /* enable horizontal flip */
+//#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_ROTATE                      /* switch X and Y (rotate by 90�) */
+//#define LCD_BGR                         /* reverse red and blue color channels */
+#define LCD_LATE_ON                     /* turn on LCD after clearing it */
+/* font and symbols: horizontally aligned & flipped */
+#define FONT_10X16_HF                   /* 10x16 font */
+//#define FONT_6X8_ISO8859_2_HF           /* 6x8 Central European font */
+//#define FONT_8X8_ISO8859_2_HF           /* 8x8 Central European font */
+//#define FONT_10X16_ISO8859_2_HF         /* 10x16 Central European font */
+//#define FONT_8X16_WIN1251_HF            /* 8x16 cyrillic font */
+//#define FONT_8X16ALT_WIN1251_HF         /* 8x16 alternative cyrillic font */
+#define SYMBOLS_24X24_HF                /* 24x24 symbols */
+/* SPI bus */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCL        /* port pin used for SCK */
+#define SPI_MOSI         LCD_SDA        /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  ST7920
+ *  - SPI interface using bit-bang SPI
+ *  - for a 180� rotated display (LCD_ROT180)
+ *    - comment out "_H" font and symbols
+ *    - uncomment "_HF" font and symbols
+ */
+
+#if 0
+#define LCD_ST7920                      /* display controller ST7920 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_SPI                         /* SPI interface */
+/* control and data lines */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RESET        PD4            /* port pin used for /RESET (optional) */
+#define LCD_CS           PD5            /* port pin used for CS (optional) */
+#define LCD_SCLK         PD2            /* port pin used for SCLK */
+#define LCD_SID          PD1            /* port pin used for SID (data input) */
+/* display settings */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       64             /* number of vertical dots */
+/* font and symbols: horizonally aligned */
+#define FONT_8X8_H                      /* 8x8 font  */
+//#define FONT_8X8_ISO8859_2_H            /* 8x8 Central European font */
+#define SYMBOLS_24X24_H                 /* 24x24 symbols */
+//#define LCD_ROT180                      /* rotate output by 180� */
+/* font and symbols: horizonally aligned & flipped */
+//#define FONT_8X8_HF                     /* 8x8 font */
+//#define FONT_8X8_ISO8859_2_HF           /* 8x8 Central European font */
+//#define SYMBOLS_24X24_HF                /* 24x24 symbols */
+/* SPI bus */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCLK       /* port pin used for SCK */
+#define SPI_MOSI         LCD_SID        /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  ST7920
+ *  - 4 bit parallel interface
+ *  - if you change LCD_DB4/5/6/7 comment out LCD_DB_STD!
+ *  - for a 180� rotated display (LCD_ROT180)
+ *    - comment out "_H" font and symbol
+ *    - uncomment "_HF" font and symbol
+ */
+
+#if 0
+#define LCD_ST7920                      /* display controller ST7920 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_PAR_4                       /* 4 bit parallel interface */
+/* control and data lines */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_DB_STD                      /* use standard pins 0-3 for DB4-7 */
+#define LCD_DB4          PD0            /* port pin used for DB4 */
+#define LCD_DB5          PD1            /* port pin used for DB5 */
+#define LCD_DB6          PD2            /* port pin used for DB6 */
+#define LCD_DB7          PD3            /* port pin used for DB7 */
+#define LCD_RS           PD4            /* port pin used for RS */
+#define LCD_EN           PD5            /* port pin used for E */
+//#define LCD_RW           PD?            /* port pin used for RW (optional) */
+//#define LCD_RESET        PD?            /* port pin used for /RESET (optional) */
+/* display settings */
+#define LCD_DOTS_X       128            /* number of horizontal dots */
+#define LCD_DOTS_Y       64             /* number of vertical dots */
+/* font and symbols: horizonally aligned */
+#define FONT_8X8_H                      /* 8x8 font */
+#define SYMBOLS_24X24_H                 /* 24x24 symbols */
+//#define LCD_ROT180                      /* rotate output by 180� */
+/* font and symbols: horizonally aligned & flipped */
+//#define FONT_8X8_HF                     /* 8x8 font */
+//#define SYMBOLS_24X24_HF                /* 24x24 symbols */
+#endif
+
+
+
+/*
+ *  STE2007
+ *  - 3 wire SPI interface using bit-bang SPI
+ */
+
+#if 0
+#define LCD_STE2007                     /* display controller STE2007 */
+#define LCD_GRAPHIC                     /* graphic display */
+#define LCD_SPI                         /* SPI interface */
+/* control and data lines */
+#define LCD_PORT         PORTD          /* port data register */
+#define LCD_DDR          DDRD           /* port data direction register */
+#define LCD_RESET        PD4            /* port pin used for /RES (optional) */
+#define LCD_CS           PD5            /* port pin used for /CS (optional) */
+#define LCD_SCLK         PD2            /* port pin used for SCLK */
+#define LCD_SDIN         PD1            /* port pin used for SDIN (data input) */
+/* display settings */
+#define LCD_DOTS_X       96             /* number of horizontal dots */
+#define LCD_DOTS_Y       68             /* number of vertical dots */
+//#define LCD_FLIP_X                      /* enable horizontal flip */
+//#define LCD_FLIP_Y                      /* enable vertical flip */
+#define LCD_CONTRAST     16             /* default contrast (0-31) */
+/* font and symbols: vertically aligned & flipped */
+#define FONT_6X8_VF                     /* 6x8 font */
+//#define FONT_6X8_ISO8859_2_VF             /* 6x8 Central European font */
+#define SYMBOLS_24X24_VFP               /* 24x24 symbols */
+/* SPI bus */
+#define SPI_BITBANG                     /* bit-bang SPI */
+#define SPI_9                           /* support 9 bit frames */
+#define SPI_PORT         LCD_PORT       /* SPI port data register */
+#define SPI_DDR          LCD_DDR        /* SPI port data direction register */
+#define SPI_SCK          LCD_SCLK       /* port pin used for SCK */
+#define SPI_MOSI         LCD_SDIN       /* port pin used for MOSI */
+#endif
+
+
+
+/*
+ *  VT100 serial terminal, TTL serial
+ */
+
+#if 0
+#define LCD_VT100                       /* pseudo display VT100 */
+#define LCD_TEXT                        /* character display */
+#define LCD_COLOR                       /* color display */
+#define LCD_CHAR_X       40             /* characters per line */
+#define LCD_CHAR_Y       24             /* number of lines */
+#define SERIAL_BITBANG                  /* bit-bang serial */
+//#define SERIAL_HARDWARE                 /* hardware serial */
+#endif
+
+
+
+/*
+ *  check if a LCD module is specified
+ */
+
+#if !defined(LCD_TEXT) && !defined(LCD_GRAPHIC)
+  #error <<< No LCD module specified! >>>
+#endif
+
+
+
+/* ************************************************************************
+ *   port and pin assignments
+ * ************************************************************************ */
+
+
+/*
+ *  test pins / probes:
+ *  - Must be an ADC port
+ *  - Lower 3 pins of the port must be used for probes.
+ *  - Please don't change the definitions of TP1, TP2 and TP3!
+ *  - Don't share this port with POWER_CTRL or TEST_BUTTON!
+ */
+
+#define ADC_PORT         PORTC     /* port data register */
+#define ADC_DDR          DDRC      /* port data direction register */
+#define ADC_PIN          PINC      /* port input pins register */
+#define TP1              PC0       /* test pin / probe #1 */
+#define TP2              PC1       /* test pin / probe #2 */
+#define TP3              PC2       /* test pin / probe #3 */
+
+#define TP_ZENER         PC3       /* test pin for 10:1 voltage divider */
+#define TP_REF           PC4       /* test pin for 2.5V reference and relay */
+#define TP_BAT           PC5       /* test pin for battery (4:1 voltage divider) */
+
+
+/*
+ *  probe resistors
+ *  - For PWM/squarewave output via probe #2 R_RL_2 has to be PB2/OC1B.
+ *  - Don't share this port with POWER_CTRL or TEST_BUTTON!
+ */
+
+#define R_PORT           PORTB     /* port data register */
+#define R_DDR            DDRB      /* port data direction register */
+#define R_RL_1           PB0       /* Rl (680R) for test pin #1 */
+#define R_RH_1           PB1       /* Rh (470k) for test pin #1 */
+#define R_RL_2           PB2       /* Rl (680R) for test pin #2 */
+#define R_RH_2           PB3       /* Rh (470k) for test pin #2 */
+#define R_RL_3           PB4       /* Rl (680R) for test pin #3 */
+#define R_RH_3           PB5       /* Rh (470k) for test pin #3 */
+
+
+/*
+ *  dedicated signal output via OC1B
+ *  - don't change this!
+ */
+
+#define SIGNAL_PORT      PORTB     /* port data register */
+#define SIGNAL_DDR       DDRB      /* port data direction register */
+#define SIGNAL_OUT       PB2       /* MCU's OC1B pin */
+
+
+/*
+ *  power control
+ *  - can't be same port as ADC_PORT or R_PORT
+ */
+
+#define POWER_PORT       PORTD     /* port data register */
+#define POWER_DDR        DDRD      /* port data direction register */
+#define POWER_CTRL       PD6       /* control pin (1: on / 0: off) */
+
+
+/*
+ *  test push button 
+ *  - can't be same port as ADC_PORT or R_PORT
+ */
+
+#define BUTTON_PORT      PORTD     /* port data register */
+#define BUTTON_DDR       DDRD      /* port data direction register */
+#define BUTTON_PIN       PIND      /* port input pins register */
+#define TEST_BUTTON      PD7       /* test/start push button (low active) */
+
+
+/*
+ *  rotary encoder
+ */
+
+#define ENCODER_PORT     PORTD     /* port data register */
+#define ENCODER_DDR      DDRD      /* port data direction register */
+#define ENCODER_PIN      PIND      /* port input pins register */
+#define ENCODER_A        PD3       /* rotary encoder A signal */
+#define ENCODER_B        PD1       /* rotary encoder B signal */
+
+
+/*
+ *  increase/decrease push buttons
+ */
+
+#define KEY_PORT         PORTD     /* port data register */
+#define KEY_DDR          DDRD      /* port data direction register */
+#define KEY_PIN          PIND      /* port input pins register */
+#define KEY_INC          PD2       /* increase push button (low active) */
+#define KEY_DEC          PD3       /* decrease push button (low active) */
+
+
+/*
+ *  frequency counter
+ *  - input must be pin PD4/T0
+ */
+
+#define COUNTER_PORT     PORTD     /* port data register */
+#define COUNTER_DDR      DDRD      /* port data direction register */
+#define COUNTER_IN       PD4       /* signal input T0 */
+
+
+/*
+ *  IR detector/decoder
+ *  - fixed module connected to dedicated I/O pin
+ */
+
+#define IR_PORT          PORTC     /* port data register */
+#define IR_DDR           DDRC      /* port data direction register */
+#define IR_PIN           PINC      /* port input pins register */
+#define IR_DATA          PC6       /* data signal */
+
+
+/*
+ *  SPI
+ *  - hardware SPI uses
+ *    SCK PB5, MOSI PB3, MISO PB4 and /SS PB2
+ *  - could be already set in display section
+ *  - unused signals can be ignored
+ *  - /SS is set to output mode for hardware SPI but not used
+ */
+
+/* for bit-bang and hardware SPI */
+#ifndef SPI_PORT
+#define SPI_PORT         PORTB     /* port data register */
+#define SPI_DDR          DDRB      /* port data direction register */
+#define SPI_PIN          PINB      /* port input pins register */
+#define SPI_SCK          PB5       /* pin for SCK */
+#define SPI_MOSI         PB3       /* pin for MOSI */
+#define SPI_MISO         PB4       /* pin for MISO */
+#define SPI_SS           PB2       /* pin for /SS */
+#endif
+
+
+/*
+ *  I2C
+ *  - hardware I2C (TWI) uses
+ *    SDA PC4 and SCL PC5
+ *  - could be already set in display section
+ */
+
+/* for bit-bang I2C */
+#ifndef I2C_PORT
+#define I2C_PORT         PORTC     /* port data register */
+#define I2C_DDR          DDRC      /* port data direction register */
+#define I2C_PIN          PINC      /* port input pins register */
+#define I2C_SDA          PC4       /* pin for SDA */
+#define I2C_SCL          PC5       /* pin for SCL */
+#endif
+
+
+/*
+ *  TTL serial interface
+ *  - hardware USART uses
+ *    USART0: Rx PD0 and Tx PD1
+ */
+
+/* for hardware RS232 */
+#define SERIAL_USART     0         /* use USART0 */
+/* for bit-bang RS232 */
+#define SERIAL_PORT      PORTD     /* port data register */
+#define SERIAL_DDR       DDRD      /* port data direction register */
+#define SERIAL_PIN       PIND      /* port input pins register */
+#define SERIAL_TX        PD1       /* pin for Tx (transmit) */
+#define SERIAL_RX        PD0       /* pin for Rx (receive) */
+#define SERIAL_PCINT     16        /* PCINT# for Rx pin */
+
+
+/*
+ *  OneWire
+ *  - dedicated I/O pin
+ */
+
+#define ONEWIRE_PORT     PORTC     /* port data register */
+#define ONEWIRE_DDR      DDRC      /* port data direction register */
+#define ONEWIRE_PIN      PINC      /* port input pins register */
+#define ONEWIRE_DQ       PC6       /* DQ (data line) */
+
+
+
+/* ************************************************************************
+ *   internal stuff
+ * ************************************************************************ */
+
+
+/* ADC reference selection: AVcc */
+#define ADC_REF_VCC           (1 << REFS0)
+
+/* ADC reference selection: internal 1.1V bandgap */
+#define ADC_REF_BANDGAP       ((1 << REFS1) | (1 << REFS0))
+
+/* ADC reference selection: filter mask for register bits */
+#define ADC_REF_MASK          ((1 << REFS1) | (1 << REFS0))
+
+/* ADC MUX channel: internal 1.1V bandgap reference */
+#define ADC_CHAN_BANDGAP      0x0e      /* 1110 */
+
+/* ADC MUX channel: filter mask for register bits */
+#define ADC_CHAN_MASK         0b00001111     /* MUX0-3 */
+
+
+
+/* ************************************************************************
+ *   MCU specific setup to support different AVRs
+ * ************************************************************************ */
+
+
+/*
+ *  ATmega 328/328P
+ */
+
+#if defined(__AVR_ATmega328__)
+
+  /* estimated internal resistance of port to GND (in 0.1 Ohms) */
+  #define R_MCU_LOW           200
+
+  /* estimated internal resistance of port to VCC (in 0.1 Ohms) */
+  #define R_MCU_HIGH          220
+
+  /* voltage offset of MCU's analog comparator (in mV): -50 up to 50 */
+  #define COMPARATOR_OFFSET   0
+
+  /* this MCU has 32kB Flash, 1kB EEPROM and 2kB RAM (enable extra features) */
+  #define RES_FLASH           32
+  #define RES_EEPROM          1
+  #define RES_RAM             2
+
+
+/*
+ *  missing or unsupported MCU
+ */
+
+#else
+  #error <<< No or wrong MCU type selected! >>>
+#endif
+
+
+
+/* ************************************************************************
+ *   EOF
+ * ************************************************************************ */

+ 4 - 0
transistor-tester/firmware/ComponentTester.cfg

@@ -0,0 +1,4 @@
+fuses_lo = 0xf7
+fuses_hi = 0xd9
+fuses_ext = 0xfc
+lock_byte = 0xff

+ 6 - 0
transistor-tester/firmware/README.md

@@ -0,0 +1,6 @@
+# Config for AY-AT m-firmware
+
+Contains folders with just the configuration parameters I use for building the firmware. Based on the recommendations in the file "Clones" in the firmware.
+
+The rest of the code is available at:
+https://github.com/madires/Transistortester-Warehouse/blob/master/Firmware/m-firmware/

Some files were not shown because too many files changed in this diff