k, getting back on subject here... is there another way to control each dot individually other than bit patterns?
thanks
k, getting back on subject here... is there another way to control each dot individually other than bit patterns?
thanks
is there another way to control each dot individually other than bit patterns?
No you have to do it through bit patterns. Why is that a problem?
There's a MAX7219 on the board, yes?
It has 8 registers you write to, 1 for each column of data, at addresses 0x01 thru 0x08.
You want a single LED on, you write to the register for that column with the data you want.
I use SPI to control MAX7219s vs the shiftout/bit bang discussed so far, hardware transfer vs a software transfer.
an example would be:
digitalWrite(SSpin, LOW); // SSpin is generally D10
SPI.transfer(register0); // declared earlier in code as 'byte register0 = 0x01;
SPI.transfer(data_to_write); // control in your code = 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 for the 8 LEDs one at a time
digitalWrite(SSpin, HIGH);
if you made an array of the register numbers and the data:
byte registerAddress[] = {1,2,3,4,5,6,7,8;}; // registerAddress[0] = 1, [1] = 2, etc. up to [7] = 8
byte data_to_write [8]; // data_to_write [0] = data for registerAddress[0], ... data_to_write [7] = data for registerAddress[7]
then you put the above in a loop and just call it when your code changed something:
if (dataChanged_flag ==1){ // flag is set when the code makes a change to data_to_write[0] thru data_to_write[7]
dataChanged_flag = 0; // clear the flag
for (x =0; x<8; x=x+1){
digitalWrite(SSpin, LOW); // SSpin is generally D10
SPI.transfer(registerAddress[x]); // send Register address 1 to 8
SPI.transfer(data_to_write[x]); // send data for associated register
digitalWrite(SSpin, HIGH);
}
If you have a problem seeing how numbers, bit patterns and the display all tie up together, read this:-
http://www.thebox.myzen.co.uk/Workshop/LED_Matrix.html
I have the same unit you got and also wired up a marix from individual LEDs (which made me appreciate the made up matrix even more!). Not sure if it will help you or not, but ...
When I was trying to understand what/how the MAX72XX chips do their stuff I wrote a library and a bunch of test code that did 'funky' (ie, useless but interesting at the time) things on the matrix, including addressing individual points on it..
If you are interested in the code for my library and the test/example can be found at the location in my signature block.
Grumpy_Mike:
is there another way to control each dot individually other than bit patterns?
No you have to do it through bit patterns. Why is that a problem?
yes, i don't get it..
like:
unsigned char disp1[38][8]={
{0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//0
0x3C what does the "C" stand for?
why are there multiples of 0x42?
64 dots.. only putting in 8 bits of info?
i'll look at the link you provided shortly.. and ty crossroads - i'll get to that shortly too..
0x3C what does the "C" stand for?
That's hexadecimal notation (q.v.)
Each one of those is eight bits and there are eight of them in your array. That gives you individual control of sixty four bits. There are multiple 0x42s because the pattern being drawn has rows that are the same.
Try making the first byte 0x01 (or indeed 1) and all the others 0. Hopefully a single LED will be lit. replace the 1 with 2, then 4 then 8, then 7. See what is happening?
0x3C what does the "C" stand for?
C is the hexadecimal value of the decimal value 12.
In hex (base 16), digits go 0123456789ABCDEF (16 of them)
why are there multiples of 0x42?
Because the bit pattern 01000010 repeats vertically.
64 dots.. only putting in 8 bits of info?
Don't understand the question.
64 bits is eight bytes
Think of your matrix like this:
10101010
10101010
10101010
10101010
10101010
10101010
10101010
10101010
So you have 8 columns, and 8 rows.
In this example, Columns 0,2,4,6 are all 1's. Those represent "on" LEDs. The columns with 0's are 'off' LEDs.
Each column is controlled by 1 register, 1-2-3-4-5-6-7-8.
The top LED in each column is bit 7 of a register, the bottom LED is bit 0.
If you wanted the lower left LED to be on, you would send B00000001 to register 1. In HEX, that would be 0x01.
If you wanted every other LED on starting from the bottom, you would send B01010101, or HEX 0x55.
If you wanted 2 of the LEDs on, say at B01000010, you could send 0x42.
So for your example: 0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C, with each byte arranged vertically:
0x3C = 0011 1100
0x42 = 0100 0010
00000000
01111110
10000001
10000001
10000001
10000001
01111110
00000000
So that would make a 0, or a square, however you want to reference it.
Ruffsta:
been looking for tutorials on this - (i just finished soldering it altogether and i want to use it),but none really to be found..
0000 = 0
0001 = 1
0010 = 2
0011 = 3
0100 = 4
0101 = 5
0110 = 6
0111 = 7
1000 = 8
1001 = 9
1010 = A
1011 = B
1100 = C
1101 = D
1110 = E
1111 = F
k, starting to make sense now.. ty for all that.
i'll have to play around with it more tomorrow - it's time for bed... i work over nights so i have to be at work in 3.5 hrs..
but thank you all again
You can find the tutotial at: