A project log for Logic probe using ATTINY26

A Logic Probe with the usual LEDs and sound output based on an ATTINY26. My entry to the 1k challenge.

Klaus Dormann 12/24/2016 at 11:420 Comments

You may have noticed that the ADC is used in 8-bit mode as the ADLAR bit (ADC left adjust result) is set in ADMUX. At the same time we only use ADCH to determine the voltage thresholds. The reference voltage is set to Vcc. So we get 0 for ground and 255 for Vcc. Now we need to use the rule of three (also called the rule of proportion) to find the ADCH values for a certain percentage or voltage.

For CMOS the voltages are defined as <= 30% Vcc for low, >= 70% for high.

• ADClow = 255 * 30 / 100 = 76.5
• ADChigh = 255 * 70 / 100 = 178,5

Since we can only compare an integer with ADCH we need to cut off the result to an integer. The compare results are based on the carry flag of the compare. 0 = same or higher, 1 = lower. As we want to compare the lower threshold to be lower or equal we need to elevate the lower threshold by 1. I used ADClow = 77 and ADChigh = 178.

For TTL the voltages are defined as Vcc = 5V, Vlow = 0.8V and Vhigh = 2V