Just received my new 32x32 RGB matrix!
Posted: Thu Jun 06, 2013 10:07 pm
I posted a few days ago about great prices on LED matrix displays. Well mine just arrived today! 32x32 Pixels of RGB goodness in a mini 16cm x 16cm form factor!
Here it is running on one of my PICnDuino's I have some big plans for this little guy - a new game system no doubt.
For those interested, here's the swordfish code that you use to get something drawn on the display.
First of all, you set up 32 longwords (a longword can hold 32 bits). For red, green and blue:
Then give some Nicknames to the port pins to make them easier to use (These names line up with the names on the pins of the 32x32 matrix display)
And here's the code to actually draw stuff on the screen:
If you want to draw something on the screen, you just fill your outputdatared, outputdatagreen and outputdatablue arrays with a whole heap of 1's and 0's.
For example, if you wanted to draw what you see in the image above, you would have that data stored in an array like this:
Then to display it on the screen, you need to copy all of that data into your outputdatared, outputdatagreen and outputdatablue arrays:
Hope that helps for now. I'll be posting my adventures as they come about
Here it is running on one of my PICnDuino's I have some big plans for this little guy - a new game system no doubt.
For those interested, here's the swordfish code that you use to get something drawn on the display.
First of all, you set up 32 longwords (a longword can hold 32 bits). For red, green and blue:
Code: Select all
Dim OutputDataRed(32) As LongWord
Dim OutputDataGreen(32) As LongWord
Dim OutputDataBlue(32) As LongWord
Code: Select all
Dim RedData0 As PORTB.0
Dim RedData1 As PORTB.1
Dim GreenData0 As PORTB.2
Dim GreenData1 As PORTB.3
Dim BlueData0 As PORTB.4
Dim BlueData1 As PORTB.5
Dim Latch As PORTB.6
Dim OutputEnable As PORTB.7
Dim RowA As PORTC.0
Dim RowB As PORTC.1
Dim RowC As PORTC.2
Dim RowD As PORTC.3
Dim CLK As PORTC.4
Code: Select all
Sub DrawGraphics()
For Y = 0 To 15
TempData0 = OutputDataRed(Y)
TempData1 = OutputDataRed(Y + 16)
TempData2 = OutputDataBlue(Y)
TempData3 = OutputDataBlue(Y + 16)
TempData4 = OutputDataGreen(Y)
TempData5 = OutputDataGreen(Y + 16)
For X = 0 To 31
RedData0 = TempData0.bits(31 - X)
RedData1 = TempData1.bits(31 - X)
GreenData0 = TempData2.bits(31 - X)
GreenData1 = TempData3.bits(31 - X)
BlueData0 = TempData4.bits(31 - X)
BlueData1 = TempData5.bits(31 - X)
CLK = 1
CLK = 0
Next
RowA = Y.bits(0)
RowB = Y.bits(1)
RowC = Y.bits(2)
RowD = Y.bits(3)
Latch = 1
Latch = 0
OutputEnable = 0
DelayUS(200)
OutputEnable = 1
Next
End Sub
For example, if you wanted to draw what you see in the image above, you would have that data stored in an array like this:
Code: Select all
const MyDataRed(32) as longword = (%00000000000000000000000000000000, %01111100000000000000000000000000, %01000100000000000000000000000000, %00000100000000000000000000000000, %00000100000000000000000000000000, %00000100000000000000000000000000, %00011100000000000000000000000000, %00111100000000000000000000000000, %00000010000000000000000000000000, %00000010000000000000000000000000, %00000010000000000000000000000000, %00000010000000000000000000000000, %00100110000000000000000000000000, %00111100000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00011100000001110000000000000000, %00110011000110001000000000000000, %00000001000000001000000000000000, %00000011000000001000000000000000, %00000110000000001000000000000100, %00000111110000001000100000000100, %00000000011000001000100000000100, %00000000001000010000100000001100, %00000000001000110000011100111000, %00000000110000100000000011100000, %00011111100001100000000000000000, %00000000000001111111000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000)
const MyDataGreen(32) as longword = (%00000000000000000000000000000000, %00000000011110000000000000000000, %00000000110011000000000000000000, %00000000100001000000000000000000, %00000000000000100000000000000000, %00000000000000100000000000000000, %00000000000001100000000000000000, %00000000000001000000000000000000, %00000000000011000000000000000000, %00000000000010000000000000000000, %00000000000110000000000000000000, %00000000001100000000000000000000, %00000000011000000000000000000000, %00000000011111111100000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000001110000000000000000, %00000000000110001000001001000000, %00000000000000001000001001000000, %00000000000000001000001001000000, %00000000000000001000000000000000, %00000000000000001000000000000000, %00000000000000001000000000000000, %00000000000000010000000000000000, %00000000000000110000000000000000, %00000000000000100000000000000000, %00000000000001100000000000000000, %00000000000001111111000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000)
const MyDataBlue(32) as longword = (%00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000110000100000, %00000000000000000000001001000000, %00000000000000000000000111000000, %00000000000000000000000011000000, %00000000000000000000000100110000, %00000000000000000000001100011000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00011100000000000000000000000000, %00110011000000000000001001000000, %00000001000000000000001001000000, %00000011000000000000001001000000, %00000110000000000000000000000000, %00000111110000000000000000000000, %00000000011000000000000000000000, %00000000001000000000000000000000, %00000000001000000000000000000000, %00000000110000000000000000000000, %00011111100000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000)
Code: Select all
sub CopyImageDataIntoOutputArrays()
for x = 0 to 31
outputdatared(x) = mydatared(x)
outputdatagreen(x) = mydatagreen(x)
outputdatablue(x) = mydatablue(x)
next
end sub
Hope that helps for now. I'll be posting my adventures as they come about
