Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:01 21 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : SSD1963 Display with MX170

     Page 1 of 2    
Author Message
G8JCF

Guru

Joined: 15/05/2014
Location: United Kingdom
Posts: 676
Posted: 11:14am 03 Aug 2015
Copy link to clipboard 
Print this post

MMBasic 4.7 has built-in drivers for some TFT displays, eg ST7735. However there are a huge number of TFT displays available - just search eBay for "TFT display" - so it is clearly impossible for MMBasic to have built-in drivers for every TFT display which someone might need to use. Also, MMBasic 4.7 for the PIC32MX170 chips has limited amounts of flash memory compared to the PIC32MX470 chips, and so support for TFT displays must necessarily be limited.

But all is not lost ! MMBasic V4.7 provides the capability for a user supplied TFT Display Driver to be loaded at runtime, ie a User Loadable Display Driver or “ULDD”. Once the Display Driver has been loaded, ALL of the MMBasic graphic commands can be used, eg BOX, LINE, PIXEL, TEXT, FONT, etc, ie a User Loadable Display Driver has ALL the capabilities of a built-in display driver. So a PIC32MX170 can now drive a SSD1963 5 inch display just like its younger but beefier PIC32MX470 sibling ! These User Loadable Display Drivers can ALSO be used with MMBasic 4.7 on the MX470 series of chips. Finally, the MM+ advanced graphics commands should also work but there is a sequence needed to initialise touch with User Loadable Display Drivers which Peter Mather will post on this thread in the next few days.

Peter Carnegie and Peter Mather have written User Loadable Display Drivers for

• SSD1963 – 8 bit databus – RGB888 for 4.3, 5, 7 inch TFT panels with PIC32MX170 (28 & 44 pin) – Published Below
• SSD1963 – 9 bit databus – RGB666 for 4.3, 5, 7 inch TFT panels with PIC32MX170 (44 pin), very fast – To be Published
• SSD1963 – 16 bit databus – RGB565 for 4.3, 5, 7 inch TFT panels with PIC32MX170 (44 pin) or MM+, faster than in-built MM+ routines but lower colour resolution – To be Published
• SSD1289 – 16 bit databus – RGB565 for 3.2” TFT panels with PIC32MX170 (44 pin) or MM+ – To be Published
• S6D0164 – 8 bit databus - RGB565 for 2.2” TFT panels with PIC32MX170 (28 & 44 pin) or MM+ - To be Published

Additional User Loadable Display Drivers will be released depending on demand, (so if you have a favourite display and don’t fancy writing your own ULDD, and can lend/give either of us one of those displays, then please contact us to see what can be done).

User Loadable Display Drivers will be

• added to this thread
• and may also be downloaded from www.mmbasic.org/uldd/uldd.html

A User Loadable Display Driver consists of :

3 small MMBasic Functions

• Function Display.Open(Arguments depending on display)
• Function Display.Close()
• Function Display.Ver()

And a single CFunction

• CFunction Driver_XXXX

Where XXXX is a unique identifier for the driver, eg Driver_SSD1963_8

An example ULDD for a SSD1963 display with an 8 bit databus is included in this post further down

Each ULDD comes with comprehensive inline usage documentation describing each MMBasic FUNCTION, arguments, and return values. The hardest part about using an ULDD is making that one call to Display.Open with the correct arguments, it really is that simple.

To use a User Loadable Display Driver :-

1. Goto www.mmbasic.org/uldd/uldd.html and download the required ULDD which takes the form of a MMBasic program called a Test Harness – see example below.

2. Open the ULDD in your editor, we recommend MMEdit, and edit the “Test Harness” code to suit your hardware pin definitions – refer to the inline documentation for Display.Open – DO NOT alter any of the code in Driver Functions or Driver CFunction.

3. Test and run the “Test Harness” until your display shows the correct results. There is no point in proceeding to the next step until you have gotten the “Test Harness” to operate correctly.

4. Save the “Test Harness” with your changes so that later on you can refer to it when incorporating the ULDD into your own program, and so that you will always have a working reference point to go back to if/when your code & display stop working

5. Now delete the “Test Harness” part of the MMBasic code so that you are left with just the 3 MMBasic Display Functions and the Driver CFunction itself

6. Do Ctrl-A, Ctrl-C to copy the driver code to the clipboard

7. Close but DO NOT save the code

8. Open up your MMBasic program, and paste the driver code onto the END of your MMBasic program, and save !

9. In your MMBasic program you MUST call Display.Open before you can use BOX, TEXT, LINE etc. So, refer back to your working “Test Harness”, copy the line containing Display.Open across to your MMBasic program, and place it BEFORE any MMBasic graphics commands.

10. All being well, when you run your MMBasic program, your display should spring to life. If it doesn’t, compare the arguments you have supplied to Display.Open against those in Step 3 above. If the arguments match, then you will have to go back to step 3 and run your saved “Test Harness” whilst checking your wiring until your display does spring to life.

While developing your program, you will go through the familiar Edit/Run/Debug/Edit cycle. Before each RUN, you must issue a CPU RESTART command to reset MMBasic’s internal structures relating to Display Drivers. If you don’t issue CPU RESTART, then FUNCTION Display.Open will break with an error telling you to do “CPU RESTART”.

