led matrix problem
Dr. Vetter
Posts: 34
HI,
I·am making a little hand held game using a 5x5 led matrix.
·instead of programing each pin when to turn on i want to assign two pins to a label EX:
F1· F2· F3· F4· F5
F6· F7· F8· F9· F10
if i want F5 to turn on i just have to write
HIGH F5
i figured out how to do it with one pin but what about muiltiple pins
i have tryed
F5 pin 0 , 9
F5 pin 0 and 9
F5 pin 0 ; 9
what would the code be i cant seem to find it in my book
any help would be much apreciated
I·am making a little hand held game using a 5x5 led matrix.
·instead of programing each pin when to turn on i want to assign two pins to a label EX:
F1· F2· F3· F4· F5
F6· F7· F8· F9· F10
if i want F5 to turn on i just have to write
HIGH F5
i figured out how to do it with one pin but what about muiltiple pins
i have tryed
F5 pin 0 , 9
F5 pin 0 and 9
F5 pin 0 ; 9
what would the code be i cant seem to find it in my book
any help would be much apreciated
Comments
Notice that you do a "bit and" with zero bits where you want to turn off the LED and "bit or" with one bits where you want to turn on the LED.
Post Edited (Mike Green) : 7/2/2008 10:32:29 PM GMT
this sounds like its going to be a long night if this is the case.
see in my matrix i have power going to the collector of my transister1 base to stamp and emiter to the diodes which there is 5 in parellel to a 220 ohm resister then going to a collector of another transister2 base to stamp and emiter to ground
i have it set up this way so i can control 25 leds with only 10 pins with each transister controlling a row or colum so two pins have to be high in order for a specific led to light
not sure if that changes what you have just told me but is there not a way i can map out the spicific leds
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
well anyways heres my schematic of the martix i have labeled where the stamp pins go also·probly not important but its·not on the schematic but there is two active high switches button a and button b going to P10 and P11.
You can use multiple statements on a line like: "HIGH F1 : LOW F7"
There's a whole variety of ways to do this. What's "best" or works better will depend on what task you're trying to perform. You need to describe that.
for instance when you loose the game it displays an L for loose but in the begining it would only display a block so I seperated the L in to two parts the right bar and the bottom seperated by a pause 1 and now it seem work wonderfully
but basicly the game is just like an old atari game involving a racecar driving down the track passing cars but in my game your car is an led and its just an led that is coming at you and you can move with the A and B buttons only into three different spaces (right, left, and middle) if you get hit or crash then its game over. I have prepared three maps (easy,medium,hard) the map will scroll in a downward fashion at a certain rate for each level. The two right and left leds will be running on a 2on1off pattern starting on the 4th row. I am using a Bs2 and programing in 2.5 this is my first project after going through some basics on a kit i bought. hope i covered everything.
This should scan the rows turning on one PNP row driver at a time and turning on a pattern of NPN drivers based on the values in "leds".
After going through the "scan:" routine once, you can update the bits in "leds" for the next cycle of what to show.
This may be too slow with just a BS2. There are ways to speed this up using an external LED driver or you can use a faster processor.
what·I see here is
scan: for i = 0 to 4
(scan 5 times)
outs = (%1111100000 - (%100000 << i)) | leds(i)
(turn on only the vertical transisters) (and then i get lost)
and by external do you mean like a ULN2003?
By "external driver", I was thinking about a graphics LED driver from Maxim that can handle an 8x8 LED matrix and does all the multiplexing and LED driving with the transistors included on the chip, but, after looking at the datasheet, I decided that it was "overkill".
but are you saying it works kinda like when you add in binary
00001 +00100 = 00101
also what are you talking about when 1 = off and 0 = on because
when I send a binary 1 it turns on my led
To turn on a PNP transistor connected as you've shown, you have to connect the base to ground (logic zero). If you connect the base to logic one, the transistor will turn off. The NPN transistors work in an opposite manner. Send them a binary 1 and they will turn on.
now I get it, my fault.
ok so I read the description so this is no different than digital electronics
I did not know that
is it the same for
and, nand, nor, xor, xnor, not