Advertisement

Quick Links

Micromite Plus
Manual
MMBasic Ver 5.4
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)

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Plus and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Micromite Plus

  • Page 1 Micromite Plus Manual MMBasic Ver 5.4 For updates to this manual and more details on MMBasic go to http://geoffg.net/micromite.html http://mmbasic.com This manual is distributed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Australia license (CC BY-NC-SA 3.0)
  • Page 2: Table Of Contents

    Manual. It also has many 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 Plus. For general Micromite programming you should refer to the Micromite User Manual in addition to this manual.
  • Page 3: Introduction

    I/O Pins The 64-pin Micromite Plus has up to 45 free I/O pins and the 100-pin chip 77. Of these 28 pins (on either chip) can be analog inputs.
  • Page 4 Additional LCD Panel Features The Micromite Plus includes six fonts that are built in and provides for up to ten additional fonts that can be embedded in the program. It also provides a set of read only variables to return the coordinates of the next print position on the screen.
  • Page 5 Supports 2.2", 2.4" and 2.8" SPI LCD Displays   Supports eleven LCD Displays from 1.4" to 8"     Supports Resistive Touch Panels Power Requirements 3.3V 30 mA 3.3V 30 mA 3.3V 80 mA 3.3V 80 mA Micromite Plus Manual Page 5...
  • Page 6: Suitable Microcontrollers

    The microcontroller used in the Micromite Plus is available in two different frequency specifications (100MHz and 120MHz). The Micromite Plus will start up at 100MHz and if you have a 120MHz chip you can use the CPU command to step up to 120MHz. See http://microchip.com...
  • Page 7: Micromite Plus Connections

    The tick column ANA means ANALOG, DIG means digital I/O and 5V means a 5 V tolerant pin. Pins marked SSD1963 xxx are required for a SSD1963 based display - see the "Micromite Advanced Features" manual for more details. Otherwise the notation is similar as described for the 28-pin version.
  • Page 8 100-pin Micromite Plus   F5  DIGITAL INPUT ONLY   F4    D15   D14  USB +5V POWER (+2.3 to +3.6V) POWER (+2.3 to +3.6V) USB D- GROUND   44 USB D+  ...
  • Page 9: Programming The Firmware

    Programming the Firmware Programming the 64 and 100-pin Micromite Plus 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...
  • Page 10: Spi Based Lcd Displays

    SPI Based LCD Displays The Micromite Plus includes support for three types of colour LCD display panels using a SPI interface. These are the:  Standard 2.2”, 2.4" and 2.8” 240x320 pixel display with an ILI9341 controller as described in the Micromite User Manual.
  • Page 11 L, P, RL or RP. The R prefix indicates the reverse or "upside down" orientation. 'C/D pin' and 'reset pin' are the Micromite I/O pins to be used for these functions. Any free pin can be used. Micromite Plus Manual...
  • Page 12 CS pin on the LCD display wired permanently to ground. If the touch controller is used this pin must then be specified and connected to a Micromite I/O pin. To test the display you can enter the command GUI TEST LCDPANEL. You should see an animated display of colour circles being rapidly drawn on top of each other.
  • Page 13: Ssd1963 Based Lcd Displays

    SSD1963 Based LCD Displays In addition to the SPI based controllers the Micromite Plus also supports colour LCD displays using the SSD1963 controller. These use a parallel interface, are available in sizes from 4.3" to 8" and have better specifications than the smaller displays.
  • Page 14 SD card features are optional but if they are used they will use the second SPI port (SPI2). The following table lists the connections required between the display board and the Micromite Plus to support the SSD1963 interface and the LCD display. The touch controller and SD card interfaces are listed further below.
  • Page 15 3.3V. If this is not done the pin will float causing the wrong controller to respond to commands on the SPI bus. On the Micromite Plus the second SPI channel (SPI2) is used to communicate with the touch controller and the SD Card interface.
  • Page 16 In some circumstances it may be necessary to interrupt power to the LCD panel while the Micromite is running (eg, to save battery power) and in that case the GUI RESET LCDPANEL command can be used to reinitialise the display.
  • Page 17: Touch Support

    S6104 Note that most I/O pins on the Micromite Plus are capable of driving 15mA (pins 50, 44 and 6 on the 64-pin chip can drive 30mA). However many buzzers require more that this so a transistor might be necessary to buffer the Micromite Plus output and drive the buzzer.
  • Page 18 100ms produces a short beep. Touch Interrupts On the Micromite Plus the GUI INTERRUPT command is used to setup a touch interrupt. The syntax is: GUI INTERRUPT down [, up] Where 'down' is the subroutine to call when a touch down has been detected. And optionally 'up' is the subroutine to call when the touch has been lifted from the screen ('up' and 'down' can point to the same subroutine if required).
  • Page 19: Sd Card Support

    'CD-pin' is optional and is the I/O pin number that will be used to connect to the card detect pin on the SD card connector. The Micromite will provide a weak pullup on this pin which is normally pulled high but, when a card is inserted, it will be connected to ground and the signal line pulled low.
  • Page 20 So, to enable the SD Card on this module the command is: OPTION SDCARD 14, 18 Note that on the 100-pin Micromite Plus pin 18 is used for driving a SSD1963 based LCD panel and will conflict with its allocation as Card Detect. In this case the zero ohm resistor J3 on the underside of the SnadPIC board must be removed so that SD Card Detect is no longer on pin 18.
  • Page 21 XModem Transfer In addition to the standard method of XModem transfer which copies to or from the program memory the Micromite Plus can also copy to and from a file on the SD card. The syntax is: XMODEM SEND, filename$ XMODEM RECEIVE, filename$ Where ‘filename$’...
  • Page 22 OPEN "numbers.txt" FOR OUTPUT AS #1 LINE INPUT #1, a$ LINE INPUT #1, b$ CLOSE #1 x = VAL(a$) : y = VAL(b$) Following this the variable x would have the value 123 and y the value 56789. Micromite Plus Manual Page 22...
  • Page 23 Random access can also be used on a normal text file. For example, this will print out a file backwards: OPEN "file.txt" FOR RANDOM AS #1 FOR i = LOF(#1) TO 1 STEP -1 SEEK #1, i PRINT INPUT$(1, #1); NEXT i CLOSE #1 Micromite Plus Manual Page 23...
  • Page 24: Sound Output

    Sound Output The Micromite Plus can play stereo WAV files located on the SD card or generate precise sine waves using the PLAY command. The sound is played on the PWM 2 outputs as a stereo signal with the left channel on the PWM 2A pin and the right on PWM 2B.
  • Page 25 PLAY command leaves the PWM signal running even if it is paused and not being modulated. This normally will not affect the normal running of the Micromite but if you want to turn it off (for example, when entering sleep) you can use this command.
  • Page 26: Basic Drawing Features

    SSD1963 controller colours are displayed using the full 24-bit colour range (16 million colours). Fonts The Micromite Plus has six built in fonts plus it can use embedded fonts to a maximum of 16 fonts. The built in fonts are:...
  • Page 27 In the Micromite Plus you can also specify a third character to indicate the rotation of the text. This character can be one of: N for normal orientation V for vertical text with each character under the previous running from top to bottom.
  • Page 28 As previously described in the "SD Card Support" section the LOAD IMAGE command can be used to load a bitmap image from the SD card and display it on the LCD display. This can be used to draw a logo or add an ornate background to the graphics drawn on the display. Micromite Plus Manual Page 28...
  • Page 29: Advanced Graphics

    Advanced Graphics The Micromite Plus incorporates a suite of advanced graphic controls that respond to touch, these include on screen switches, buttons, indicator lights, keyboard, etc. MMBasic will draw the control and animate it (ie, a switch will depress when touched). All that the BASIC program needs to do is invoke a single line command to specify the basic details of the control.
  • Page 30 This will draw a box with rounded corners. When the box is touched a numeric keypad will appear on the screen. Using this virtual keypad any number can be entered into the box including a floating point number in exponential format. The new number will replace the number previously in the box. Micromite Plus Manual Page 30...
  • Page 31 For a LED it will cause the LED to be illuminated or turned off. It can also be used to set the initial value of spin boxes, text boxes, etc. For example: CTRLVAL(#10) = 12.4 Micromite Plus Manual Page 31...
  • Page 32 60 or less. This is done when the Enter key is touched to exit the number pad: SUB MM.KEYPRESS ref AS INTEGER, caption AS STRING IF ref = MyNumberBox AND caption = "Ent" THEN IF VAL(CtrlVal(r)) > 60 THEN CtrlVal(r) = "60" ENDIF END SUB Micromite Plus Manual Page 32...
  • Page 33 MsgBox() function. The message has two lines and the box has two buttons for retry and cancel. On Error Skip Open "file.txt" For Input As #1 If MM.ErrNo <> 0 Then if MsgBox("Error~Opening file.txt", "RETRY",CANCEL") = 2 Then Exit Sub EndIf Loop While MM.ErrNo <> 0  Micromite Plus Manual Page 33...
  • Page 34: Advanced Graphics Programming Techniques

    Advanced Graphics Programming Techniques When programming using the advance GUI commands implemented on the Micromite Plus there are a few hints and techniques that make it easier to develop and maintain your program. The Main Program Is Still Running It is important to realise that your main BASIC program is still running while the user is interacting with the GUI controls.
  • Page 35 SUB IntTouchDown SELECT CASE TOUCH(REF) CASE ButtonRef GUI FCOLOUR RGB(RED), ButtonRef END SELECT END SUB SUB IntTouchUp SELECT CASE TOUCH(LASTREF) CASE ButtonRef GUI FCOLOUR RGB(WHITE), ButtonRef END SELECT END SUB Micromite Plus Manual Page 35...
  • Page 36 But this is not a good idea because the Micromite Plus cannot do anything else while your program is running in the interrupt and sending a message could take many milliseconds.
  • Page 37 DO : LOOP SUB TouchDownInterrupt IF TOUCH(REF) = 1 THEN BOX 400, 250, 300, 200, , RGB(128,128,128), RGB(0,0,128) END SUB SUB TouchUpInterrupt IF TOUCH(LASTREF) = 1 THEN BOX 400, 250, 300, 200, , RGB(WHITE), RGB(BLUE) END SUB Micromite Plus Manual Page 37...
  • Page 38: Console Input/Output

    See the heading "Typical Circuit" towards the start of this manual for details of the USB connections. There is nothing that you need to do on the Micromite Plus to use the USB console. Just plug the USB cable from the Micromite Plus into your host computer and MMBasic will automatically create a virtual serial port over USB so that you can communicate with it from a Windows, Linux or Macintosh computer using nothing more than the USB port.
  • Page 39 To disable using the LCD panel as the console the command is OPTION LCDPANEL NOCONSOLE. Used with a PS2 keyboard this option turns the Micromite Plus into a self contained computer with its own keyboard and display. Rather like a modern version of the Maximite (see http://geoffg.net/maximite.html).
  • Page 40: Miscellaneous Features

    (COM4). All serial ports on the Micromite Plus can operate at high speed (up to 1M baud) at any CPU speed and support the INV, OC and S2 options. In addition COM1 supports the DE and 9BIT options (for RS485) as described in the Micromite User Manual.
  • Page 41: Examples

    You should see a rapid sequence of circles being drawn. Press the space bar to terminate the test. Next, connect a pizeo buzzer from pin 50 of the Micromite Plus to ground (pin 50 has a 30mA drive capability and this should be enough to operate most pizeo buzzers). This will be used be used to generate a click sound when controls are touched, it is optional but the audible feedback makes using the advanced controls more intuitive.
  • Page 42 !! Keyboard and LCD Console If you want to use the Micromite Plus and the SSD1963 display panel as a stand alone computer you can connect a keyboard and send the console output to the LCD panel.
  • Page 43 Select Case Touch(REF) ' find out the control touched Case cb_enabled ' the enable check box If CtrlVal(cb_enabled) Then GUI ENABLE c_fname, tb_fname, c_log, cb_flow, cb_alarm, cb_warn Else GUI Disable c_fname, tb_fname, c_log, cb_flow, cb_alarm, cb_warn EndIf Micromite Plus Manual Page 43...
  • Page 44 ' interrupt routine when the touch is removed Sub TouchUp Select Case Touch(LASTREF) ' use the last reference Case pb_test ' was it the test button CtrlVal(led_alarm) = 0 ' turn off the LED End Select End Sub Micromite Plus Manual Page 44...
  • Page 45: Read Only Variables (Extra For The Micromite Plus Only)

    Read Only Variables (extra for the Micromite Plus Only) Detailed Listing MM.HPOS The current horizontal and vertical position (in pixels) following the last graphics or print command. MM.VPOS MM.ERRNO Is set to the error number if a statement involving the SD card fails or zero if the operation succeeds.
  • Page 46: Commands (Extra For The Micromite Plus Only)

     All other arguments are in pixels.  The display must use the ILI9341 controller or the SSD1963 controller with the RD (read) pin connected (or VGA on the Micromite eXtreme). BLIT x1, y1, x2, y2, w, h Copy one section of the display screen to another part of the display.
  • Page 47 BColour can be -1 which means that the background will show through the gaps in the characters. FColour and 'BColour' are optional and default to the colours set by the COLOUR command. Micromite Plus Manual Page 47...
  • Page 48 It is also used to surround a group of radio buttons and MMBasic will arrange for the radio buttons surrounded by the frame to be exclusive. ie, when one radio button is selected any other button that was selected and within the frame Micromite Plus Manual Page 48...
  • Page 49 MMBasic will try to position the virtual keypad on the screen so as to not obscure the number box that caused it to appear. A pen down interrupt will be Micromite Plus Manual Page 49...
  • Page 50 ' FColour and 'BColour' are RGB values for the foreground and background colours. 'width', 'height', FColour and 'BColour' are optional and default to that used in previous controls. 'Step' sets the amount to increment/decrement the number with each touch. Micromite Plus Manual Page 50...
  • Page 51 Same as the normal INPUT command except that the input is read from a file list of variables previously opened for INPUT as ‘#fnbr’. See the OPEN command. KILL file$ Deletes the file specified by ‘file$’. If there is an extension it must be specified. Micromite Plus Manual Page 51...
  • Page 52 The default is ABORT. Note that this entry only relates to errors reading from or writing to the SD ON ERROR card. See the command in the Micromite User Manual for handling syntax and other program errors. Micromite Plus Manual Page 52...
  • Page 53 ILI9341, ST7735 and ILI9163 based panels: 'C/D pin' and 'reset pin' are the Micromite I/O pins to be used for these functions. Any free pin can be used. 'CS pin' can also be any I/O pin but is optional. If a touch controller is not used this parameter can be left off the command and the CS pin on the LCD display wired permanently to ground.
  • Page 54 SD card connector. The Micromite will provide a weak pullup on this pin which is switched to ground when a card is inserted. If this signal is not provided the Micromite Plus will need to be restarted if the SD card was changed.
  • Page 55 Will position the read/write pointer in a file that has been opened on the SD card for RANDOM access to the 'pos' byte. The first byte in a file is numbered one so SEEK #5,1 will position the read/write pointer to the start of the file. Micromite Plus Manual Page 55...
  • Page 56 Y2 and X3, Y3. 'C' is the colour of the triangle and defaults to the current foreground colour. 'FILL' is the fill colour and defaults to no fill (it can also be set to -1 for no fill). Micromite Plus Manual Page 56...
  • Page 57: Functions (Extra For The Micromite Plus Only)

    Functions (extra for the Micromite Plus Only) Detailed Listing CTRLVAL(#ref) Returns the current value of an advanced control. '#ref' is the control's reference (a number from 1 to 100). For controls like check boxes or switches it will be the number one (true) indicating that the control has been selected by the user or zero (false) if not.
  • Page 58 This function is only available on displays that use the ILI9341 controller or an SSD1963 controller. The latter must have the RD pin specified in the OPTION LCDPANEL command. On the Micromite eXtreme the VGA output also supports this function (see the Micromite eXtreme Manual).

Table of Contents