Peter Carnegie will be updating the CFunction Tutorials document to include a chapter on Writing User Loadable Display Drivers, together with providing the Display Driver framework source code as a starting point for writing your own User Loadable Display Driver.

We hope that you find this new capability in MMBasic 4.7 as exciting, useful and innovative as we do !

Peter & Peter

Example User Loadable Display Driver for SSD1963 controlled TFT Display.[code]

OPTION EXPLICIT
OPTION DEFAULT None
CPU 48

PRINT "SSD1963 CFunction Driver Example - (c) Peter Carnegie 2015"

'4.3 inch display
CONST Size!=4.3

'Landscape
DIM Orientation%=1

‘Display the Driver Version
PRINT "Driver_SSD1963_8 Version ";Display.Ver()

'Initialise the Display Driver
'Display.Open(D0%,D1%,D2%,D3%,D4%,D5%,D6%,D7%,RS%,WR%,RST%,CS%,Orient%,Size!)
DIM Retrn%=Display.Open(2,3,4,5,6,7,9,10,15,17,18,Orientation%,Size!)

'Use Font 2 and scale x4
Font 2,4

'Yellow FG, Dark Blue BG
Colour &HFFFF00,&H000066

'Clearscreen
CLS

'Draw a Red Frame
Box 0,0,MM.HRes-4,MM.VRes-4,4,&HFF0000,-1

Text (MM.HRes/2)-115,(MM.VRes/2)-100,"SSD1963"

Text (MM.HRes/2)-140,(MM.VRes/2)+70,STR$(MM.HRes)+" "+STR$(MM.VRes),,1,1

Text MM.Hres/2 - 20,(MM.VRes/2)+70,"x"

DIM I%

'Countdown
FOR I%=9 TO 0 STEP -1
Text (MM.Hres/2)-40, (MM.VRes/2)-35,STR$(I%),,1,2,&H00FF00,&H000066
PAUSE 900
NEXT I%

'Change Orientation to Portrait to show that calling
'Display.Open again in a program is legal
Orientation%=2
Retrn%=Display.Open(2,3,4,5,6,7,9,10,15,17,18,Orientation%,Size!)

GUI Test Display

'Close the driver
Retrn%=Display.Close()

END



'**********Append this code and below onto the end of your MMBasic program***********
' For Documentation Scroll down
'************************************************************************************

FUNCTION Display.Open(D0%,D1%,D2%,D3%,D4%,D5%,D6%,D7%,RS%,WR%,RST%,Orient%,Size!) AS FLOAT

LOCAL Pindefs%(16)
LOCAL DisplayMetrics%(4)
LOCAL CFuncAddr%
LOCAL Retrn%

'Open Driver Function, 0=Open, 1=Close, 2=Ver
LOCAL DriverFunc%=0

PinDefs%(0)=D0%:PinDefs%(1)=D1%:PinDefs%(2)=D2%:PinDefs%(3)=D3%
PinDefs%(4)=D4%:PinDefs%(5)=D5%:PinDefs%(6)=D6%:PinDefs%(7)=D7%

PinDefs%(8)=RS%
PinDefs%(9)=WR%
PinDefs%(10)=RST%

DisplayMetrics%(0)=Orient%
DisplayMetrics%(1)=Size! * 10

CFuncAddr%=PEEK(CFUNADDR Driver_SSD1963_8)

Retrn%=Driver_SSD1963_8(DriverFunc%,CFuncAddr%,PinDefs%(),DisplayMetrics%())

Display.Open=Retrn%

'Check Return codes
SELECT CASE Retrn%
CASE 0
EXIT FUNCTION
CASE 1
ERROR "Driver_SSD1963.Open : "+STR$(Retrn%)+" : Driver Already Open - use CPU Restart"
CASE ELSE
ERROR "Driver_SSD1963.Open : "+STR$(Retrn%)+" : Unknown Error"
END SELECT

END FUNCTION


FUNCTION Display.Close() AS FLOAT

LOCAL Retrn%=Driver_SSD1963_8(1)

Display.Close=Retrn%

'Check Return codes
SELECT CASE Retrn%
CASE 0
EXIT FUNCTION
CASE 1
PRINT "Warning: Driver_SSD1963.Close : "+STR$(Retrn%)+" : Driver Already Closed"
EXIT FUNCTION
CASE ELSE
ERROR "Driver_SSD1963.Close : "+STR$(Retrn%)+" : Unknown Error"
END SELECT

END FUNCTION


FUNCTION Display.Ver() AS FLOAT

LOCAL Retrn%=Driver_SSD1963_8(2)
Display.Ver=Retrn% / 100

END FUNCTION


