That code I mentioned for the Maximite..
I added in the functionality you said about...
and a picture of the maximite.
The MMBasic program was 6 Kb....most of that is the code for using the dmd panels..
Code: Select all
' A test program for a Freetronics DMD Panel that mirrors the vga memory to the dmd.
' This example code, uses 3 DMD panels. It utilizes the Line command to draw box's, similar
' to a seven segment display. It displays 3 digits. If the hundreds and tens digit equals zero
' then neither digit is displayed, only the units.
' This test program must be used with the Maximite_3.2C_includes_spiDMD.hex file
' available to download from
' http://members.iinet.net.au/~dpwyatt/Maximite_DW.html
' This program utilizes two commands added to Geoff Graham's MMBasic V3.2c code,
' added by Dennis Wyatt, SpiDMD() and MM.Video.
'********************************************************************
' code required for dmd panel usage
' These are the pins I used for the dmd panel
DMD_A = 16 ' D6 on supplied DMDcon(nector)
DMD_B = 15 ' D7 on supplied DMDcon(nector)
DMD_OE = 14 ' D9 on supplied DMDcon(nector)
DMD_CLK = 20 ' D13 on supplied DMDcon(nector)
DMD_SCLK = 17 ' D8 on supplied DMDcon(nector)
DMD_R_Data = 19 ' D11 on supplied DMDcon(nector)
DMD_T_Data = 18 ' D12 on supplied DMDcon(nector)[not actually required]
' attach maximite ground to pin GND on DMDCon(nector)
' set pins for output and input
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 ' set up number of displays wide
DisplaysDown=3 ' set up number of displays down
videomem= MM.Video ' code added to source 3.2C by D Wyatt
videomemlo = videomem And &h0000ffff
videomemhi = ((videomem-videomemlo)\2^16) And &h0000ffff
SetTick 5 , dmd_display ' set interrupt for dmd display
' end setup code dmd panel
'********************************************************************
Option base 0
Dim segment(8,4)
Dim numseg(10,8)
display=0
dnumber=123
For count=0 To 6
For count2=0 To 3
Read a
segment(count,count2)=a
Next count2
Next count
For count3=0 To 9
For count4=0 To 6
Read a
numseg(count3,count4)=a
Next count4
Next count3
Do 'do...loop begining
text$=Inkey$ ' read inkey$
If text$="q" Then End 'if q then quit
If text$="i" Then ' get input
Print @(100,100) " ";
Input "Number to display ",dnumber
text$="c"
display=0
EndIf
If text$="c" Then
Cls
display=Not display
If display = 1 Then
digit1= dnumber Mod 10
digit2= dnumber\10 Mod 10
digit3= dnumber\100 Mod 10
For x=0 To 7
If numseg(digit1,x)=1 Then
x1=segment(x,0)
y1=segment(x,1)
x2=segment(x,2)
y2=segment(x,3)
Line (x1,y1)-(x2,y2),1,bf
EndIf
If digit2>0 Or ( digit2=0 And digit3>0) Then
If numseg(digit2,x)=1 Then
x1=segment(x,0)
y1=segment(x,1)+16
x2=segment(x,2)
y2=segment(x,3)+16
Line (x1,y1)-(x2,y2),1,bf
EndIf
EndIf
If digit3>0 Then
If numseg(digit3,x)=1 Then
x1=segment(x,0)
y1=segment(x,1)+32
x2=segment(x,2)
y2=segment(x,3)+32
Line (x1,y1)-(x2,y2),1,bf
EndIf
EndIf
Next x
EndIf
EndIf
Loop ' end of do....loop
'*******************************************************************************
' subroutine code required by dmd panel
Sub senddata1( a_pin , b_pin , displayrow , wide , down)
Pin(DMD_A)= a_pin
Pin(DMD_B)= b_pin
Pin(DMD_OE) = 1
junk1 = SpiDMD( videomemhi, videomemlo, displayrow, wide, down, DMD_T_Data, DMD_R_Data, DMD_CLK)
Pin(DMD_OE) = 0
Pin(DMD_SCLK) = 1
Pin(DMD_SCLK) = 0
End Sub
' end subroutine code required by DMD panel
'*******************************************************************************
'*****************************************************************************
' code required by DMD panel, interrupt called every 5 ms, total of 20 ms for full display
dmd_display:
On dmdcount GoTo loop1,loop2,loop3,loop4
loop1:
senddata1(1,1,0,displayswide,displaysdown) ' lines 1,5,9,13
dmdcount=2
GoTo loopend
loop2:
senddata1(0,0,1,displayswide,displaysdown) ' lines 2,6,10,14
dmdcount=3
GoTo loopend
loop3:
senddata1(1,0,2,displayswide,displaysdown) ' lines 3,7,11,15
dmdcount=4
GoTo loopend
loop4:
senddata1(0,1,3,displayswide,displaysdown) ' lines 4,8,12,16
dmdcount=1
loopend:
IReturn
' end code required by DMD panel
'********************************************************************************
Data 1,1,14,3
Data 15,1,30,3
Data 28,1,30,14
Data 15,12,30,14
Data 1,12,14,14
Data 1,1,3,14
Data 14,1,16,14
Data 1,1,1,1,1,1,0 '0
Data 1,1,0,0,0,0,0 '1
Data 1,0,1,1,0,1,1 '2
Data 1,1,1,0,0,1,1 '3
Data 1,1,0,0,1,0,1 '4
Data 0,1,1,0,1,1,1 '5
Data 0,1,1,1,1,1,1 '6
Data 1,1,0,0,0,1,0 '7
Data 1,1,1,1,1,1,1 '8
Data 1,1,1,0,1,1,1 '9
Cheers Dennis...