These screens are very interesting in the way they work, and it took me a while to get buy my head around them, but once you have your code to draw graphics, it's really simple to use after that - you just fill your graphic data with a whole heap of 1's and 0's and the draw graphics routine will take care of the rest.
I have the code for swordfish, but not for Arduino (should be very simple to port over though.)
Here's my Port Pins Setup: This is to drive two screens I.E. 32x32 pixels)
Code: Select all
// Port Setup
Dim RedData0 As PORTB.7
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 RowA As PORTC.0
Dim RowB As PORTC.1
Dim RowC As PORTC.2
Dim Latch As PORTC.3
Dim CLK2 As PORTA.0
Dim CLK As PORTB.6
Dim OutputEnable As PORTB.0
Code: Select all
Sub DrawGraphics()
For y = 0 To 7
TempData0 = OutputDataRed(y)
TempData1 = OutputDataRed(y + 8)
TempData2 = OutputDataRed(y + 16)
TempData3 = OutputDataRed(y + 24)
TempData4 = OutputDataGreen(y)
TempData5 = OutputDataGreen(y + 8)
TempData6 = OutputDataGreen(y + 16)
TempData7 = OutputDataGreen(y + 24)
TempData8 = OutputDataBlue(y)
TempData9 = OutputDataBlue(y + 8)
TempData10 = OutputDataBlue(y + 16)
TempData11 = OutputDataBlue(y + 24)
For x = 0 To 31
RedData0 = TempData0.bits(x)
RedData1 = TempData1.bits(x)
GreenData0 = TempData4.bits(x)
GreenData1 = TempData5.bits(x)
BlueData0 = TempData8.bits(x)
BlueData1 = TempData9.bits(x)
CLK2 = 1
CLK2 = 0
RedData0 = TempData2.bits(x)
RedData1 = TempData3.bits(x)
GreenData0 = TempData6.bits(x)
GreenData1 = TempData7.bits(x)
BlueData0 = TempData10.bits(x)
BlueData1 = TempData11.bits(x)
CLK = 1
CLK = 0
Next
RowA = y.bits(0)
RowB = y.bits(1)
RowC = y.bits(2)
Latch = 1
Latch = 0
OutputEnable = 0
DelayUS(250)
OutputEnable = 1
Next
End Sub
So when we want to draw a full 32 x 32 pixel picture, we are drawing four rows at once, so we only need to enable then disable the outputs eight times and then once full frame will have been drawn. The data is loaded in serially so we need to shift all the bits in before we display the rows.
Have a look at the code and let me know what you think. It might be kinda hard to get your head around at this stage but we'll get there!