'*******************************************************************************
'
' Copyright (c) Peter Carnegie 2015
'
' Display Driver for SSD1963 controlled TFT LCD Panel
'
' Display.Open Initialises the loadable CFunction driver so that you can use all of the
' MMBasic graphic commands in your program.
'
' D0% ~ D7% are the pin numbers for the data bus to the display
' RS% is pin number of RS signal
' WR% is pin number of WR signal
' RST% is pin number of Reset signal
' Orient% LANDSCAPE=1,PORTRAIT=2,RLANDSCAPE=3,RPORTRAIT=4
' Size! is display size in Inches eg 4.3inch, 5.0 etc
'
' NB, Tie RD on display module to 3V3 via 10K
' Tie CS on display module to 0V directly
'
' NB Driver.Open may be safely called again within an MMBasic program to
' to change the orientation for example.
'
' Returns 0 if successful, 1 if error
'
' After Calling Driver.Open, any of the usual MM Graphic commands may be used
' in your MMBasic program, eg BOX, TEXT, LINE, CIRCLE etc
'
' Display.Close Release all H/W and RAM used by the Driver
' Returns 0 if success, else non-zero if error/warning
'
' Display.Ver Returns the CFunction Driver version number as a float, eg 1.4
'
' Ver 1.0 2015-07-20 Initial Release
' 1.1 2015-07-20 Updated
' Renamed InitDriver to OpenDriver
' Added CloseDriver
' 1.2 2015-07-21 Single MERGE CFunction - Simplified
' 1.3 2015-07-21 Removed RD%, HRes%,VRes% from argument list to match up
' with V1.3 of CFunction Driver_SSD1963
' Tie RD pin on Display to 3v3 via 10K <<<<<<<<<Important
' 1.4 2015-07-24 Added Error/Warning handlers
' 1.5 2015-07-28 Removed CS
' Updated Error handling in Driver.Open
' 1.6 2015-08-03 Renamed MMBasic driver FUNCTIONS to
' DISPLAY.Open/Close/Ver
' Updated CFuncton driver name to include
' databus width, ie Driver_SSD1963_8
'
'**********************************************************************************


