DMD on a Maximite (Pic32) using MMBasic

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
Post Reply
Aussie_Wombat
Posts: 51
Joined: Tue May 22, 2012 12:52 pm
Location: Adelaide, South Australia

DMD on a Maximite (Pic32) using MMBasic

Post by Aussie_Wombat » Sat Jun 09, 2012 8:28 am

I got my DMD (single panel so far) to work on my Maximite , using the supplied MMbasic V3.2. Admittedly it flickers a little as the refresh rate is just on 8-9 ms, but at least it works..

It mirrors the VGA display to the DMD....It just ping pongs the text across the screen..... 8-)

My code (2.54 Kb)

Code: Select all

 Option base 0

              DMD_A   =      16    ' D6 from etherten(arduino)
              DMD_B   =      15    ' D7 from etherten(arduino)
              DMD_OE  =      14    ' D9 from etherten(arduino)
              DMD_CLK  =      20    ' D13 from etherten(arduino)
              DMD_SCLK  =      17    ' D8 from etherten(arduino)
              DMD_R_Data  =      19    ' D11 from etherten(arduino)
              DMD_T_Data  =      18    ' D12 from etherten(arduino)
             Pin(DMD_A) = 0
              SetPin DMD_A , 8
             Pin(DMD_B) = 0
              SetPin DMD_B , 8
             Pin(DMD_OE) = 0
              SetPin DMD_OE , 8
             Pin(DMD_CLK) = 0
              SetPin DMD_CLK , 8
             Pin(DMD_SCLK) = 0
              SetPin DMD_SCLK , 8
             Pin(DMD_R_Data) = 1
              SetPin DMD_R_Data , 8
              SetPin DMD_T_Data , 2
          DisplaysWide=1
          DisplaysDown=1
          Cls
        Dim row(17,4)

videomem= MM.Video  ' code added to MMBasic source 3.2 by D Wyatt
videomemlo = videomem And &h0000ffff
videomemhi = ((videomem-videomemlo)\2^16) And &h0000ffff
direction = 1
timing = 85
Timer=0
Do

text$=Inkey$
If text$="q" Then End
nextmove=Timer
If nextmove >lastmove + timing Then
    Line (xpos,0)-(xpos,16),0
    xpos=xpos+direction
    If xpos>30 Or xpos<1 Then direction = -direction
    Print@(xpos,0) "Maxi"
    Print@(xpos,8) "mite"
    lastmove=nextmove
EndIf

  senddata1(0,0,1)
  senddata1(1,0,2)
  senddata1(0,1,3)
  senddata1(1,1,0)
Loop

Sub senddata1( a_pin , b_pin , displayrow)

lastTimer =Timer
          For y= displayrow To 15 Step 4
     row(y,4)=Peek(videomemhi,videomemlo+60*y) Xor &hff
     row(y,3)=Peek(videomemhi,videomemlo+60*y+1) Xor &hff
     row(y,2)=Peek(videomemhi,videomemlo+60*y+2) Xor &hff
     row(y,1)=Peek(videomemhi,videomemlo+60*y+3) Xor &hff
          Next y
'          Print@(10,200) Timer

          Pin(DMD_A)= a_pin
          Pin(DMD_B)= b_pin
          Pin(DMD_OE) = 1
          For showbits = 1 To 4
       junk1 = SPI(DMD_T_Data, DMD_R_Data, DMD_CLK, row(12+displayrow,showbits)*2^8+row(8+displayrow,showbits), H, 0, 16)
       junk1 = SPI(DMD_T_Data, DMD_R_Data, DMD_CLK, row(4+displayrow,showbits)*2^8+row(displayrow,showbits), H, 0, 16)
          Next showbits
       Pin(DMD_OE) = 0
       Pin(DMD_SCLK) = 1
       Pin(DMD_SCLK) = 0
Print@(20,220) Timer-lasttimer

End Sub
A video in divx format can be viewed at http://members.iinet.net.au/~dpwyatt/vi ... n_move.avi and is 3.13 Mb in size..

Cheers Dennis

Aussie_Wombat
Posts: 51
Joined: Tue May 22, 2012 12:52 pm
Location: Adelaide, South Australia

Re: DMD on a Maximite (Pic32) using MMBasic

Post by Aussie_Wombat » Tue Jun 12, 2012 8:31 am

Managed to create a new command for the mmbasic source code that reads the 4x4 bytes of video memory and output through spi. Command runs just under 1 ms. update whole display in 4 ms. plenty of time to draw to the vga screen...

No flicker.

Cheers Dennis

Post Reply