DOT MATRIX 5x7 DENGAN MIKROKONTROLER

SUMBER : INTERNET

By : Mr. Widodo

 

 

 

Pada contoh dibawah ini, selain mikro 2051 anda juga dapat menggunakan 89s51 atau lainnya, yang penting gunakan 2 port.

 

 

 

#include   /* Include 8031 SFR definition header file */

 

unsigned char pat[5] = {0x3f,0x02,0x04,0x02,0x3f} ;

void main () {

   unsigned char cnt, col ;

   P1 = 0 ;     /* Initialize all P1 outputs to be zero   */

   P3 = 0;

   while(1) {

      col = 1 ;

      for (cnt = 0 ; cnt < 5 ; cnt ++ ) {

         for (col = 1 ; col < 32 ; col <<= 1) {

            P3 = col ;

            P1 = pat[cnt] ;

            delay_ms(1) ; // delay of 1 ms

         }

      }

   }

}

 

 

 

Harga kit belum disolder Rp 450.00 (menggunakan 89S51), harga kit sudah jadi (89S51) RP 900.000, disertai contoh program (PESANN SEGERAAA)

 

The circuit, illustrated below, is so simple that it needs little explanation:

To drive the display, the PIC brings one of the row select lines (RB4 thru RB7) low, and places the data for that row on the column lines, RB0 thru RB3. This configuration is held for a short interval, then the next row is selected and the new data is placed on the column lines, and so on. A variety of patterns are programmed into the sample firmware, including a "comet" racing around the edge of the screen, a rotating propeller, twinkling stars, and a firework which spirals in to the center of the screen and explodes. What you display onscreen is limited only by your imagination... and the fact that with 16 LEDs, there are only 65,536 possible "pictures" :-)

When you power up the device, it will run a quick test to prove that all wiring is correct - first, all LEDs will come on for a moment, then a black spot will walk along the screen from left to right, going down a line each time it reaches the rightmost edge of the display, until the bottom right corner is reached. This process is then repeated with a lighted dot on a black background, and then after a short pause on a blank screen, the main animation loop will start.

Note: There are five unused I/O lines which could be used to expand the device to a 9x4, 8x5 or 7x6 pixel display with no extra external logic. The reason I left it at 4x4 was mainly because it's an easy number to work with, and makes it possible to store longer animations (since each frame requires less memory to store). Experiment, expand and comment! With two additional 8-bit latch ICs, you could make an 8x8 display, and with four of these latches you could build a 16x16 display which will allow you to create some quite complex animations; it's a LOT of wiring on those 256 LEDs, though! My mother wants a version that can display a rotating snowflake for Christmas, so possibly you will see a large-screen version documented here in the future. Email me if you would like to see some modifications made.

Your prototype could look something like the picture below. Note that I used square LEDs. It's of no importance to the circuit, but if you use fairly tall square LEDs, the difficult task of lining them all up is slightly easier - poke them all through the board, flip the whole thing upside down onto a flat surface, and solder down all the legs.

 

 

Matrix II display

it

Click to view the horrible backside.


Those surplus green 5x7 LED modules went sale again at the local electronics store, so I bought a few and decided to build a bigger and better display. The previous one was too small, dim and had a crappy interface. This new one would have a much more powerful microcontroller, an AT keyboard interface, a serial interface for connecting to a PC, a builtin font, and an EEPROM for storing text entered from the keyboard or PC. All these features and more are now packed in the new display, and it looks awesome. 840 LEDs! This is the biggest circuit board I have ever built. 24 LED modules, 58 MOSFETs, 16 ICs and other components are all soldered onto a big board that is made from 6 smaller boards. Connections are made with wire-wrap wire. The microcontroller software is written in C, and almost fills the entire 8KB flash of the microcontroller.

View closeups of the CPU & power supply, the other end, and the long line of MOSFETs.

Features:

  • Fully autonomoys
  • AT keyboard connector, hot-pluggable
  • RS-232 serial connector giving full control over display (fixed at 57600bps 8N1)
  • Graphics can be displayed over RS-232
  • Text can be loaded over RS-232
  • A powerful builtin text editor with a character map
  • commands can be included in the scrolling text, such as pause, blink, change speed
  • Builtin VGA-like font
  • Builtin test modes (jumpered)
  • Potentiometer for adjusting brightness
  • 24MHz 8052-compatible processor
  • ISP connector for programming
  • 24V power supply connector (1.5A max)
  • Supplemental PC software: text loader, XMMS plugin, controller library

 

a powe

 


ditor!

Here is the editor in action. The arrow indicates "end of line".


Implemented editor control keys are: alt+alt gr, caps lock, shift, F1-F12, insert/overtype, delete, home, end, backspace. The cursor blinks and changes shape with the insert key too!

Firmware

The software in the microcontroller is written in C with a few tiny asm snippets. The compiler used is SDCC. The software does the following:

  • Scans display by updating the shift registers
  • Handles serial port with a 128-byte receive FIFO
  • Provides AT keyboard connectivity & plug'n'play
  • Provides AT keyboard scancode->ASCII conversion
  • Provides a 3 KB font (ASCII chars 0-191)
  • Provides a full text editor with command keys
  • Provides a character menu for the editor (for special chars)
  • Handles text scrolling and effect processing
  • Handles saving, restoring text from internal EEPROM
  • Provides a serial (RS232) mode with framebuffer & EEPROM control
  • Provides 2 diagnostic modes (all leds on & scroll every character in font)


The software barely fits in the 8K flash memory. I originally intended to include more effects, such as vertical scrolling and fade in & fade out effects. I had to shave 1KB off the font (chars 192-255) to make even this fit in there! If I had written this in assembler, everything would have fit. SDCC generates quite fast code, but not small code.

Get the firmware sources in tar.gz format (TODO) or browse online with syntax highlighting: (TODO)

 

 

XMMS Plugin

Ever wanted cool visualization while playing music? This is the ultimate in visualization plugins! Compile and install this plugin to get three visualization modes: Spectrum analyzer, Oscilloscope and Stereo VU Meter. Refresh rate is about 47 FPS. It's very smooth.

Plugin screenshot

 

Get matrixplugin-1.0.tar.gz. (TODO: package it) Coooooool!!! Linux only.

 

Spectrum analyzer

Spectrum analyzer.

Oscilloscope
Oscilloscope. The long exposure time messed the picture up a bit.