'******************************************************************************
'Created : 2015-08-03 11:22:27 UTC
'Author : Peter Carnegie
'Generator : CFuncGen Ver 2.1.5.0
'
CFUNCTION Driver_SSD1963_8
00000281
308400ff 3c029d00 8c42008c 8c420000 8c4300e0 10640051 30830001 50600006
8c4300c0 8c4300a0 8c450080 ac650000 10000004 30830002 8c450080 ac650000
30830002 50600006 8c4300c4 8c4300a4 8c450084 ac650000 10000004 30830004
8c450084 ac650000 30830004 50600006 8c4300c8 8c4300a8 8c450088 ac650000
10000004 30830008 8c450088 ac650000 30830008 50600006 8c4300cc 8c4300ac
8c45008c ac650000 10000004 30830010 8c45008c ac650000 30830010 50600006
8c4300d0 8c4300b0 8c450090 ac650000 10000004 30830020 8c450090 ac650000
30830020 50600006 8c4300d4 8c4300b4 8c450094 ac650000 10000004 30830040
8c450094 ac650000 30830040 50600006 8c4300d8 8c4300b8 8c450098 ac650000
10000004 7c041c20 8c450098 ac650000 7c041c20 04630006 8c4300dc 8c4300bc
8c45009c ac650000 10000004 ac4400e0 8c45009c ac650000 ac4400e0 8c430064
8c44005c ac640000 8c430070 8c440068 ac640000 8c43006c 8c440068 ac640000
8c430060 8c42005c ac620000 03e00008 00000000
308400ff 3c029d00 8c42008c 8c420000 8c4300e0 10640051 30830001 50600006
8c4300c0 8c4300a0 8c450080 ac650000 10000004 30830002 8c450080 ac650000
30830002 50600006 8c4300c4 8c4300a4 8c450084 ac650000 10000004 30830004
8c450084 ac650000 30830004 50600006 8c4300c8 8c4300a8 8c450088 ac650000
10000004 30830008 8c450088 ac650000 30830008 50600006 8c4300cc 8c4300ac
8c45008c ac650000 10000004 30830010 8c45008c ac650000 30830010 50600006
8c4300d0 8c4300b0 8c450090 ac650000 10000004 30830020 8c450090 ac650000
30830020 50600006 8c4300d4 8c4300b4 8c450094 ac650000 10000004 30830040
8c450094 ac650000 30830040 50600006 8c4300d8 8c4300b8 8c450098 ac650000
10000004 7c041c20 8c450098 ac650000 7c041c20 04630006 8c4300dc 8c4300bc
8c45009c ac650000 10000004 ac4400e0 8c45009c ac650000 ac4400e0 8c430070
8c440068 ac640000 8c43006c 8c420068 ac620000 03e00008 00000000
27bdffd8 afbf0024 afb10020 afb0001c afa5002c afa60030 afa70034 00808821
27a20030 afa20010 30a400ff 0411FF30 00000000 2a220002 1440000a 24100001
8fa20010 24430004 afa30010 90440000 0411FF8C 00000000 26100001 1611fff9
8fa20010 8fbf0024 8fb10020 8fb0001c 03e00008 27bd0028
27bdffd8 afbf0024 afb10020 afb0001c 3c089d00 8d08008c 8d090000 8d280030
240a0002 150a0008 240a0004 8d310038 2631ffff 02268023 02248823 00e01821
1000000c 00a01021 150a0008 240a0001 8d230034 2463ffff 00671023 00651823
00c08821 10000012 00808021 510a000d 00e08821 240a0003 550a000e 00032203
8d230034 2463ffff 00661023 00641823 8d310038 2631ffff 02278023 10000004
02258823 00a08021 00c01821 00801021 00032203 afa40010 afa30014 24040005
2405002a 00023203 00403821 0411FFAE 00000000 00111203 afa20010 afb10014
24040005 2405002b 00103203 02003821 0411FFA5 00000000 8fbf0024 8fb10020
8fb0001c 03e00008 27bd0028
27bdffd0 afbf002c afb60028 afb50024 afb40020 afb3001c afb20018 afb10014
afb00010 0086102a 14400004 8fb60040 00801021 00c02021 00403021 00a7102a
14400004 28940000 00a01021 00e02821 00403821 0014200b 0080a021 3c029d00
8c420094 8c420000 0082202b 2443ffff 0064a00a 28d50000 0015300b 00c0a821
00c2182b 2442ffff 0043a80a 28b30000 0013280b 00a09821 3c029d00 8c420098
8c420000 00a2202b 2443ffff 0064980a 28f00000 0010380b 00e08021 00e2182b
2442ffff 0043800a 7ed23c00 02802021 02602821 02a03021 02003821 0411FF85
00000000 2404002c 0411FEA0 00000000 24020001 00539823 02708021 0054a023
0295a821 72158002 1a00000e 7ed13a00 32d300ff 02402021 0411FEF9 00000000
02202021 0411FEF6 00000000 02602021 0411FEF3 00000000 2610ffff 1600fff6
02402021 8fbf002c 8fb60028 8fb50024 8fb40020 8fb3001c 8fb20018 8fb10014
8fb00010 03e00008 27bd0030
27bdff80 afbf007c afbe0078 afb70074 afb60070 afb5006c afb40068 afb30064
afb20060 afb1005c afb00058 afa40080 00a08021 afa60088 afa7008c 8fb20090
8fb40094 3c029d00 8c42008c 8c420000 8c430030 24040001 10640004 8fb10098
24040003 54640005 8c530038 8c530034 8c420038 10000003 afa2003c 8c420034
afa2003c 7e823c00 afa20020 7e833a00 afa30024 7e223c00 afa20028 7e233a00
afa3002c 8fa20080 2446ffff 2607ffff 00402021 02002821 8fa20088 72421802
00663021 8fa2008c 72421802 00673821 0411FF2D 00000000 2404002c 0411FE48
00000000 8fa2008c 18400076 323100ff afb20018 afb00040 8fa30088 afa3004c
00031023 afa20050 8fa2008c 00430018 00001012 afa20048 afa00014 afa00044
afb10030 329400ff 10000062 afb40034 0600001f 0213102a 5040001e 26310001
06a2001c 26310001 52e0001a 26310001 93c20000 8fa30010 00431024 1040000c
8fa40028 8fa40020 0411FE8A 00000000 8fa40024 0411FE87 00000000 8fa40034
0411FE84 00000000 1000000a 26310001 0411FE80 00000000 8fa4002c 0411FE7D
00000000 8fa40030 0411FE7A 00000000 26310001 1632ffde 26100001 26940001
8fa20018 8fa30088 12830016 02c2b021 8fa30014 02831021 24430007 285e0000
007e100b 0002f0c3 8fa2009c 005ef021 8fa2001c 00541823 000317c3 00021742
00621821 30630007 00621023 24030001 00431004 afa20010 02c08021 1000ffc4
00008821 8fa20038 24420001 afa20038 14520007 26b50001 1000000c 8fa20044
afa00038 8fa30048 2463ffff afa3001c 8fa20088 1840fff3 8fb60080 0000a021
8fa3003c 1000ffda 02a3b82a 24420001 afa20044 8fa30040 8fa20018 00621821
afa30040 8fa30014 8fa2004c 00621821 afa30014 8fa30048 8fa20050 00621821
afa30048 8fa30044 8fa2008c 10620006 8fbf007c 1e40ffe2 8fb50040 1000ffeb
8fa20044 8fbf007c 8fbe0078 8fb70074 8fb60070 8fb5006c 8fb40068 8fb30064
8fb20060 8fb1005c 8fb00058 03e00008 27bd0080
27bdffd8 afbf0024 afb30020 afb2001c afb10018 afb00014 3c029d00 8c42008c
8c500000 02009821 12000032 24020001 3c029d00 8c430048 8e040044 ac640000
8c43004c 8e04004c ac640000 8c430090 8e040058 a0640011 8c430098 8e040054
ac640000 8c420094 8e030050 ac430000 26120020 3c119d00 8e220010 8e040000
00002821 0040f809 00003021 26100004 5612fffa 8e220010 3c109d00 8e020010
8e640020 00002821 0040f809 00003021 8e020010 8e640024 00002821 0040f809
00003021 8e020010 8e64002c 00002821 0040f809 00003021 ae6000e4 8e020044
0040f809 02602021 8e02008c ac400000 00001021 8fbf0024 8fb30020 8fb2001c
8fb10018 8fb00014 03e00008 27bd0028
27bdffb0 afbf004c afbe0048 afb70044 afb60040 afb5003c afb40038 afb30034
afb20030 afb1002c afb00028 00a0b821 00c0a821 00e0f021 8c820000 24030001
14430008 8c840004 14800007 24030002 0411FFA7 00000000 00402021 100001dd
00022fc3 24030002 14430003 3c029d00 108001d7 240400a0 8c42008c 8c420000
10400009 00409821 8c4300e4 24040001 3c02dead 3442c001 146201ce 00002821
1000000c 02a08821 3c109d00 8e02003c 0040f809 24040100 00409821 8e02008c
ac530000 3c02dead 3442c001 ae6200e4 02a08821 02609021 0000a021 3c109d00
24160001 8e020028 0040f809 8e240000 00561004 ae420080 8e020024 8e240000
0040f809 24050006 ae4200a0 8e020024 8e240000 0040f809 24050005 ae4200c0
8e020010 8e240000 24050008 0040f809 00003021 8e020014 8e240000 0040f809
00002821 8e220000 ae420000 26940001 26310008 24020008 1682ffe2 26520004
ae6000e0 3c109d00 8e020028 0040f809 8ea40040 24110001 00511004 ae62005c
8e020024 8ea40040 0040f809 24050006 ae620060 8e020024 8ea40040 0040f809
24050005 ae620064 8e020010 8ea40040 24050008 0040f809 00003021 8ea20040
ae620020 8e620060 8e63005c ac430000 8e020028 0040f809 8ea40048 00511004
ae620068 8e020024 8ea40048 0040f809 24050006 ae62006c 8e020024 8ea40048
0040f809 24050005 ae620070 8e020010 8ea40048 24050008 0040f809 00003021
8ea20048 ae620024 8e62006c 8e630068 ac430000 8e020010 8ea40050 24050008
0040f809 00003021 8e020014 8ea40050 0040f809 24050001 8ea20050 ae62002c
3c029d00 24420a04 3c039d00 24630494 0062202b 10800005 00621823 8ee40000
00641821 10000004 ae630040 8ee40000 00641821 ae630040 3c039d00 24630600
0062202b 10800005 00621023 8ee40000 00441021 10000004 ae620048 8ee40000
00441021 ae620048 26720030 8fc20000 ae620030 8fc20008 ae62003c 2c420032
10400006 2671003c 240201e0 ae620034 24020110 10000005 ae620038 24020320
ae620034 240201e0 ae620038 3c029d00 8c430094 8c630000 ae630050 8c430098
8c630000 ae630054 8c430090 80630011 ae630058 8c420090 8e430000 a0430011
8e420000 24030001 10430003 24030003 14430009 3c029d00 3c029d00 8c430094
8e640034 ac640000 8c420098 8e630038 10000007 ac430000 8c430094 8e640038
ac640000 8c420098 8e630034 ac430000 3c109d00 8e020014 8ea40050 0040f809
24050001 8e020004 0040f809 24042710 8e020014 8ea40050 0040f809 00002821
8e020004 0040f809 24042710 8e020014 8ea40050 0040f809 24050001 8e020004
0040f809 24042710 8e300000 2e100032 24020023 2403001e 0070100a 00408021
24020054 afa20010 24040004 240500e2 02003021 24070002 0411FD3C 00000000
24040002 240500e0 24060001 0411FD37 00000000 3c149d00 8e820004 0040f809
240403e8 24040002 240500e0 24060003 0411FD2E 00000000 24040001 24050001
0411FD2A 00000000 8e820004 0040f809 24042710 8e220000 2c420032 5040000b
240200ff 24020032 afa20010 24040004 240500e6 24060001 24070033 0411FD1B
00000000 10000009 8e220000 afa20010 24040004 240500e6 24060003 240700ff
0411FD12 00000000 8e220000 2c420032 10400011 8e630034 8e620038 00032202
afa40010 afa30014 00021a02 afa30018 afa2001c afa00020 24040008 240500b0
24060020 00003821 0411FD00 00000000 10000010 8e220000 8e620038 00032202
afa40010 afa30014 00021a02 afa30018 afa2001c afa00020 24040008 240500b0
24060024 00003821 0411FCF0 00000000 8e220000 2c420032 10400011 afa00010
24020008 afa20014 2402002b afa20018 afa0001c 24020002 afa20020 afa00024
24040009 240500b4 24060002 24070013 0411FCDE 00000000 10000010 8e220000
2402002e afa20014 24020030 afa20018 afa0001c 2402000f afa20020 afa00024
24040009 240500b4 24060003 240700a0 0411FCCE 00000000 8e220000 2c420032
10400010 afa00010 24020004 afa20014 2402000c afa20018 afa0001c 24020002
afa20020 24040008 240500b6 24060001 24070020 0411FCBD 00000000 1000000e
24040002 24020010 afa20014 afa20018 afa0001c 24020008 afa20020 24040008
240500b6 24060002 2407000d 0411FCAF 00000000 24040002 240500f0 00003021
0411FCAA 00000000 24040003 240500b8 2406000f 24070001 0411FCA4 00000000
24040002 240500ba 24060001 0411FC9F 00000000 24040002 24050026 24060001
0411FC9A 00000000 24110001 afb10010 240200f0 afa20014 afa00018 afa0001c
24040007 240500be 24060006 240700f0 0411FC8E 00000000 24040002 240500d0
2406000d 0411FC89 00000000 24040002 24050036 00003021 0411FC84 00000000
8e420000 10510007 24030002 1043000a 24030003 50430009 241000c0 10000003
38420004 00008021 38420004 24030060 10000002 0062800a 241000a0 24040002
24050036 02003021 0411FC70 00000000 24040001 24050029 0411FC6C 00000000
3c109d00 8e020048 8c420000 ae620044 8e02004c 8c420000 ae62004c 8e020048
8e630040 ac430000 8e020048 8e030094 8c660000 8e030098 8c670000 afa00010
8c420000 00002021 00002821 24c6ffff 0040f809 24e7ffff 8e02004c 8e630048
ac430000 00002021 10000002 00002821 00002821 00801021 00a01821 8fbf004c
8fbe0048 8fb70044 8fb60040 8fb5003c 8fb40038 8fb30034 8fb20030 8fb1002c
8fb00028 03e00008 27bd0050
END CFUNCTION 'MIPS32 M4K
'
'******************************************************************************
[/code]
The only Konstant is Change
 
