Hi All,
While i'm a newbie to this forum, i've been into pics/picaxes for around 5+ years, although i've had a lot a looong gaps in between projects, so i'm FAR from being any kind of expert ;-)
I'm back into picaxes again, and great to see NEW versions with more options & higher speeds have been released.
At the moment, i'm playing with the 20X2, mainly because it didn't need an external xtal/resonator, and still achieves an internal clock rate of 64mhz.
My current project requires some specific timings, for instance a clock pulse that occurs at 100hz rate, while sending (shiftout'ing) a bunch of data along with some latch-enables etc etc.
I'm currently trying to drive a large (128x32) DMD-Dot Matrix Display as found in old 1990's pinball machines, and these displays have a particular timing cycle to keep refreshing the display.
Right now, i have some working code, that displays a dual-lined border around the outside of the entire display, but it's flickering at about a 5-10hz rate, and thats with SETFREQ set to "m64" too.
I have a bunch of gosubs that call up various patterns then return and pulse a few row/column latch signals etc etc, so i know i have a major issue with my timings & loops, i'm sure there's 100 better ways to achieve this, but for now i proved the point to myself that i'm AT LEAST sending the correct control codes AND data which displays on the DMD as expected, so i'm sort of 1/2 way there ;-)
The other thing, is this (border) test pattern is coded within the picaxe code to simply prove my tests.
The final project text (or graphics) library will need to be pulled in from an external (serial?) eeprom etc.
Here's some info on the DMD display itnerface and drive signals to help you understand what i need to do:
http://pinwiki.org/wiki/Dot_Matrix_Display
...and here's my code for now, this does WORK, but very flickery, clearly i'm not meeting the minimum speeds for the Row clock/dot clock etc.
For the sake of simplicity, and proving to myself my code (kind of) works, i haven't implemented any for..next loops or data arrays etc etc....something i need to get back into sooner or later ;-)
I also think i probably 'have to' use the allocated SPIout data/clock pins for better performance? (currently i assigned any pin on portB as data & clock for the shiftout command.
I know i've done a lot of things incorrectly, and happy to take it on the chin from the great guru's out there ;-)
I hope my comments are fairly obvious, please ask me to clarify "WHY" i did something this way or that way.....if anything is unclear.
Thanx in advance,
Marty.
While i'm a newbie to this forum, i've been into pics/picaxes for around 5+ years, although i've had a lot a looong gaps in between projects, so i'm FAR from being any kind of expert ;-)
I'm back into picaxes again, and great to see NEW versions with more options & higher speeds have been released.
At the moment, i'm playing with the 20X2, mainly because it didn't need an external xtal/resonator, and still achieves an internal clock rate of 64mhz.
My current project requires some specific timings, for instance a clock pulse that occurs at 100hz rate, while sending (shiftout'ing) a bunch of data along with some latch-enables etc etc.
I'm currently trying to drive a large (128x32) DMD-Dot Matrix Display as found in old 1990's pinball machines, and these displays have a particular timing cycle to keep refreshing the display.
Right now, i have some working code, that displays a dual-lined border around the outside of the entire display, but it's flickering at about a 5-10hz rate, and thats with SETFREQ set to "m64" too.
I have a bunch of gosubs that call up various patterns then return and pulse a few row/column latch signals etc etc, so i know i have a major issue with my timings & loops, i'm sure there's 100 better ways to achieve this, but for now i proved the point to myself that i'm AT LEAST sending the correct control codes AND data which displays on the DMD as expected, so i'm sort of 1/2 way there ;-)
The other thing, is this (border) test pattern is coded within the picaxe code to simply prove my tests.
The final project text (or graphics) library will need to be pulled in from an external (serial?) eeprom etc.
Here's some info on the DMD display itnerface and drive signals to help you understand what i need to do:
http://pinwiki.org/wiki/Dot_Matrix_Display
...and here's my code for now, this does WORK, but very flickery, clearly i'm not meeting the minimum speeds for the Row clock/dot clock etc.
For the sake of simplicity, and proving to myself my code (kind of) works, i haven't implemented any for..next loops or data arrays etc etc....something i need to get back into sooner or later ;-)
I also think i probably 'have to' use the allocated SPIout data/clock pins for better performance? (currently i assigned any pin on portB as data & clock for the shiftout command.
I know i've done a lot of things incorrectly, and happy to take it on the chin from the great guru's out there ;-)
I hope my comments are fairly obvious, please ask me to clarify "WHY" i did something this way or that way.....if anything is unclear.
Code:
'DMD Tester - Built on 20X2 Picaxe Board - upto 64MHz internal clock.
#picaxe 20x2
setfreq m64
symbol SERIALdata = B.7 'DMD "SERIAL Data" pin. (OUTput portB.7)
symbol DOTclock = B.6 'DMD "DOT Clock" pin. (OUTput portB.6)
symbol ROWdata = B.5 'DMD "ROW Data" pin. (OUTput portB.5)
symbol ROWclock = B.4 'DMD "ROW Clock" pin. (OUTput portB.4)
symbol COLUMlatch = B.3 'DMD "COLUMN Latch" pin. (OUTput portB.3)
symbol DISPenable = B.2 'DMD "DISPLAY Enable" pin. (OUTput portB.2)
symbol portall = outpinsB
dirsB = %11111111 'set PortB to all OUTPUTS
portall = $00 'setup PortB as above bits set/cleared....
GoTo start
'********************
'This displays a dual-lined border around the entire outside of the display.
'(The Dual-lines are seperated with a space between them, like the "=" symbol, creating a boxed-border).
'********************
'This writes an entire solid line of 128 bits (16 bytes sent to make 128bits)
'this is used for row 1
line1:
B0=$FF:B1=$FF:B2=$FF:B3=$FF:B4=$FF:B5=$FF:B6=$FF:B7=$FF:B8=$FF:B9=$FF:B10=$FF:B11=$FF:B12=$FF:B13=$FF:B14=$FF:B15=$FF
GoSub DMDrow1
Return
'This writes 1 dot at the left side, then 14 bytes of empty spaces, the 1 more dots for the right side column.
'this is used for row 2 and row 31
line2:
B0=$80:B1=$00:B2=$00:B3=$00:B4=$00:B5=$00:B6=$00:B7=$00:B8=$00:B9=$00:B10=$00:B11=$00:B12=$00:B13=$00:B14=$00:B15=$01
GoSub row232
Return
'This writes 1 dot at the left side, a space, then 14 bytes of solid line, then 1 space and a dot for the right side column.
'this is used for row 3 and row 30
line3:
B0=$BF:B1=$FF:B2=$FF:B3=$FF:B4=$FF:B5=$FF:B6=$FF:B7=$FF:B8=$FF:B9=$FF:B10=$FF:B11=$FF:B12=$FF:B13=$FF:B14=$FF:B15=$FD
GoSub row232
Return
'This writes 2 dots at the left side, then 14 bytes of empty spaces, then 2 more dots for the right side column.
'this is used for all rows 4 to 29, repeated over...
line4:
B0=$A0:B1=$00:B2=$00:B3=$00:B4=$00:B5=$00:B6=$00:B7=$00:B8=$00:B9=$00:B10=$00:B11=$00:B12=$00:B13=$00:B14=$00:B15=$05
GoSub row232
Return
'This writes an entire solid line of 128 bits (16 bytes sent to make 128bits)
'this is used for row 32, but has a slightly less pulses required being the last row.
line32:
B0=$FF:B1=$FF:B2=$FF:B3=$FF:B4=$FF:B5=$FF:B6=$FF:B7=$FF:B8=$FF:B9=$FF:B10=$FF:B11=$FF:B12=$FF:B13=$FF:B14=$FF:B15=$FF
GoSub row32
Return
DMDrow1:
GoSub sendrowout1
Return
row232:
GoSub sendrowout232
Return
row32:
GoSub sendrowout32
Return
sendrowout1:
shiftout DOTclock, SERIALdata, 1, (B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15)
' the "1" after DOTclock means MSBfirst, idles low...
'Shiftout (write) the 16bytes (128bits) into Line 1 on the DMD.
PulsOut COLUMlatch, 1 'Latch the columns, putting info on Output (LED) display.
low DISPenable 'Disable the display.
high rowdata 'IF it's Row #1, then set this to a '1'
PulsOut ROWclock, 1 'Pulse the ROWclock, to advance to next row.
high DISPenable 'Re-Enable the display.
Return
sendrowout232:
ShiftOut DOTclock, SERIALdata, 1, (B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15)
PulsOut COLUMlatch, 1 'Latch the columns, writing info on Output (LED) display.
low DISPenable 'Disable the display.
low rowdata 'IF it's Rows #2 to 31, then set this to a '0'
PulsOut ROWclock, 1 'Pulse the ROWclock, to advance to next row.
high DISPenable 'Re-Enable the display.
Return
sendrowout32: '##### Row 32 does NOT need to pulsout the ROWclock, or that would be for a 33rd row #####.
ShiftOut DOTclock, SERIALdata, 1, (B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15)
PulsOut COLUMlatch, 1 'Latch the columns, writing info on Output (LED) display.
Return
START:
GoSub line1 'Line 1 - Load the 16bytes (variables B0 to B15) with "Line 1" DATA.
GoSub line2 'Line 2 - Load the 16bytes (variables B0 to B15) with "Line 2" DATA.
GoSub line3 'Line 3 - Load the 16bytes (variables B0 to B15) with "Line 3" DATA.
GoSub line4 'Line 4 - Load the 16bytes (variables B0 to B15) with "Line 4" DATA.
GoSub line4 'Line 5 - Load the 16bytes (variables B0 to B15) with "Line 5" DATA.
GoSub line4 'Line 6 - Load the 16bytes (variables B0 to B15) with "Line 6" DATA.
GoSub line4 'Line 7 - Load the 16bytes (variables B0 to B15) with "Line 7" DATA.
GoSub line4 'Line 8 -
GoSub line4 'Line 9
GoSub line4 'Line 10
GoSub line4 'Line 11
GoSub line4 'Line 12
GoSub line4 'Line 13
GoSub line4 'Line 14
GoSub line4 'Line 15
GoSub line4 'Line 16
GoSub line4 'Line 17
GoSub line4 'Line 18
GoSub line4 'Line 19
GoSub line4 'Line 20
GoSub line4 'Line 21
GoSub line4 'Line 22
GoSub line4 'Line 23
GoSub line4 'Line 24
GoSub line4 'Line 25
GoSub line4 'Line 26
GoSub line4 'Line 27
GoSub line4 'Line 28
GoSub line4 'Line 29
GoSub line3 'Line 30
GoSub line2 'Line 31
GoSub row32 'Line 32 - Load the 16bytes (variables B0 to B15) with "Line 32" DATA.
GoTo start
Thanx in advance,
Marty.
Last edited: