« Expanding the PICA little PWM »

The Matrix.

09/08/08 | by anthony [mail] | Categories: Code, Projects

Matrices are somewhat interesting. They present a way to organize large and similar data sets. And because of the similarities you can do some interesting things with the numbers. In an electronic sense matrices are grids of components that can simplify i/o over a large amount of components of a similar function. The two most widely known are keypads and displays. Keypad uses a matrix of switches while a display uses a matrix of LEDs or liquid crystals. I'll be demonstrating the schematics and code to operate a simple static 8X4 LED matrix.

The Circuit

This project relies heavily on a correct circuit layout. Matrices are special because of how they're hooked up. Essentially, you provide power to one column and ground one row where they intersect, that LED lights.

The program used for drawing the schematics and making the board is called EAGLE. It is free to download and evaluate at their site

The basic schematic is as follows:

PORTC controls power and PORTB controls ground. Where PORTC = 1 and PORTB = 0 we get an illuminated LED

The CODE

The objective: To implement a 8X4 LED matrix in a way that is useful for displaying useful information.

The procedure:

1 - Set up the variables
2 - Set up the port
3 - call a table to display the pattern for the first column
4 - Rotate to the next column
5 - Increment count bit to keep track of bit location
6 - check if overflowed
a - if overflowed, clear count
7 - goto beginning

Essentially, Portc cycles so rapidly it seams that all the columns are on at one even though only one is on at a time.

The the "0"s in the look up table also essentially represent which LEDs are going to be lit.

What can be improved: The code can be improved by removing the COUNT variable and just observing and rotating PORTC, the current configuration however is more flexibly and allows expandability.

This version is also STATIC, there is no user implementation if the user wants a different design he has to go into the code and modify the look up table. Future versions will be dynamic.

As always, this is just a short description of the code and its functions. Full code is available below and discussion is welcome!

The Board

The board layout was designed is EAGLE as well and is meant to be as compact as possible. No voltage regulation features or external oscillators have been implemented yet. For troubleshooting purposes, this is fine.

http://mcuplace.com/mcu/media/blogs/blog/LED.asm (ASSEMBLY FILE)
http://mcuplace.com/mcu/media/blogs/blog/LED.HEX (HEX)

Permalink

Trackback address for this post

This is a captcha-picture. It is used to prevent mass-access by robots.

Please enter the characters from the image above. (case insensitive)

Array

No feedback yet

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
PoorExcellent
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
This is a captcha-picture. It is used to prevent mass-access by robots.

Please enter the characters from the image above. (case insensitive)

Array
May 2012
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

Ads by Google

This blog is dedicated to working with digital circuitry and the use of microcontrollers, small compact computers on a chip. I will be encompassing many techniques to develop projects, tools to use to write and assemble code and i will be sharing any projects i am currently working on. User feedback is a must! I do not know it all, hell im not even that experienced, but without a general place to get all the info needed i find it very hard to get into the world of microcontrollers without pursing a CE degree. So come one come all and enter the world of mystery and creativity!

Search

XML Feeds

powered by b2evolution free blog software