Chris Roper
Senior Member

Joined: 19/05/2015
Location: South Africa
Posts: 280
Posted: 11:47am 03 Aug 2015
Copy link to clipboard 
Print this post

I love the concept and would like to see it extended such that, on the MX170 at least, there be no built in LCD drivers or font files at all.

Well with one exception :)
In fact you could consider this a request for my Favourite Display, VT100...

My reasoning being that the most likely use of a MM170 is as an embedded application, the majority of which have no keyboard or Display attached.

For those projects that require a display the appropriate driver could be loaded, those that don't need the display will have more Flash and RAM available.

The VT100 Driver will allow a formatted diagnostics / Status / Configuration / Update display, via the Console pins (or a bluetooth module), with only a Tablet or Cellphone running a terminal emulator. Perfect for field updates or testing.

Cheers
Chris

http://caroper.blogspot.com/
 
G8JCF

Guru

Joined: 15/05/2014
Location: United Kingdom
Posts: 676
Posted: 11:50am 03 Aug 2015
Copy link to clipboard 
Print this post

Hi Chris

U and I think 100% alike on this point !!

I think that built-in SD card support for logging for example is needed by embedded systems more than built-in TFT display support with the little 'MX170.

PeterEdited by G8JCF 2015-08-04
The only Konstant is Change
 
