« November 2005 | Main | April 2006 »
December 14, 2005
Final Project
Brief
I wanted create a 3D visualisation of a fly in the box trying to escape. I used LED's as a visualisation tool by trying to create a 3D matrix out of them to create a box and the fly itself which would be a discrite LED moving around randomly.
Electrical Characteristics
I was initially planning on hooking up a total of 512 LED's ie 8 planes of 8x8. I decided to use the MAX 7219 as my LED display driver because as it could control 64 leds discritely. I used a matrix of 5x5x5 and used the Maxims to interface them with the 18F452 microcontroller.
Controlling a grid of LED's with a Maxim was tricky in the first instance. There are a few things which are needed to be kept in mind. The first being the initialization of the chip. A bunch of registers need to be preset in the chip before the real program which controls the LED's is read. This includes:
Scan limit register which sets how many digits are displayed from 1 to 8. In my case I needed to display digits 0 to 4.
Intensity register which allows the brightness to be controlled by an external resistor.
Shutdown mode which needs to be overwritten to normal mode
Display mode which needs to be overwritten to normal mode.
The Maxim has three main pins:
Data pin or DIN - For serial data input. This loads the data into the 16 bit shift registers on the rising edge of the clock.
Load Pin or CS - For load data input. This latches the last 16 bits of serial data to the shift register. In my case the data was loaded into the shift register when the chip select was low.
Clock pin or CLK - On the clocks rising edge the data is shifted into the internal shift register. On the CLK's falling edge, the data is clocked out to the DOUT.
Trials
Another ITP'er who had worked with the Maxims was Inshan and I worked with his code for a while. The code was short and was meant to accomadate code for more than one maxim. Here is his code. He uses the look up command to set the scan limit, intensity and shutdown mode in one line.
The code which I used to elaborate upon was Ahmi's code, another ITP'er who worked with these chips which was easier to work with. Here is his code.
The main problems which I remember was being confused by which clock to use with the Maxim. After using the 20 Mhz oscillator, I switched to the 4mhz clock. I was sharing the 20 Mhz between the Maxim and the 18F which wasnt giving me the results I needed. Defining a clock pin on the microcontroller for the Maxim and using a 4 Mhz clock with the 18F worked.
Another problem was I hooked up all the outputs which I wasnt using on the Maxim chip to the ground which is a definite no no.
Display mode is a good mode to see whether all the LED's light up. One needs to over write it with normal mode to get to programming the LED's discritely.
To work with more than one Maxim ie more than one plane of LED's, one needs to cascade the maxim. To send the data onto the second Maxim when we have two hooked together. One needs to send out the desired bit and then send a no-op code (xxxx0000). So when the load pin goes low the second chip gets the desired bit and the first one gets the no-op code. I have been having trouble having all my chips to cascade properly. It seems to work definitely with the first two but the third one is problematic. I will be continuing on this next semester in Tom's phyical computing studio. Hopefully will figure out the problem then.
Another thing which I needs to be kept in mind religiously is the the digits are negative and the segments are positive as shown in the schematic.
As seen on Pg 6 of the datasheet, the serial data needs to be 16 bits in all cases. where the first 4 bits are dummy bits, the second 4 are address bits where the registers get defined and the next 8 help us work with the segments where each place belongs to a specific alphabet (I needed to manipulate DP, A, B, C, D). Using the register address map on page 7, one can manipulate the digits (0 to 4 in my case)
Posted by Shagun at 05:57 PM