LED MATRIX 5 cols and 7 rows problem

I just started a project to make a sign with 6 LED matrix panels. This is my first attempt in this area and need help (so far I have worked with data loggers on-board RC aeroplanes). I am using the circuit shown below the code and the arrangement of the LED's is as follows:
Each row is the cathode for 5 LED's and each column is the anode for 7 LED's. I connected the rows to the output pins 0 to 7 and the columns to portc pins 0 to 4 (see circuit below). When I turn onthe power the top row lights up and stays that way, nothing else hapens.
The test code is as follows:
Code:
Symbol Kick = output7
Symbol Wake = input6
Symbol Dly = b0
Symbol N = b1
Symbol Turns = b3
Turns =100
Dly = 10
let dirsc = %00011111
		LetterA:
Wake = 0
For N=0 to Turns		
portc = 1
let pins = %01100000
pause Dly
portc = 2
let pins = %01010111
pause b0
portc = 4
let pins = %00110111
pause b0
portc = 8
let pins = %01010111
Pause b0
portc = 16
let pins = %01100000
pause b0
Let pins = %11111111
If N<Turns then goto Cont
High Kick
N = 0
	Cont:
If Wake = 1 then goto LetterI
Next N
 

Attachments

You should try taking a look at the MAX7219 chip, either in this forum or google. I have only just found it myself, and plan to use it for a project I am currently working on. I can not advise you much myself, but plenty of people can. It will allow for up to 64 LEDs, and only uses three output pins.
I believe you can order a free sample from the website, although I have yet to try this. If anyone knows about the free samples (and weather they are available in the UK), please get in touch with me.

PS, I thought I may aswell mention it here, has anyone tried the MAX6950 or MAX6951 with picaxe. I remember finding it somewhere on the forum, but searches bring up no results. I recall that it can only be used with the 28X or higher because it needs a 16MHz rezonator instead of the internal 4MHz on smaller chips. Is it used with I2C, or the same way as the MAX7219? Also, are there any advantages for using it
 
Last edited:

jodicalhon

New Member
Sorry Marmitas, I was possibly a bit too brief. I was concerned that the 'goto LetterI' might be a problem because the only subroutine tag you have shown is 'LetterA'. This is not to suggest that you might be deficient in proof-reading skills! I have sometimes been struggling to understand why some code is not working only to find, after a break for a cup of tea (and some chocolate), that I have sent it somewhere incorrect, or forgotten a RETURN, or some such silly mistake.

Carry on. :)
 

hippy

Ex-Staff (retired)
I couldn't see any error in the circuit or code but haven't really studied it.

I'd suggest the step-back approach. Write a simple test program which outputs on each I/O line at a time and use a LED or meter to check each I/O line works. Do it at slow speed so you can see what's happening.

You can then connect all the cathodes to 0V via R and move along the anodes to check each 'pixel' lights, then connect the anodes to +V via R and move along the cathodes.

Then do both together, so you can move the pixel across each column on each row in turn.

Once you've got all that working you can add a routine which will multiplex out a displayed letter. Then you can add another level of control to choose what bitmap to display, and finally the code which selects when to display a particular bitmap.

Do it incrementally, step by step, and you'll have a much greater understanding and it's far easier to determine where a single problem lies. Trying to find a single bug in a complex program is always hard if its individual parts have not ben tested. Unless there's an obvious to spot error, you'll end up cutting bits out to get something to work and then you'll have to add those bits back in. Might as well start from the basics and build up slowly as you're going to have to do that anyway if you need to debug.
 

Tom2000

Senior Member
For starters, you're going to have to rethink your hardware design for a 6 digit 5x7 matrix.

That's 35 diodes per digit, with 7 anode lines and 5 cathode lines for each. That requires 7 active-high outputs for the rows, and 30 active-low outputs for the columns.

You can common up all the rows to use 7 28X1 outputs, as you do now, but will need some sort of I/O expander arrangement to derive the 30 column outputs.

When designing your hardware, keep the 20 mA pin source/sink current limit and total chip current limit in mind.

Do you plan to display a fixed message, or will you have to change it? If it's a fixed message, you can probably hardcode the whole thing. If you need to display variable text, you need to think about the character set, fonts, and such.

If you limit the characters that you'll be displaying to only the 26 capital letters, 10 digits, and a space character, you can store the font in 185 bytes of the 28X1 EEPROM, as one byte per 7 dot vertical. You could then retrieve each byte and feed it directly to the row outputs by means of simple lookup tables. It should be fast and compact code.

This might wind up as a pretty cool app.

Have fun with it!

Tom


Edited to add:

I just reread your original message and see I had my cathodes an anodes backwards.

You'll output a low to your rows, and a high to your columns. So your I/O expander will be something that shifts a single high through the 30 column lines, driven by a single pulse output line from your 28X1.

Edited again:

I had a 30-stage ring counter in mind when I wrote the above. But with through hole parts, the chip count would be high.

I looked around some, and found that you could do your I/O expansion with a pair of 74xx4514 decoders. You'd need a few more lines from your 28X1, but you're not short of I/0, and the programming should be straightforward.
 
Last edited:

skyhawk

New Member
I believe the hardware for the column drivers is incorrect. The ULN2003A is a NPN Darlington array. The output is from the collector of the output transitors, and hence can sink but not source current. The drive will work with columns that are common cathode but not common anode.
 
Hippy,
I followed your advice and the columns light up when I connect all the anodes to +V and the cathodes to the Picaxe (see schematic) but it does not work when I connect the cathodes to 0V and the anodes to the Picaxe. I simplified the code to do this test and I am no sure if the problem is the code or the connections. A volt meter between the pins on port c and ground shows +.014V
the new code is:
Code:
'Processor: 28X
Main:
let dirsc = %00011111	'switch pins 0,1,2,3,4 to be OUTPUTS
high portc 0			'Make Pin 0 on port C high (should get about +4 Volts on the pin)
let pins =%00000000		'Make all output pins low (should get 0 Volts on all the output pins)
pause 1000
high portc 1			'Make Pin 1 on port C high (should get about +4 Volts on the pin)
pause 1000
high portc 2			'Make Pin 2 on port C high (should get about +4 Volts on the pin)
pause 1000
high portc 3			'Make Pin 3 on port C high (should get about +4 Volts on the pin)
pause 1000
high portc 4			'Make Pin 4 on port C high (should get about +4 Volts on the pin)
pause 3000
low portc 0,1,2,3,4		'Make all the output pins on port c low and turn off all the led's
goto Main
 

Attachments

hippy

Ex-Staff (retired)
Your hardware has cathodes ( pointy ends ) to Out0-Out6, anodes to In0-In4 ( Port C ). Thus with anodes low and Port C high something should light.

- DirsC = %00011111
- High PortC 0

Should set the 'In0' line to output and set it high, giving +V as you expect. Not sure why it isn't. It may be worth testing with nothing connected to the PICAXE.

The firmware not working or a compiler bug is a possibility but I'd have thought unlikely or we'd have heard more complaints. It is possible that Port C has been damaged during experimentation, I/O lines or the entire port 'burnt-out' through an over-current event. PICAXE's are fairly resilient but not indestructable.
 
Top