Chris Roper
Senior Member

Joined: 19/05/2015
Location: South Africa
Posts: 280
Posted: 12:05pm 03 Aug 2015
Copy link to clipboard 
Print this post

Hi Peter,

We are definitely 100% alike.
I was originality going to say that the extra flash could be used to add SD Card support but didn't want to push my luck :)

I guess though, in the long run, there are so many possible combinations that MMBasic will end up as a Complier rather than its original, and laudable, vision of being an interpreter.

Cheers
Chris



http://caroper.blogspot.com/
 
G8JCF

Guru

Joined: 15/05/2014
Location: United Kingdom
Posts: 676
Posted: 12:13pm 03 Aug 2015
Copy link to clipboard 
Print this post

Hi Chris

I certainly hope that MMBasic will remain as an Interpreter with all the benefits of immediacy, accessibility, speed of development, and simplicity which Interpreted environments bring.

I see CFunctions as the way of combining the best of the MMBasic Interpreter with the power, and performance of fully compiled C (and Assembler for the real hard-core !).

To me, MMBasic + CFunctions provide the best of both worlds. For most of the time, in most situations, MMBasic alone is more than plenty sufficient, but when one needs that extra "oomph", or need to extend MMBasic itself, then roll out the C compiler and then nothing is off limits.

Peter
The only Konstant is Change
 
G8JCF

Guru

Joined: 15/05/2014
Location: United Kingdom
Posts: 676
Posted: 12:31pm 03 Aug 2015
Copy link to clipboard 
Print this post

Correction - the URL should be http://www.mmbasic.org/uldd/uldd.html
and also, the comment line in the example above which reads
'Display.Open(D0%,D1%,D2%,D3%,D4%,D5%,D6%,D7%,RS%,WR%,RST%,CS%,Orient%,Size!)

should read
'Display.Open(D0%,D1%,D2%,D3%,D4%,D5%,D6%,D7%,RS%,WR%,RST%,Orient%,Size!)

ie there is NO CS%

Apologies for the errors.

Peter
The only Konstant is Change
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 12:33pm 03 Aug 2015
Copy link to clipboard 
Print this post

I'm surprised that you have to include a CFunction in the BASIC source code, rather than getting it directly from the SD card. Imagine something like:

' Load display driver from disk
CFUNCTION "9341.drv"

' Load PS/2 driver from disk
CFUNCTION "ps2.drv"

' Main code
...


Or how about being able to feed the data from another source? Lets say you don't have an SD card on your micromite, but have a SPI serial flash chip. You could write a BASIC routine that would read a driver from the serial flash chip and "into" a cfunction (into the MM flash).

You could have a very inexpensive SPI flash chip that holds a driver and also has room for r/w of data. An SD card can't be soldered in place and costs a bit more.


Micromites and Maximites! - Beginning Maximite
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 12:52pm 03 Aug 2015
Copy link to clipboard 
Print this post

You could load fonts from a SPI serial device, too.

