Path:AVR-EN => Applications => ATtiny24 experimental board with LCD
tn24_lcd experimental board small Applications of
AVR single chip controllers AT90S, ATtiny, ATmega and ATxmega
Experimental board with an ATtiny24/44/84 and an LCD

Experimental board with an ATtiny24/44/84 and a LCD

Zipped version of this webpage (565 kB) This page as PDF (1.1 MB)

tn24_lcd experimental board For those who need a small controller application with an LCD and need up to four I/O pins of the controller for own purposes, here is a tailored solution:

0 Overview

  1. Hardware
  2. Mounting
  3. Software

1 Hardware

1.1 Scheme of the board

tn24_lcd scheme With that scheme either an ATtiny24, an ATtiny44 or an ATtiny84, resp. the corresponding A types, can be used. The A types only differ in the supply current and in other electrical properties, different numbers differ by available flash and EEPROM memory.

The capacitor of 10 or 100 nF (ceramic type) and the reset pull-up resistor of 10 k are standard components.

The six pin plug “Bread6” provides the four pins PA0 to PA3 of the controller and the supply voltage pins GND and VCC for external use (e.g. on a breadboard).

The ISP6 pin plug serves as a standard programming interface to program the ATtiny in-circuit. When ISP programming the LCD can stay plugged in.

The LCD is attached via a 16 pin standard plug. If the LCD has no background light, pin 15 and 16 are unused and the 220 Ω resistor is not needed. If the backlight needs higher current, the resistor can be calculated with the formula
R (Ohm) = 1.000 * (UOp - ULED) / I (mA)

and can be smaller.

1.2 Parts list

tn24_lcd parts list The electronic parts are listed to the left. The LCD is not included because the type and size depends from your needs. For simple applications a single-line LCD is sufficient, for more info to be displayed a white-on-blue four line LCD can be used. For changing the LCD size only the two constants cLcdLines and cLcdColumns have to be changed in the LCD include routine, the output positions have to be adjusted, and the source code has to be re-assembled. The given price information in the list is of February 2018 and subject to changes.

1.3 Example applications

Several different applications are described in the chapters 11 to 14 of the microbeginner course. There the following applications are described in detail:
  1. here is an 8- and a 16-bit binary counter described that advances each time the controller is switched on, reads from/writes to EEPROM and displays the number in decimal format on LCD,
  2. here an infrared remote control receiver is described that analyses control signals with diverse tools, an Attiny13 remote control transmitter and an Attiny24 IR data receiver with LCD,
  3. here a frequency counter for digital and small-amplitude analog signals and for measuring inductivities is decribed,
  4. here a voltage meter for voltages of up to 20 V, for currents up to several amperes DC and for temperatures inside the controller is described.
The applications run without any changes on this experimental board and work with a 4x20 LCD. Source code for those applications and the needed include file are provided for download.

Top of page 1 Hardware 2 Mounting 3 Software

2 Mounting

2.1 PCB

tn24_lcd PCB tn24_lcd component placement The components can be mounted on a 40*50 mm single-sided PCB (Soldering side as gif, Component placement as gif). Three connections have to be made with silver wire.

2.2 Mechanical mounting

tn24_lcd LCD plug from below tn24_lcd LCD plug from above The LCD connections are equipped with a 16 pin plug as shown here. If the LCD is plated-through, the contacts are soldered from above. If not: shift the 16 pin plug through the holes with the long side of the plug, but only as deep as necessary. Then solder the pins and after that shift the plastic holder upward. If you want to take the risk of twisted pins you can even remove that plastic holder entirely after soldering.

The pins fit perfectly into the socket of the PCB. With the advantage that you can exchange the LCD by another type at any time.

Top of page 1 Hardware 2 Mounting 3 Software

3 Software

Here an universally configurable software for initiating and accessing the LCD is provided. This includes all relevant routines for displaying text and characters on the LCD as well as for generating self-designed characters on the LCD. Two examples demonstrate the configuration of the software for own needs and adaption to the specific conditions.

All source codes intensively use the "e;.if"e;-, "e;.ifdef"e;-, "e;.else"e;- and "e;.endif"e;-direktives in assembler. So never try to assemble the source codes with an assembler that does not know those directives. For all those who still work with ancient AVR assemblers: gavrasm knows and handles that correct.

3.1 Include routines

All necessary subroutines for accessing the LCD in the experimental board are part of the include file (see the include source code or the html-formatted include listing). By calling the following subroutines the following tasks can be performed: Prior to using the routines the following has to be assured:

3.2 Number conversion and display routines

tn24_lcd Optional number display on the LCD Optionally routines for displaying binary numbers on the LCD can be switched on. The binaries can be displayed in binary format (8 or 16 bits), as hexadecimal (eight or sixteen bits) or as decimal (eight or sixteen bits). If you want to use those routines in your source code, you can switch them on by setting switches (sLcdDecN, sLcdHexN, sLcdBinN with N=8 or N=16).

By calling the subroutines LcdDecN, LcdHexN or LcdBinN those binary values in register rmp (8 bit) resp. ZH:ZL (16 bit) are displayed at the currect position on the LCD (decimal format suppresses leading zeros). All number conversion routines are programmed with the directive ".ifdef" so that those only produce executable code, if the respective switch sLcdDecN, sLcdHexN and sLcdBinN (with N=8 or 16) is defined. Please be aware that some of the switches are set automatically inside the include routine (e.g. setting sLcdHex16 also sets sLcdHex8). Conflicts can be avoided by using the directive “.set” instead of “.equ” for those switches.

Closer details on the registers that are used inside the subroutines are given in the include file. The term “Used” means that the register is used, but its content is saved on the stack and restored when leaving the subroutine.

3.3 Example application of the code without Interrupts

The source file tn24_lcd_lin.asm (HTML formatted here) demonstrates the application of the include routines and the optional conversion and display of binary numbers.

The file can be used as template. The therein included file "" has the constants adjusted to cLcdLines=4 and cLcdColumns=20. The clock has been set to clock=1000000 at 1 MHz. The code also uses and demonstrates the generation and use of special characters.

Special character display on the LCD The software template also demonstrates the display of special characters on the LCD. Those were designed With the Open-Office-Tool resp. with the M$-Office-Tool. The table, that was generated with those tools, was copied to the source code, undefined characters were removed and the table was transferred to the LCD with the routine LcdChars.

3.4 Example application with interrupts

For interrupt-driven programs the template in tn24_lcd_int.asm (HTML formatted here) can be used, Tzhis includes the interrupt vectors of the ATtiny24. For the example program a single-line LCD with eight characters was chosen. The clock frequency of the ATtiny24 was elevated to 8 MHz by clearing the CLKDIV8 fuse. The pictures demonstrate initiation and display of hexadecimal and decimal numbers.

1x8 LCD init 1x8 LCD number display

3.5 Required flash storage

The following table lists the storage requirements of the example programs with the include routines and with the diverse options cleared or set. Percentages are for the ATtiny24 with a flash memory size of 1,024 words.

Options selected Without interrupts With interrupts
Decimal+Hex+Bin+Special characters49047.950849.6

In all cases the remaining space allows for own needs.

To the top of that page 1 Hardware 2 Mounting 3 Software

Praise, error reports, scolding and spam please via the comment page to me. Spammers: please note that behind this is not a dump standard script but I personnally select the entries to be published.

©2018 by