MMIDE is a great way to test out some of the functions of the CGMMSTICK or CGCOLORMAX. MMIDE runs without an installation program, as long as the “MMIDE Libs” directory and its contents are located in the same directory on your PC as the “MMIDE.exe” file.
When you run MMIDE it looks for all of the serial ports on the PC and lists them as available ports in the dropdown box “Select MM port.” On my machine this happens to be the second port that is found and it is called “COM8.” On your PC it is likely to be different.
Note: MMIDE is an evolving program. Features are added. Since the initial release the program has been improved to support the CGCOLORMAX. Many of the screen captures here look different from the current version of MMIDE which at the time of this writing is MMIDE 3.0d.
MMIDE 2.0+ works with the CGMMSTICK just fine. That version can still be used with the CGMMSTICK. MMIDE 3.0+ was updated for the CGCOLORMAX. The CGMMSTICK can also be used with the 3.0+ version – the extra features supporting the CGCOLORMAX will not function on the CGMMSTICK.
The CGCOLORMAX has twice as many I/O lines as the CGMMSTICK and the Direct I/O page in the program was updated to support that.
The newest MMIDE is available for free: MMIDE3
MMIDE interactive “MMBasic” page.
If you select the port associated with the CGMMSTICK/CGCOLORMAX, then the text area on the MMIDE MMBasic page will show the message that MMBasic prints when it connects. This is the MMBasic version and the copyright message from Geoff Graham.
The MMIDE MMBasic page acts as a serial terminal to the CGMMSTICK/CGCOLORMAX. You can type in and run a BASIC program in the text area as well as view the PRINTed messages from MMBasic.
There are six buttons on the MMIDE MMBasic page that assist in development of MMBasic programs.
The “Run” button runs whatever program is currently in memory on the CGMMSTICK or CGCOLORMAX. This button simply automatically types “run” followed by a carriage return (enter key) into the text window.
The “Stop” button stops whatever program is currently running on the CGMMSTICK/CGCOLORMAX. This button simply automatically types Control-C into the text window.
The “CLEAR SCROLLBACK” button erases the text area. It does not issue a CLS to MMBasic.
The “Load file immediately to MM” button lets you select a BASIC file from your PC and send it to the CGMMSTICK/CGCOLORMAX. It essentially types the program into the text window as if you were typing it. MMBasic has to be ready for it – in other words connected and NOT running a program.
The “Save current program in MM to file” copies whatever program is currently in the CGMMSTICK or CGCOLORMAX by running the LIST command, capturing that listing, and saving that to a file.
The MMBasic window will let you type directly into the command interpreter. You can type something like:
PRINT 2 + 2
Then after the last ‘2’ on the line when you hit the enter key the interpreter immediately returns the result of that command. Note that the ‘>’ is placed at the beginning of the line when the interpreter is ready for input. The examples in this book show input and output without that prompt character.
MMBasic with prompts.
This is the result of the immediate command to print 2+2. The example in this text does not show the ‘>’ prompt.
Print 2 + 2
4
Apparently 2+2 is still 4.
You can do the same thing by making the command to print the results of 2+2 into a short program with line numbers and then running the program. This is what that would look like in the window:
10 REM Is 2+2 = 4?
20 Print 2+2
RUN
4
Since line numbers are not necessary (only a few examples in this book use them) you can also enter a program without line numbers using ‘auto’:
Auto
rem 2+2 once again
print 2+2
run
4
list
Rem 2+2 once again
Print 2+2
The short program is run and the result is still 4. The program was then listed to see what it looks like without line numbers.
MMIDE Utility page. Read information from MMBAsic and transfer files.
The MMIDE Utility page has a “Set MM Time/Date” button that gets the current time and date from the PC, and uses specific MMBasic commands to set the time and date on the CGMMSTICK. This works when MMBasic is ready to accept commands – not when a program is running.
The info area also has a button that grabs some information from the CGMMSTICK/CGCOLORMAX. It gets the date, time, firmware version, current drive, current file name (if there is one set), the horizontal resolution, and the vertical resolution.
The MMIDE Utility page also allows for the transfer of a file to and from the A: and B: drives. A radio button lets you select between the A: drive and the B: drive. The A: drive is internal to the microcontroller chip on the CGMMSTICK/CGCOLORMAX, and the B: drive is the micro SD card.
The “List Files” button will list the files that are on either the A: or B: drives.
The “Copy file to MM Drive” button will use the MMBasic XMODEM support to copy a file from your PC to the selected drive. This file can be an MMBasic program, or a data file.
The “Save from MM Drive” button will request the file that you’ve typed into the “Save file name” box from the CGMMSTICK or CGCOLORMAX using XMODEM and save that file to the PC.
MMIDE’s very helpful “Direct I/O” page.
The MMIDE Direct I/O page has a significant number of tools to assist in CGMMSTICK/CGCOLORMAX hardware and software development. These Applets send immediate commands to the hardware behind the scenes. Some of the routines transfer a small program that then runs on the CGMMSTICK/CGCOLORMAX hardware.
MMIDE allows direct control of each I/O pin.
Highlighted above is the area of the page that lets all of the CGMMSTICK/CGCOLORMAX pins be manually read or written. Along the left edge in black text is the pin number as MMBasic would see them. The I/O pins number from 1-20 from the perspective of a MMBasic program. In green text a little to the right is the physical pin on the J1 header of the CGMMSTICK/CGCOLORMAX.
The drop-down box lets you select the pin function allowed for that pin. This follows the pin functions that the MMBasic SETPIN command uses. Some of the pins can be set differently than others. Some pins can be set to analog input, while other can not, for example.
When a pin is set to output, the square button will toggle the state of the pin. When the pin is set to a type of input (digital, analog, frequency) the square button reads that pin and displays the pin value in the text box next to that pin. There is also a square color box that will change color to yellow for an analog input, red for a digital high, and black for a digital low.
MMIDE can read the firmware jumper and control the LED. The MMIDE Direct I/O page has a button (in the highlight above) called “ CGMMSTICK LED” that when pressed will toggle the green LED on the CGMMSTICK/CGCOLORMAX.
Also highlighted is a button that reads the state of the firmware jumper. The firmware jumper is J3 on the CGMMSTICK/CGCOLORMAX circuit board. When the jumper is in place, the color of the box next to the “Firmware Jumper” is red. When the jumper is not in place, reading the state by pressing the button will turn that box black.
The remainder of the page is broken up into areas called “Applets.” These can be useful for learning about the functions of the CGMMSTICK without writing any MMBasic code. They can also be used to test hardware before any code is written.
For example the “Ode to Joy” applet will play a short tune out the audio port of the CGMMSTICK/CGCOLORMAX. Just punch the “Play” button and you can verify your audio connection without writing any code.
There are applets for blinking LEDs, for connecting to an LCD, for SPI communication, for reading analog values, and for serial communications.
The applets are described in more detail later in this document.
MMIDE lists the CGMMSTICK I/O lines.
The MMIDE CGMMSTICK page shows an image of the CGMMSTICK to assist in identifying the pin connections to the 30 pins for J1. Clicking on a row in the table highlights the associated pin in the picture.
Leave a Reply