A '170 with a SPI chip can be pretty low cost and if you can utilize the SPI chip to have this type of capability through BASIC-written SPI flash routines, then an embedded project can have some SD-similar functionality without an SD card.

(NOT saying to do away with the SD capabilities.)

Micromites and Maximites! - Beginning Maximite
 
G8JCF

Guru

Joined: 15/05/2014
Location: United Kingdom
Posts: 676
Posted: 01:09pm 03 Aug 2015
Copy link to clipboard 
Print this post

@CG

The MX170 doesn't support SD card operations so LOAD etc won't work sadly.

The whole business of how to load CFunctions into Flash efficiently has been exercising Geoff, PeterM and I for some time as you are probably aware from http://www.thebackshed.com/forum/forum_posts.asp?TID=7845&PN=1

At some point we are going to have to deal with how MMBasic programs are loaded and sort out loading CFunctions at the same time, but right now, there is so much else to do !

Peter
The only Konstant is Change
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 01:20pm 03 Aug 2015
Copy link to clipboard 
Print this post

Yup, I'm mixing '470 and '170 a bit.

Still right now CFunction stuff in the BASIC source code is the only option. If there were a way to read a CFunction from another source (EEPROM, SPI flash, SD, etc) then the option for providing CFunctions/drivers opens up.

Micromites and Maximites! - Beginning Maximite
 
G8JCF

Guru

Joined: 15/05/2014
Location: United Kingdom
Posts: 676
Posted: 01:36pm 03 Aug 2015
Copy link to clipboard 
Print this post

@CG Agreed, but we are where we are.

I do sometimes wonder how many MMBasic people actually write/use CFunctions - I know Peter Mather has made excellent, extensive, prolific, and innovative use of CFunctions, but I've seen very little usage otherwise. The reason for posing the question is that development effort is related to demand, and if there is little demand from the MMBasic community for CFunctions, then the resources/time put into sorting out how to more efficiently load/store CFunctions will be similarly limited.

I of course believe that CFunctions are really essential/great, so I am somewhat biased, but at some point even I will give up beating my head against a brick wall if only a handful of people think they are important

Peter
The only Konstant is Change
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2440
Posted: 01:44pm 03 Aug 2015
Copy link to clipboard 
Print this post

peter: i'm also in complete agreement with you on this one, on the MX170 flash is too precious to have large chunks tied up with colour LCD display drivers that in the majority of user cases will not be used. in my opinion, the flash space would be far better allocated to allow other functions to be implemented that keep the MX170 and MX470 versions of the language in step.

just my opinion, mind you.


cheers,
rob :-)
 
G8JCF

Guru

Joined: 15/05/2014
Location: United Kingdom
Posts: 676
Posted: 02:10pm 03 Aug 2015
Copy link to clipboard 
Print this post

G'Mornin' Rob

I think that the MX170 and MX470 have different target markets.

From what I see, the MX470 is a replacement for the Original MaxiMite, whereas the MX170 is an embedded controller.

I think that it is entirely possible to have the exact same MMBasic on both platforms but with specific device support being built-in for the MX470, and User Loadable for the MX170.

If we could figure out how to load Drivers efficiently, then of course we could have the same MMBasic everywhere and just load the relevant drivers for a given hardware setup.

It's very easy to say what I've just said, making the changes to the MMBasic source code is quite another matter altogether - this would not be a trivial matter by any definition

Peter

The only Konstant is Change
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10281
Posted: 09:26pm 03 Aug 2015
Copy link to clipboard 
Print this post

  Quote  I think that built-in SD card support for logging for example is needed by embedded systems more than built-in TFT display support with the little 'MX170.


Peter and I disagree on this. The driver that Peter has presented relies on the fact that all the drawing primitives are already in the firmware (text, line, circle etc.) so removing support for a specific display only frees up the flash used in the initialisation code for that display. IMHO this is nowhere near enough for anything more than the most simple SD card support, perhaps an openlog equivalent and possibly not even that. Certainly you can forget complex operations like loading driver files from SD, file read/write etc. SD card support also requires sizeable RAM buffers which would further reduce program space.

Of course you can remove any TFT support entirely and then you are back to my original display routines which were taking most of the MM memory to load leaving little space for anything else.

I believe the current situation is about optimum. Full SD card support on the MM+. but not on the MM. Limited built in TFT support on the MM but with scope for adding display specific drivers. Complex TFT support on the MM+ (GUI commands) but only a small selection of in-built displays with scope for adding others.

  Quote  From what I see, the MX470 is a replacement for the Original MaxiMite, whereas the MX170 is an embedded controller.


Again I disagree, there is only a couple of dollars difference in price between a 44-pin MX170 and a 64-pin MX470 so unless you are using the chips on an industrial scale this is irrelevant. The big plus for the MX170 is the 28-pin DIP package, I suspect take up of the 44-pin package has been very small. So while the MM+ can replace the Maximite, it is still completely suited to embedded applications.

So for easy breadboarding and simple PCB layout (no Xtal) use 28-pin (+ openlog where required). For production PCB's use 64-pin (or 100-pin once available).

I want to build a instrumentation PCB to use the very bright 2.2" displays (8-bit parallel interface). I've been pondering whether to use the 44-pin MX170 or the 64-pin MX470. It is interesting that writing this has crystallised my view - it will be a 64-pin; the downside $2 and a crystal.


