For updates to this manual and more details on MMBasic
go to http://geoffg.net/micromite.html
or http://mmbasic.com
This manual is distributed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Australia
license (CC BY-NC-SA 3.0)
Micromite eXtreme Manual Page 2
The Micromite eXtreme is a new addition to the Micromite family using the 64, 100 and 144-pin PIC32 MZ
microcontrollers. The Micromite eXtreme firmware implements all the features of the standard Micromite and
the Micromite Plus as described in the Micromite User Manual and the Micromite Plus Manual. It also has a
number of additional features and they are described in this document.
The focus of this manual is to describe just the features that are unique to the Micromite eXtreme. For general
Micromite programming you should refer to the Micromite User Manual and the Micromite Plus Manual in
addition to this manual.
Appendix A - Sensor Fusion ................................................................................................ 29
Micromite eXtreme Manual Page 3
Introduction
This section provides an introduction for users who are familiar with the Micromite and the Micromite Plus and
need a summary of the extra features in the Micromite eXtreme and Micromite eXtreme64.
The Micromite eXtreme is an extension of the standard Micromite and the Micromite Plus; all features of these
two versions are also in the Micromite eXtreme. This includes features of the BASIC language, input/output,
communications, etc. Some commands have changed slightly (for example the CPU command) but for the main
part Micromite programs will run unchanged on the Micromite eXtreme.
The following summarises the new features in the Micromite eXtreme as compared to the standard Micromite and
the Micromite Plus:
PIC32 MZ Processor
The Micromite eXtreme is based on the Microchip PIC32MZ 32 bit microcontroller. This chip is available in
64, 100 and 144-pin surface mount packages and is up to five times faster and has up to ten times the program
space of the MX series used in the standard Micromite.
High Speed Double Precision Floating Point
The Micromite eXtreme uses the built in hardware floating point capability of the PIC32MZ which is much
faster than floating point on the standard Micromite and uses double precision floating point.
I/O Pins
The 64-pin Micromite eXtreme has 46 free I/O pins with 24 analogue capable. The 100-pin Micromite eXtreme
has up to 71 free I/O pins with 40 analog capable and the 144-pin chip has up to 115 free I/O pins with 50
analogue capable. All analogue pins use a 12-bit analogue to digital conversion rather than 10-bit on the
standard Micromite.
The Micromite eXtreme has two I2C ports, three SPI ports, six PWM channels and up to four serial COM ports.
All serial COM ports are high speed (over 1,000,000 baud).
The Micromite eXtreme64 has one I2C and two SPI ports but is otherwise the same.
High Speed LCD Panels
Like the Micromite Plus the Micromite eXtreme supports ten different sized LCD display panels from 1.44" to
8". In addition it can drive displays using the SSD1963 controller in 16-bit parallel mode to achieve an even
greater display update speed.
VGA Output
The Micromite eXtreme can drive a VGA display in 640 x 480 pixels or 640 x 400 (widescreen) with eight
colours. All the graphics commands and GUI controls available in the Micromite Plus will also work on the
VGA output. This capability is not available on the Micromite eXtreme64.
Mouse Input
The Micromite eXtreme can support a PS2 mouse which can be used to activate on screen GUI controls. This
feature will work with touch sensitive LCD displays (it works in parallel with the touch sensitivity) but it is
especially useful with VGA monitors that do not normally incorporate a touch sensitive surface.
Transparency and BLIT function
On certain LCD display panels or the VGA output the Micromite eXtreme supports transparent text and the
BLIT command. These allow text to be written over a background image or graphic items to be moved over
the background without erasing or damaging the background.
Sound Output
Using the Micromite Plus you can play stereo WAV files stored on the SD card. You can also generate precise
sine waves with selectable frequencies from 1Hz to 20KHz.
Micromite eXtreme Manual Page 4
Micromite Family Summary
The Micromite Family consists of three major types, the standard Micromite, the Micromite Plus and the
Micromite eXtreme. All use the same BASIC interpreter and have the same basic capabilities however they
differ in the number of I/O pins, the amount of memory, the displays that they support and their intended use.
Standard Micromite Comes in a 28-pin or 44-pin package and is designed for small embedded controller
applications and supports small LCD display panels. The 28-pin version is particularly
easy to use as it is easy to solder and can be plugged into a standard 28-pin IC socket.
Micromite Plus This uses a 64-pin and 100-pin TQFP surface mount package and supports a wide
range of touch sensitive LCD display panels from 1.44" to 8" in addition to the
standard features of the Micromite. It is intended as a sophisticated controller with
easy to create on-screen controls such as buttons, switches, etc.
Micromite eXtreme This comes in 64, 100-pin and 144-pin TQFP surface mount packages. The eXtreme
version has all the features of the other two Micromites but is faster and has a larger
memory capacity plus the ability to drive a VGA monitor for a large screen display. It
works as a powerful, self contained computer with its own BASIC interpreter and
instant start-up.
Number of Serial I/O ports 2 2 3 or 4 3 or 4 3 or 4 3 or 4 3 or 4
Number of SPI Channels 1 1 2 2 3 3 2
Number of I2C Channels 1 1 1 +
RTC
1 +
RTC
2 + RTC 2 + RTC 1 +
RTC
Number of 1-Wire I/O pins 19 33 45 77 75 115 46
PWM or Servo Channels 5 5 5 5 6 6 6
Serial Console
USB Console
PS2 Keyboard and LCD
Console
SD Card Interface
Supports ILI9341 LCD
Displays
Supports Ten LCD Panels
from 1.44" to 8" (diameter)
Supports VGA Displays
Micromite eXtreme Manual Page 5
Sound Output (WAV/tones)
Supports PS2 Mouse Input
Floating Point Precision Single Single Single Single Double Double Double
Power Requirements
3.3V
30
3.3V
30mA
3.3V
80mA
3.3V
80mA
3.3V
160mA
3.3V
160mA
3.3V
160mA
mA
Micromite eXtreme Manual Page 6
Suitable Microcontrollers
The microcontroller used in the Micromite eXtreme is the PIC32MZ EF series manufactured by Microchip.
There are two chip sizes (100-pin and 144-pin) with two frequency specifications (200MHz and 252MHz).
The default clock speed of the Micromite eXtreme is 200MHz however this can be changed with a configuration option to 252MHz if required. The firmware will automatically adjust for either the 100 or 144 pin
version.
The chips PIC32MZ2048EFM064-I/PT , PIC32MZ2048EFM100-I/PF and PIC32MZ2048EFM144-I/PL can
also be used at 200MHz. In addition the 0.4mm chips may be used but are harder to solder by hand (PT for
100-pin and PH for 144-pin)
See http://microchip.com for the data sheets.
64-pin Test and Development Board
This board is in development. See http://www.thebackshed.com/forum/forum_posts.asp?TID=9344&PN=1 for
details and updates.
100-pin Test and Development Board
The best development board for the 100-pin 200MHz chip is the SnadPIC MZ, PIC32MZ EF MCU Starter Kit.
This can be ordered with either the PIC32MZ2048EFG100-I/PF or PIC32MZ2048EFH100-I/PF processor
(both are similar, the latter has a CAN facility but that is not supported by MMBasic).
If you are developing your own board it would be worth using the SnadPIC board for guidance.
SnadPIC boards can be purchased from:
This board is a complete module and includes all the connectors for: VGA, TFT, PS2 keyboard, PS2 mouse,
NunChuck, 3.5mm stereo sound, and USB. It has an onboard USB-to-UART (PIC16F1654), and sockets for an
RTC module. It can be used standalone, or can be mounted directly onto the back of a 7" LCD display panel.
Available from http://micromite.org
Micromite eXtreme Manual Page 7
Typical Circuit
An example of the required circuit for a Micromite eXtreme is given below:
Notes:
1. If the USB module is not used, this pin may be connected to VSS.
2. As an option, instead of a hard-wired connection, an inductor (L1) can be substituted between VDD
and AVDD to improve ADC noise rejection. The inductor impedance should be less than 1ohm and the
inductor capacity greater than 10 mA. Alternatively a 10ohm resistor could be substituted for L1.
Typical values for R, R1, and C would be 10Kohm, 1Kohm, and 0.1uF
3. A 24MHz crystal oscillator must be connected to the OSC1 pin. e.g. Epson SG8002DCPHB24MHZ.
See the pinout below for the pin number
Micromite eXtreme Manual Page 8
Programming the Firmware
Programming the 64, 100 and 144-pin Micromite eXtreme is similar to programming the 28-pin standard
Micromite described in the Micromite User Manual.
Refer to the following table for the pin connections to a PICkit 3 programmer:
PICkit
3 Pins
1 MCLR
2 - Vcc Power Supply
3 GND
4 PGD
5 PGC
6 - NC Not used
Notes:
PDD/PGC must be used in matched pairs as aligned vertically in the table
A pullup resistor of 10K is required between MCLR and Vcc.
An oscillator is not required to program these chips and will be ignored if present
The microcontroller being programmed can be powered by the PICkit 3 but it is recommended that a
separate power supply be used. When the PICkit 3 supplies the power pin 2 (Vcc) on the PICkit 3 will
become an output supplying power to the chip being programmed
The Micromite eXtreme (but not the Micromite eXtreme64) can drive a standard VGA monitor by internally
generating the necessary VGA signals (red, green, sync, etc). When a VGA monitor is connected and configured
the VGA output works exactly the same as a connected LCD display panel – this means that all graphics
commands, GUI objects, etc can be used as described in the Micromite and Micromite Plus manuals.
Supports any command/features that use transparency (transparent text and the BLIT command).
Works as the console with 80 characters x 36 lines and will work with the EDIT command
VGA Connections
The connections for the VGA monitor are shown below:
The I/O pins VGA-RED-CLK, VGA-GRN-CLK, VGA-BLU-CLK must be left unconnected.
For the actual pin numbers refer to the pinout tables earlier in this manual.
Note that the diodes must be high speed signal types like the 1N4148 (not general purpose power diodes).
Configuring VGA Output
The command to enable the standard VGA 640 x 480 pixel output is:
OPTION LCDPANEL VGA
and to enable the widescreen format (640 x 400 pixels) the command is:
OPTION LCDPANEL VGA, 16
These commands only need to be run once as the parameters are stored in non volatile memory. Every time the
Micromite is restarted MMBasic will automatically initialise the display ready for use. If the VGA output is no
longer required the command OPTION LCDPANEL DISABLE can be used which will disable the VGA
feature and return the I/O pins for general use.
If the VGA monitor is also to be used as the console the normal command can be used to enable this:
OPTION LCDPANEL CONSOLE
Micromite eXtreme Manual Page 19
Mouse Support
The Micromite eXtreme supports a PS2 mouse which will act like a touch input on an LCD screen (it also
works with the VGA output). MMBasic will automatically display a mouse pointer on the display which is
moved by the mouse. When the left button the mouse is clicked it will act like a touch at the location pointed to
by the cursor. This feature will also work with GUI controls.
Connecting the Mouse
The PS2 mouse uses a 6-pin DIN connector which should be
connected to the Micromite eXtreme as illustrated.
To enable the mouse the command is:
OPTION MOUSE ENABLE
and to disable it:
5V
OPTION MOUSE DISABLE
These commands only need to be run once as the parameters
are stored in non volatile memory. Every time the
Micromite is restarted MMBasic will automatically initialise
the mouse input ready for use.
Cursor Commands
The cursor (ie, mouse pointer) can be turned off/on, its colour can be set and its status can be overridden using
the CURSOR command. It will only work with displays that support transparency. Displays capable of
transparent text are a VGA monitor or any LCD panels that use the ILI9341 controller or an SSD1963
controller. The latter must have the RD pin specified in the OPTION LCDPANEL command. The cursor
command can be used without a mouse to allow, for example, a joystick to move the cursor.
The cursor commands are as follows:
PS2 MOUSE
(front view)
4.7K
6 5
4 3
2 1
4.7K
MOUSE-C LK
MOUSE-D AT
CURSOR ON Enables the display of the cursor (this is the default when
MOUSE is first enabled). If it is used after a previous
CURSOR OFF command it will also restore the previous
position of the cursor.
CURSOR OFF Hides the cursor.
CURSOR X, Y [, LEFT] [, RIGHT] [, MID] Positions the cursor to the screen location X and Y(in pixels)
and sets the left-click (0 or 1) and optionally the right-click
and mid-click status.
CURSOR COLOUR colour Sets the cursor colour (this is a standard 24-bit colour value).
CURSOR COLOR (US spelling) is also valid.
Cursor Functions
CURSOR(x) Returns the current x coordinate (in pixels) of the cursor
CURSOR(y) Returns the current y coordinate (in pixels) of the cursor
CURSOR(left) Returns the current state of the left button
CURSOR(right) Returns the current state of the right button
CURSOR(middle) Returns the current state of the middle button
Micromite eXtreme Manual Page 20
Unique Micromite eXtreme Features
Double Precision Floating Point
The Micromite eXtreme uses the hardware floating point capability of the MZ series of chips and can therefore
process floating point calculations faster than the Micromite and Micromite Plus. All floating point uses double
precision calculations.
Nothing is required to enable this feature, it is automatically available.
Clock Speed Control
MMBasic can work with chips rated for 200MHz or 252MHz operation. By default the firmware will start
running at 200MHz however the 252MHz clock speed can be selected with the command:
OPTION CPU 252
or the speed can be returned to 200MHz with the command:
OPTION CPU 200
These commands change how MMBasic starts up and will cause a restart of the processor. The clock speed is
saved in flash memory so the command only needs to be used once and will be automatically applied on startup.
Note: OPTION CPU 252 must only be used on chips specifically rated for 250Mhz operation. Use of this
command on a 200MHz rated chip will cause MMBasic to stop running. The chip will then need to be
re-programmed with the Micromite eXtreme firmware.
Apart from the increased processing speed the only difference with a chip running at 252MHz is the ability to use
WAV files recorded at 24KHz and 48KHz.
16-bit Interface to SSD1963 Based LCD Displays
The Micromite eXtreme (but not the Micromite eXtreme64) can drive a SSD1963 display using a 16-bit parallel
bus for extra speed. The extra I/O pins for this are listed as SSD1963-DB8 to SSD1963-DB15 on the pinout
tables in this manual and they must be connected to the pins labelled DB8 to DB15 on the I/O connector on the
SSD1963 display.
Note that in this mode the SSD1963 controller runs with a reduce colour range (65 thousand colours) compared to
16 million colours with the normal 8-bit interface.
To select the 16-bit bus the following controller names must be used with the OPTION LCDPANEL command
when configuring the display:
SSD1963_4_16 For a 4.3 inch display
SSD1963_5_16 For a 5 inch display
SSD1963_5A_16 For an alternative version of the 5 inch display if SSD1963_5 does not work
SSD1963_7_16 For a 7 inch display
SSD1963_7A_16 For an alternative version of the 7 inch display if SSD1963_7 does not work.
SSD1963_8_16 For an 8 inch display.
GETSCANLINE Function
The GETSCANLINE() function can be used with displays using the SSD1963 controller to determine the line that
the controller is writing to at that instant. Using this feature it is possible to update the display without causing a
flicker by waiting until the controller is updating another area of the display before changing the graphics on a
particular part of the display. It can be used like this:
If GETSCANLINE() > YCoord + MM.FontHeight THEN TEXT 0, YCoord, …
Two I2C Channels
The Micromite eXtreme (but not the Micromite eXtreme64) supports two I2C channels. The second channel
operates the same as the first, the only difference is that the commands use the notation I2C2 (for example I2C2
OPEN, etc).
Three SPI Channels
The Micromite eXtreme (but not the Micromite eXtreme64) supports three SPI channels. The second and third
channels operate the same as the first, the only difference is that the commands use the notation SPI2 and SPI3
(for example SPI3 WRITE, etc).
Micromite eXtreme Manual Page 21
Note that by default, if the Micromite eXtreme is configured for a SPI based LCD panel, touch or an SD card then
SPI2 will be unavailable to BASIC programs as these functions will use that channel.
Alternate SPI Channel for the SD Card
The SPI channel used for the SD Card (if configured) defaults to the second channel (SPI2) however this can be
changed by appending the SPI channel number to the end of the OPTION SDCARD command this:
OPTION SDCARD CSPIN [,CDPIN] [,WPPIN] [,SPIno]
'SPIno' is the SPI controller to use and can be 1, 2 or 3.
This is particularly useful with the SnadPIC MZ, PIC32MZ EF MCU Starter Kit is as it has the SD Card
hardwired to controller 3. In that case the MMBasic command to configure the SD Card would be:
OPTION SDCARD 81, 59, , 3
Six PWM Channels
The second PWM controller (ie, PWM 2) supports three channels (the other versions of the Micromite only
support two). The command to use all three channels is:
PWM 2, freq, 2A, 2B, 2C
Similarly the SERVO command can also control six channels with the extra channel available on controller 2:
SERVO 2 [, freq], 2A, 2B, 2C
Heartbeat
The heartbeat is an I/O pin which is pulsed off and on at a 1Hz rate. It is normally used to drive a LED to show
that MMBasic is alive and running on the Micromite eXtreme.
The default is for it to be enabled however it can be disabled with:
OPTION HEARTBEAT DISABLE
If necessary it can be re enabled with:
OPTION HEARTBEAT ENABLE
These commands only needs to be run once as the parameters are stored in non volatile memory. Every time
the Micromite is restarted MMBasic will automatically initialise the heartbeat feature.
Extended WAV File Playback
The Micromite eXtreme can play WAV files (like the Micromite Plus) however, if the eXtreme is configured to
run at 252Mhz it is also capable of playing WAV files recorded with sampling rates of 24KHz and 48KHz.
Random Number Generation
The Micromite eXtreme uses the hardware random number generator in the MZ series of chips to deliver true
random numbers. This means that the RANDOMIZE command is no longer needed and is not supported.
MM.DEVICE$
On the Micromite eXtreme the read only variable MM.DEVICE$ will return "Micromite eXtreme".
OPTION VCC command
The Micromite eXtreme supports the OPTION VCC command. This allows the user to precisely set the supply
voltage to the chip and is used in the calculation of voltages when using analog inputs e.g. OPTION VCC 3.15.
The parameter is not saved and should be initialised either on the command line or in a program.
CPU command
The Micromite eXtreme does not support dynamically changing the CPU speed or the sleep function.
Accordingly the commands CPU speed and CPU SLEEP are not available. However the eXtreme does
support “CPU SLEEP time” where time is specified in seconds.
The CPU speed of the Micromite eXtreme can be permanently set to 200MHz or 252MHz using the OPTION
CPU command.
OPTION CONTROLS command
The Micromite eXtreme does not support the OPTION CONTROLS command instead the maximum number of
GUI controls is set to 250.
Micromite eXtreme Manual Page 22
Commands (Micromite eXtreme Only)
Detailed Listing
BOX x1, y1, w, h [, lw] [,c]
[,fill]
All parameters can now be expressed as arrays and the software will plot
the number of boxes as determined by the dimensions of the smallest array.
x1, y1, w, and h must all be arrays or all be single variables /constants
otherwise an error will be generated. lw, c, and fill can be either arrays or
single variables/constants. See the Micromite User manual for full details of
parameter usage.
CAMERA OPEN
CAMERA OPEN FIFO
CAMERA CAPTURE
CAMERA SAVE “filename”
CAMERA REGISTER
register, value
CAMERA CLOSE
CIRCLE x, y, r [,lw] [, a] [,
c] [, fill]
Initialises an OV7670 camera ready for use
Initialises an OV7670 camera with FIFO ready for use
Captures an image from the camera to a connected 800x480 SSD1963 or
480x272 display. NB: the display must be set to 16-bit operation. Also
available for the ILI9341 display on the 64-pin MMX
saves the on-screen image to the SDcard. If the file extension is not
specified then ".BMP" is appended. When a
can be used to change the camera settings see the datasheet for details
disables the camera and frees the allocated pins
ILI9341 only AVAILABLE ON 64-PIN processor
SSD1963 only AVAILABLE ON 144-PIN processor
All parameters can now be expressed as arrays and the software will plot
the number of boxes as determined by the dimensions of the smallest array.
x, y and r must all be arrays or all be single variables /constants otherwise
an error will be generated. lw, a, c, and fill can be either arrays or single
variables/constants. See the Micromite User manual for full details of
parameter usage.
CLOSE [#]nbr [,[#]nbr]
CURSOR ON
CURSOR OFF
.
CURSOR X, Y [, LEFT] [,
RIGHT] [, MID]
CURSOR COLOUR colour
GUI STARTLINE n
Micromite eXtreme Manual Page 23
The text “GPS” can be substituted for [#]nbr to close a communications
port used for a GPS receiver
Enables the display of the cursor (this is the default when MOUSE is first
enabled). If it is used after a previous CURSOR OFF command it will also
restore the previous position of the cursor.
Disables the display
Positions the cursor to the screen location X and Y(in pixels) and optionally
sets the left-click (0 or 1), the right-click and mid-click status.
Sets the cursor colour (this is a standard 24-bit colour value).
CURSOR COLOR (US spelling) is also valid.
Sets the row in the graphics memory which will appear at the top of the
screen (landscape or reverse landscape) or left of the screen (portrait or
reverse portrait) for a 4.3” SSD1963 display initialised with OPTION
LCDPANEL SSD1963_4P [_16]
I2C2 OPEN speed, timeout
[, PU
I2C2 WRITE addr, option,
sendlen, senddata [,sendata
....]
I2C2 READ addr, option,
rcvlen, rcvbuf
I2C2 CLOSE
I2C2 SLAVE OPEN addr,
mask, option, send_int,
rcv_int
I2C2 SLAVE WRITE
sendlen, senddata [,sendata
....]
I2C2 SLAVE READ rcvlen,
rcvbuf, rcvd
I2C2 SLAVE CLOSE
See Appendix B of the Micromite User Manual. Not available on the Micromite eXtreme64
LINE x1, y1, x2, y2 [, LW [,
C]]
All parameters can now be expressed as arrays and the software will plot
the number of boxes as determined by the dimensions of the smallest array.
x1, y1, x2, and y2 must all be arrays or all be single variables /constants
otherwise an error will be generated. lw and c can be either arrays or single
variables/constants. See the Micromite User manual for full details of
parameter usage.
OPEN comspec$ AS GPS
[,timezone_offset]
Will open a serial communications port for reading from a GPS receiver. See
the GPS function for details. The timezone_offset parameter is used to
convert UTC as received from the GPS to the local timezone. If omitted the
timezone will default to UTC. The timezone_offset can be a any number
between -12 and 14 allowing the time to be set correctly even for the
Chatham Islands in New Zealand (UTC +12:45)
OPTION CPU speed MMBasic can work with chips rated for 200MHz or 252MHz operation.
By default the firmware will start running at 200MHz however the 252
MHz clock speed can be selected with the command:
OPTION CPU 252
or the speed can be returned to 200MHz with the command:
OPTION CPU 200
These commands change how MMBasic starts up and will cause a restart of
the processor. The clock speed is saved in flash memory so the command
only needs to be used once and will be automatically applied on startup.
Note: OPTION CPU 252 must only be used on chips specifically rated for 250Mhz operation. Use of this command on a 200MHz rated chip will
cause MMBasic to stop running. The chip will then need to be
re-programmed with the Micromite eXtreme firmware.
Apart from the increased processing speed the only difference with a chip
running at 252MHz is the ability to use WAV files recorded at 24KHz and
48KHz.
OPTION HEARTBEAT
ENABLE
OPTION HEARTBEAT
DISABLE
Micromite eXtreme Manual Page 24
Enables a heartbeat on an I/O pin which is pulsed onand off at a 1Hz rate. It
is normally used to drive a LED to show that MMBasic is alive and running
on the Micromite eXtreme.
Disables the heartbeat
OPTION LCDPANEL VGA
[,16]
Enables output to a VGA display in 640 x 480 pixels or 640 x 400
(widescreen) with eight colours. All the graphics commands and GUI
controls available in the Micromite Plus will also work on the VGA output.
This command only needs to be run once as the parameters are stored in non
volatile memory. When the Micromite is restarted the display will be
automatically initialise ready for use. If the display is no longer required the
command OPTION LCDPANEL DISABLE can be used to disable the
VGA output and return the I/O pins for general use.
Not available on the Micromite eXtreme64
.
OPTION LCDPANEL
SSD1963_n_16
OPTION LCDPANEL
SSD1963_4P
OPTION MOUSE ENABLE
OPTION MOUSE DISABLE
OPTION SDCARD CSPIN
[,CDPIN] [,WPPIN] [,SPIno]
OPTION VCC voltage
Selects 16-bit bus operation of the various SSD1963 displays
Not available on the Micromite eXtreme64
Sets the 4.3” SSD1963 display up in 480 x 864 (landscape or reverse
landscape) or 864x480 (portrait or reverse portrait) pixel mode. The screen
viewport is 480x272 or 272x480 and the position of the viewport is
controlled by GUI STARTLINE n. This mode of operation allows display
updates to be done on a non-visible part of the graphics memory and then the
viewport moved to see the updated image. The 4P display controller is fully
compatible with TOUCH, MOUSE, CURSOR and GUI controls
Enables mouse control of the cursor.
Disables mouse control of the cursor and disables the cursor
These commands only needs to be run once as the parameters are stored in
non volatile memory. Every time the Micromite is restarted MMBasic will
automatically initialise the mouse input ready for use.
The SPI channel used for the SD Card (if configured) defaults to the second
channel (SPI2) however this can be changed by appending the SPI channel
number to the end of the OPTION SDCARD
This allows the user to precisely set the supply voltage to the chip and is used
in the calculation of voltages when using analog inputs. The parameter is not
saved and should be initialised either on the command line or in a program.
PIXEL x, y [,c] All parameters can now be expressed as arrays and the software will plot
PWM 2, freq, 2A, 2B, 2C See description of the PWM command in the Micromite User Manual. This
RBOX x1, y1, w, h [, r] [,c]
[,fill]
SAVE IMAGE "filename" Saves the current display on SSD1963 and ILI9341 TFTs to the SDcard as
SERVO 2 [, freq], 2A, 2B, 2C See description of the SERVO command in the Micromite User Manual.
Micromite eXtreme Manual Page 25
the number of boxes as determined by the dimensions of the smallest array.
x and y must both be arrays or both be single variables /constants otherwise
an error will be generated. c can be either an arrays or single
variable/constant. See the Micromite User manual for full details of
parameter usage.
command allows the specification of a frequency for a third PWM channel
All parameters can now be expressed as arrays and the software will plot
the number of boxes as determined by the dimensions of the smallest array.
x1, y1, w, and h must all be arrays or all be single variables /constants
otherwise an error will be generated. r, c, and fill can be either arrays or
single variables/constants. See the Micromite User manual for full details of
parameter usage.
a .BMP file. The image is full screen 800x480, 480x272, or 320x240 as
appropriate. If the file extension is not specified then ".BMP" is appended
This command allows the specification of a frequency for a third SERVO
channel
SENSORFUSION type ax, ay,
az, gx, gy, gz, mx, my, mz,
pitch, roll, yaw [,p1] [,p2]
Calculates pitch, roll and yaw angles from accelerometer and magnetometer
inputs. Valid fusion types are MAHONY and MADGWICK. Usage is
described in Appendix A
SPI3 OPEN speed, mode, bits
SPI READ nbr, array()
SPI WRITE nbr, data1, data2,
data3, … etc
or
SPI WRITE nbr, string$
or
SPI WRITE nbr, array()
SPI CLOSE
TEXT x, y, string$
[,justification] [, font] [, scale]
[, c] [, bc]
See Appendix D of the Micromite User Manual. Not available on the Micromite eXtreme64
The text orientation can now be specified as part of the justification string
in the TEXT command.
New options are N, U, D, I, V
N which can be omitted means normal text
U means the text writes bottom up
D means the text writes top down
I means the text is inverted
V means the text is in normal orientation but will write top down
The new orientations work properly with the existing justification codes
e.g. text 100,100,”ABC”,ICM
will output ABC inverted with the string centred on 100,100 horizontally
and vertically
TRIANGLE X1, Y1, X2,
Y2, X3, Y3 [, C [, FILL]]
All parameters can now be expressed as arrays and the software will plot
the number of boxes as determined by the dimensions of the smallest array.
x1, y1, x2, y2, x3,and y3 must all be arrays or all be single variables
/constants otherwise an error will be generated c and fill can be either
arrays or single variables/constants. See the Micromite Plus manual for full
details of parameter usage.
Micromite eXtreme Manual Page 26
Functions (Micromite eXtreme Only)
Detailed Listing
BAUDRATE( comm [,
timeout])
CURSOR(x)
CURSOR(y)
CURSOR(left)
CURSOR(right)
CURSOR(middle)
GETSCANLINE() The GETSCANLINE() function can be used with displays using the
GPS(ALTITUDE)
GPS(DATE)
GPS(DOP)
GPS(FIX)
GPS(LATITUDE)
GPS LONGITUDE)
GPS(SATELLITES)
GPS(SPEED)
GPS(TIME)
GPS(TRACK)
GPS(VALID)
Returns the baudrate of any data received on one of the communications
ports (1-4). Samples the port over the period in seconds specified by the
timeout. The timeout defaults to one second if not specified. Returns zero if
no activity on the port within the timeout period.
Returns the current x coordinate (in pixels) of the cursor
Returns the current y coordinate (in pixels) of the cursor
Returns the current state of the left button (0 or 1)
Returns the current state of the right button (0 or 1)
Returns the current state of the middle button (0 or 1)
SSD1963 controller to determine the line that the controller is writing to at
that instant. Using this feature it is possible to update the display without
causing a flicker by waiting until the controller is updating another area of
the display before changing the graphics on a particular part of the display.
returns current altitude if sentence GGA enabled
returns the normal date string corrected for local time e.g. “12-01-2017”
returns DOP (dilution of precision) value if sentence GGA enabled
returns 0=no fix, 1=fix, etc. if sentence GGA enabled
returns the latitude in degrees as a floating point number, values are –ve for
South of equator
returns the longitude in degrees as a floating point number, values are –ve
for West of the meridian
returns number of satellites in view if sentence GGA enabled
returns the ground speed in knots as a floating point number
returns the normal time string corrected for local time e.g. “12:09:33”
returns the track over the ground (degrees true) as a floating point number
returns: 0=invalid data, 1=valid data. ALWAYS CHECK THIS VALUE
TO ENSURE DATA IS VALID BEFORE USING OTHER GPS()
FUNCTION CALLS
Micromite eXtreme Manual Page 27
MM.DEVICE$ Returns “Micromite eXtreme”
SPI3(n) See Appendix D of the Micromite User Manual
Micromite eXtreme Manual Page 28
Appendix A – 1-Wire Communications
Sensor Fusion
The Micromite eXtreme supports the calculation of pitch, roll and yaw angles from accelerometer and
magnetometer inputs.
For information on this technology see https://github.com/kriswiner/MPU-6050/wiki/Affordable-9-DoF-
Sensor-Fusion
The SENSORFUSION command supports both the MADGWICK and MAHONY fusion algorithms. The
format of the command is:
SENSORFUSION type ax, ay, az, gx, gy, gz, mx, my, mz, pitch, roll, yaw [,p1] [,p2]
Type can be MAHONY or MADGWICK
Ax, ay, and az are the accelerations in the three directions and should be specified in units of standard
gravitational acceleration.
Gx, gy, and gz are the instantaneous values of rotational speed which should be specified in radians per
second.
Mx, my, and mz are the magnetic fields in the three directions and should be specified in nano-Tesla (nT)
Care must be taken to ensure that the x, y and z components are consistent between the three inputs. So , for
example, using the MPU-9250 the correct input will be ax, ay,az, gx, gy, gz, my, mx, -mz based on the reading
from the sensor.
Pitch, roll and yaw should be floating point variables and will contain the outputs from the sensor fusion.
The SENSORFUSION routine will automatically measure the time between consecutive calls and will use this
in its internal calculations.
The Madwick algorithm takes an optional parameter p1. This is used as beta in the calculation. It defaults to 0.5
if not specified
The Mahony algorithm takes two optional parameters p1, and p2. These are used as Kp and Ki in the
calculation. If not specified these default to 10.0 and 0.0 respectively.
A fully worked example of using the code is given on the BackShed forum at