Path: AVR-EN => Applications => Ticker m16   Diese Seite in Deutsch: Flag DE Logo
ATmega16 Application of
AVR-Single-Chip-Controller AT90S, ATtiny, ATmega and ATxmega
Ticker with ATmega16A and LEDs

Ticker with an ATmega16

Click here to download a zipped version of this page (1.43 MB)
An application of an ATmega16 controller with 192 LEDs, preferably as a gift and as a display window.

Ticker front

With the 24-by-8 LED matrix every desired pattern might be displayed. With the provided tools those patterns can be designed, converted into an assembler table, assembled and burned into the program flash of the controller.
  1. Properties
  2. Hardware
  3. Mounting
  4. Software

1. Properties

To control each of the 192 LEDs, those are arranged in a multiplex-mode to eight anode drivers (power transistors) and the cathodes of the LEDs are driven by three ports with eight portpins each.

LED matrix Because multiplexing eight anode rows means that each LED row is only on for one eights of the time, LEDs with a high luminous efficiency are used. This results in a high intensity as well as a low current consumption (below 10 kWh per year).

Ticker example By multiplexing each cathode portpin has to drive the current for one single LED maximally, that is 20 mA. At this current, each anode driver row can light up to 10 LEDs, because the overall GND current of a ATmega16 in a DIP package is limited to 200 mA. Because with the actual design the current of the LEDs is limited to 15 mA, 13 LEDs in one anode driver row can be simultaneously on. Practice test have shown that even 15 LEDs can be driven over a long period simultaneously without damage to the controller. This case appears rarely in practice, the maximum in the test case is 12, the average is only 6.



Top of page Properties Hardware Mounting Software


2. Hardware

2.1 Selection of the LED current

LED current calculation The picture shows the voltages in the matrix. From the bottom to the top: With an R of 120 Ω a LED current of roughly 15 mA results. If the LED current shall be increased, a resistor of at least 82 Ω can be used (ILED = 21,8 mA).

2.2 Controller part

The controller ATmega16 Schematic ticker

2.3 Power supply

2.3.1 Design of the power supply

The power supply shall deliver the current of 14 LEDs that are simultaneously switched on. At nominally 15 mA per LED that means 14*15 = 210 mA, with 20 mA the current is 280 mA. A transformer with 4.8 VA has enough capacity to drive that.

Power supply voltages With a 2*7.5 V transformer, a capacitor of 2.200 µF and a load of 480 mA the load curves are at 7.8 V minimum, which provides enough input voltage for the regulator 7805.

This software for calculating the power supply can be found at this page. (Page only in German, software in english).

Power supply A new version of the software is online available at this site, page and Lazarus software (sources and compiled versions for Win64 and Lin64 available).

The maximum thermal load of the voltage regulator is roughly (8.5 - 5) * 0.48 = 1.7 W. A small heat sink with 24 K/W is therefore sufficient.

2.3.2 Schematic power supply

The power supply is straight forward.

Scheme power supply


Top of page Properties Hardware Mounting Software


3. Mounting

3.1 Controller part

For the controller part a PCB was designed.

Layout controller Component placement on PCB The complete controller part is on a 100*80 mm PCB. The ISP6 plug for programming has to be wired with solderable enameled copper wire.

Controller board That is how the finally mounted controller board looks like.

3.2 Power supply

Power supply The power supply has been mounted on a 70*50 mm breadboard.

The height of the power supply unit (transformer, capacitor, heat sink) also determines the size of the box.

3.3 Box

Ticker box The whole fits into a plastic box L=160/W=100/H=60, for which a Type plate (in Open-Office-Draw format) has been designed and rubber pads were fitted to it, to be delivered to the presentee.

3.4 Mounting of the LED matrix

Mounting the LED matrix The 192 LEDs are fitted into 5 mm drill holes in an acrylic glass (3 mm) sheet. The drill scheme is available here in Open-Office-Draw format.

First, all 24 cathode rows are interconnected by bending, shortening and soldering. Then the anode rows are interconnected by bending 5 mm higher, shortening and soldering.

The connection with the single wires of a parallel cable is simpler if coloured cable (at a slightly higher price) is used. The pin placement in the 34-pin plug with anode and cathode drivers is shown in the schematic.


Top of page Properties Hardware Mounting Software


4. Software

4.1 Software download

The software is in HTML-Format here und as Assembler source code here available. To assemble this the file tickertable.inc is additionally needed (here available with test data).

4.2 Functioning of the software

The timer TC0 is used for the whole run. He ticks with 1 MHz default frequency and a prescaler of 8 with 125 kHz. He overflows with 488 Hz and triggers the overflow interrupt every 2 ms. If all eight anode rows have been displayed (16 ms), the number of MUX runs is decreased. After 32 MUX runs, every 512 ms, the next stage is displayed.

The whole intelligence is in the TC0 Overflow Interrupt Service routine.
  1. The anode drivers are switched off.
  2. The next three cathode combinations are read from the table in the flash and are written to the ports B, C and D.
  3. The anode driver register is written to anode port A.
  4. The anode driver register is shifted one position to the left. If a one is shifted to carry, the register restarts with one. In this case the number of MUX runs is decreased. If that does not result in a zero, the address pointer Z is reloaded from register pair X and so starts the next MUX run again. If the result is zero, the next address is copied to register pair X.
  5. If all LED outputs were high during all eight MUX lines, the table pointer is set to table start and the whole table restarts.

4.3 Designing text tables

To ease the creation of tables an Open-Office-Spreadsheet has been designed. In this sheet it is filled with test data.

In the spreadsheet Tickertext within the green colored fields of column Y either 1 or a blank is inserted (either manually or by selecting from the drop-down-field). These entries are copied to the previous columns below. Ones are marked red (LED on). In the columns Z, AA and AB the decimal numbers for the three ports can be seen (inverted, LED on = 0).

When designing make sure that the end of the table is reached if all ports are at 255 (this causes the restart of the table). If the display shall continue, place a single ON-LED on the matrix.

Free designed combinations are yielded if the formulas in the columns B to Y are deleted and for all LEDs, that shall be ON a one is inserted.

If design is finished the sheet Table_generator holds the complete data in a table in column L. Select all filled lines in that column, copy them with Ctrl-C, open an empty Notepad window, paste the data into that and save the file as tickertable.inc in the same directory where ticker_m16_v1.asm is located. Assemble the source and the new table gets effective.

The sheet MaxLength calculates how many combinations fit into the flash storage of the ATmega16 (671 single pictures).

The sheet Analysis provides a display of the frequency distribution, how many LEDs have to be driven by an anode driver, and how much the electricity costs if you leave the machine on for one year.

4.4 Fuse programming

Fuses original Fuses to be programmed In order that all cathode columns work fine, one must de-program the JTAGEN fuse, which is set by default. Otherwise one column remains off.


Top of page Properties Hardware Mounting Software




Praise, dispraise, error reports, criticaster, scolding and unqualified spam please via the comments page to me.

©2017 by http://www.avr-asm-tutorial.net