UPDATE

Some data on flash usage from the linker maps

Interpreter SD card handling on the MX470 : 40612 bytes
Microchip SD card routines on the MX470 : 4124 bytes

TFT handling on the MX170 : 5400 bytes
Fonts on MX170 : 3856 bytes



quarts and pint pots?Edited by matherp 2015-08-05
 
centrex

Guru

Joined: 13/11/2011
Location: Australia
Posts: 320
Posted: 10:59pm 03 Aug 2015
Copy link to clipboard 
Print this post

Hi all
The above is very enlightening but my chances of writing a CF is practically zero but I do rely on the two Peters and a couple of others on TBS to give us pieces of code that can be used as we see fit.
What I wonder is what all these various versions of the micromite are used for.
There are a large number of forum members who seem to be doing something judging by the posts but what.
A few posts on I built this totally useless wizzy gig would at least show what the Micromite is being used for.
I am guilty as any but I have put a few pictures of what I have used the Micromite for (mostly temperature and pressure related).
Regards Cliff
Cliff
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2440
Posted: 01:26am 04 Aug 2015
Copy link to clipboard 
Print this post

i believe that the MM-family can be identified with 3 distinct branches:

MX170 - big plus is the DIP package as matherp notes. low power consumption, really easy to embed in a project. ultra-low cost of around $5. ideal hobby toy that can be blown up without shedding tears.

MX470 - more 'room to move', SD card support, TFT displays. can potentially be built up into a small 'pocket computer' format system with a 7" TFT display and a miniature keyboard. this will be helped along when/if support for USB keyboards arrives. cost is higher, simply because a carrier board is necessary. medium cost of $20 on a carrier board.

MX695 (maximite) - big bonus is being able to drive a VGA display that can be purchased for very few dollars second-hand. can be used as a standalone desktop system. much higher power consumption. traditionally much higher cost, though if the PCB was redesigned this could be brought down considerably. much 'cool factor' of a single chip doing VGA and running the interpreter.


i am surprised that the TFT support on the MX170 takes so little space in flash. but having said this, i would still like to see it consist of hooks within the interpreter + some sort of user-loaded module. the main reason is that the TFT displays it supports are those being sold on ebay this week. next week, next month, next year, the offerings on ebay could be quite different. my opinion is that G8JCF's approach looks like a good way of achieving this. but it may well require a change to the way custom functions are stored - right now they take up around 3x the space of the raw code.


if one wants SD support, then the MX470 seems to be the practical way to go. geoff has looked at SD cards on the MX150/170 in the past and i believe found it not a realistic option. a good compromise may be adding inbuilt support to the MX170 for I2C eeprom chips like the AT24C256 (32k), 24LC1025 (128k), AT24CM02 (256k), treating these devices simply as a series of numbered pages. it seems like this should require little code within the interpreter, and opens up the possibility of standalone data logging applications with the data downloaded later on via an mmbasic program reading the data out of the eeprom and writing it to a serial port.

and i do still feel there is mileage left in the maximite. my hope is that all the micromite developments will at some time be back-ported to the maximite, or the micromite codebase extended to run on the MX695 with VGA support added in. after all, the maximite is... cool.


cheers,
rob :-)Edited by robert.rozee 2015-08-05
 
f1fco

Senior Member

Joined: 18/03/2012
Location: France
Posts: 155
Posted: 02:43am 04 Aug 2015
Copy link to clipboard 
Print this post

  Quote  I think that the MX170 and MX470 have different target markets.

From what I see, the MX470 is a replacement for the Original MaxiMite, whereas the MX170 is an embedded controller.


just a question : is it possible to have a (color) VGA output on a Micromite Plus
ok for the PS2 keyboard but about the VGA ?

Pierre
73s de F1FCO
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10281
Posted: 03:05am 04 Aug 2015
Copy link to clipboard 
Print this post

  Quote   is it possible to have a (color) VGA output on a Micromite Plus


No, not enough SPI ports
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 03:17am 04 Aug 2015
Copy link to clipboard 
Print this post

robert.rozee: Carrier board?
Micromites and Maximites! - Beginning Maximite
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2440
Posted: 03:39am 04 Aug 2015
Copy link to clipboard 
Print this post

  CircuitGizmos said   robert.rozee: Carrier board?


for example grogster's Explore64 board. being smd, an MX470 needs to be soldered down to something to experiment with it, as opposed to a 28-pin SDIP MX170 that can simply be plugged into a solderless breadboard or a socket on a piece of veroboard. for many hobby users the MX470 will only be usable for them when supplied as part of a assembled PCB.

other examples of a carrier board (of sorts) is your CGMICROBOARD2, and the PCB WhiteWizzard sells with a 44-pin MX170 attached.

the MX695 shares the same requirement, for most folks the bare chip is not something they can handle and make use of. it is not a criticism of the MX470/MX695, just the reality of the device package. and unless the chip is attached to the PCB somewhere in china and sold on ebay, the likely cost is going to be $20 or more - compare the cost of a genuine Arduino NANO (around $20 as i recall) with a chinese clone costing $3 or thereabouts (including postage!)


cheers,
rob :-)
Edited by robert.rozee 2015-08-05
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025