Monday, January 30, 2012

Maximite Input Example

Simple input is pretty simple to test using MMIDE. All of the 20 pins of the CGMMSTICK1 can be set to be digital inputs. To test a simple button input, just use this testing facility.

All 20 of the CGMMSTICK1 lines can be controlled for testing.

CGMMSTICK1 button input.

A simple button input for the CGMMSTICK1 would use a 10 kilo ohm resistor to pull the input line (in this case MMBasic pin 20) high, then the button press would short the line low.

Testing the input.


With the right pin set to “Digital Input” both states of the button can be tested using MMIDE to do the work. In the picture above the red square and value of 1 indicate that the button is not pushed – the resistor is pulling the input line high.


Purchase a CGMMSTICK1

Download of Maximite Integrated Development Environment: MMIDE

Maximite Sound Example

The Maximite can make sound using the 'SOUND' command. The SOUND command accepts a frequency to play for the sound and a duration to play that sound.

MMIDE has an Applet that plays Ode to Joy.

On the CGMMSTICK1 the audio connection is NOT on J1 along with all of the port lines. Instead it is at the top of the board on an unpopulated header named J5.

On J5 the top connection is ground, the bottom (square) hole is the audio line.

If you have a small amplifier, you can connect the amp to these two lines and run the Ode to Joy Applet that is in MMIDE.

CGMMSTICK1 audio connection.
Using the Ode to Joy Applet in MMIDE to play a tune.


The Ode to Joy Applet downloads a MMBasic program to the CGMMSTICK1 and then runs that program. Below is the program that is sent. You might notice that there is a test for data where the frequency could be 0. If the frequency is 0 no note is played, just a delay.

I asked my 15 year old son to write this program. He used a frequency/note chart to get the frequencies right, but the notes for Ode to Joy were in his head – he didn't have to look them up.

His frequency table was a little bit different than the table that I reproduced after the program below.

10 FOR a=1 TO 65
20 READ fr,du
30 IF fr=0 THEN
40 PAUSE du
50 ELSE
60 SOUND fr,du
70 ENDIF
80 PAUSE du
90 PAUSE 30
100 NEXT a
110 DATA 493.88,300,493.88,300
120 DATA 523.25,300,587.33,300
130 DATA 587.33,300,523.25,300
140 DATA 493.88,300,440.00,300
150 DATA 392.00,300,392.00,300
160 DATA 440.00,300,493.88,300
170 DATA 493.88,450,440.00,200
180 DATA 440.00,300
190 DATA 0,200
200 DATA 493.88,300,493.88,300
210 DATA 523.25,300,587.33,300
220 DATA 587.33,300,523.25,300
230 DATA 493.88,300,440.00,300
240 DATA 392.00,300,392.00,300
250 DATA 440.00,300,493.88,300
260 DATA 440.00,450,392.00,200
270 DATA 392.00,300
280 DATA 0,200
290 DATA 440.00,300,440.00,300
300 DATA 493.88,300,392.00,300
310 DATA 440.00,300,493.88,150
320 DATA 523.25,150,493.88,300
330 DATA 392.00,300,440.00,300
340 DATA 493.88,150,523.25,150
350 DATA 493.88,300,440.00,300
360 DATA 392.00,300,440.00,300
370 DATA 293.66,550
380 DATA 0,200
390 DATA 493.88,300,493.88,300
400 DATA 523.25,300,587.33,300
410 DATA 587.33,300,523.25,300
420 DATA 493.88,300,440.00,300
430 DATA 392.00,300,392.00,300
440 DATA 440.00,300,493.88,300
450 DATA 440.00,450,392.00,200
460 DATA 392.00,300



Note/Frequency Table for SOUND command
Note Frequency
C 16.4
C sharp / D flat 17.3
D 18.4
D sharp / E flat 19.5
E 20.6
F 21.8
F sharp / G flat 23.1
G 24.5
G sharp / A flat 26
A 27.5
A sharp / B flat 29.1
B 30.9
C 32.7
C sharp / D flat 34.7
D 36.7
D sharp / E flat 38.9
E 41.2
F 43.7
F sharp / G flat 46.3
G 49
G sharp / A flat 51.9
A 55
A sharp / B flat 58.3
B 61.7
C 65.4
C sharp / D flat 69.3
D 73.4
D sharp / E flat 77.8
E 82.4
F 87.3
F sharp / G flat 92.5
G 98
G sharp / A flat 104
A 110
A sharp / B flat 117
B 123
C 131
C sharp / D flat 139
D 147
D sharp / E flat 156
E 165
F 175
F sharp / G flat 185
G 196
G sharp / A flat 208
A 220
A sharp / B flat 233
B 247
C 262
C sharp / D flat 277
D 294
D sharp / E flat 311
E 330
F 349
F sharp / G flat 370
G 392
G sharp / A flat 415
A 440
A sharp / B flat 466
B 494
C 523
C sharp / D flat 554
D 587
D sharp / E flat 622
E 659
F 698
F sharp / G flat 740
G 784
G sharp / A flat 831
A 880
A sharp / B flat 932
B 988
C 1047
C sharp / D flat 1109
D 1175
D sharp / E flat 1245
E 1319
F 1397
F sharp / G flat 1480
G 1568
G sharp / A flat 1661
A 1760
A sharp / B flat 1865
B 1976
C 2093
C sharp / D flat 2217
D 2349
D sharp / E flat 2489
E 2637
F 2794
F sharp / G flat 2960
G 3136
G sharp / A flat 3322
A 3520
A sharp / B flat 3729
B 3951





Purchase a CGMMSTICK1

Download of Maximite Integrated Development Environment: MMIDE

Maximite LED Control Example

Using MMIDE it is pretty easy to set up a large group of pins to drive LEDs. The “Scroll LEDs Applet” on the Direct I/O page of MMIDE groups all 20 lines into two groups of 10. The groups can be scrolled separately.

Behind the scenes the applet code sets all of the lines to be outputs. It then lights the LEDs one by one from left to right. Then the applet turns the LEDs off one by one from right to left.

Using the MMIDE Scroll LEDS Applet to test a group of LEDs.

Solderless breadboard setup for demonstration.

The ten LEDs are contained in a single package. Plugged into the solderless breadboard you can see that they connect on one side to pins 21-30 of J1 which means that they are controlled by MMBasic commands as pins 11-20. Current-limiting resistors (330 ohm) tie the LEDs to ground.

Setting those 10 lines to output and then turning each line on and off will turn each LED on and off.

60% power remaining on warp drive.

The Scroll LEDs Applet will light the LEDs from left to right when the “11-20” button is pressed.

Setting the applet aside, you can write a MMBasic program to control these LEDs, too. This example code will light and extinguish the LEDs randomly.

Using MMIDE to enter some code to control the LEDs

Code can be entered to the CGMMSTICK1 using the MMBasic page of MMIDE. The following code will flash the LEDs randomly.

10 For a = 11 To 20
20 SetPin a, 8
30 Next a
40 a = 11 + Fix(Rnd(0) * 10)
50 b = 11 + Fix(Rnd(0) * 10)
60 Pin(a) = 1
70 Pin(b) = 0
80 Pause 50
90 GoTo 40

MMBasic lines 10, 20, and 30 loop to set the I/O pins 11-20 to output.

MMBasic line 40 establishes a random pin to turn on. Rnd(0) generates a random value between 0 and 1 that is multiplied by 10 to get a random number between 1 and 10. “Fix” cleans up the number by removing the fraction. The number is offset by 11 to finally be a random number between 11 and 20 for pins 11-20.

MMBasic line 50 does the same thing for a random line to turn off.

60 and 70 turn off and on these lines respectively. MMBasic line 80 pauses for a twentieth of a second before line 90 forces the whole thing to repeat.

When run, the program turns the 10 LEDs on and off randomly.



Purchase a CGMMSTICK1

Download of Maximite Integrated Development Environment: MMIDE

Maximite Hardware Interface Example

Using the CGMMSTICK1 might be very familiar or easy to understand for you, or you might be very new to all of this. Don't worry about the first examples here if you are new to all of this. This document does assume that you have some hobbyist-level familiarity with electronics and also familiarity with the BASIC language. However, by the end of this document, you should be familiar enough with the workings of the CGMMSTICK1 to feel confident that you will be able to program and utilize the CGMMSTICK1.

Before getting into greater detail on the Maximite hardware, software, and the workings of the CGMMSTICK1, I'd like to whet your appetite for the Maximite with a simple example.

Misc interfacing using the prototype for the CGMMSTICK1. The prototype pictured here was used for a lot of the initial CGMMSTICK1 testing.

It is easy to plug the CGMMSTICK1 into a white solderless breadboard and connect a USB cable to a PC to control the Maximite. This example demonstrates connecting an LED to one of the interface lines of the CGMMSTICK1.

This introductory example uses a program that runs on PC/Linux/Mac as an aid to CGMMSTICK1 project development. The MMIDE program uses the serial port that is created when you connect the CGMMSTICK1 to your computer. MMIDE can be used as a terminal, as a way to transfer files, and to assist in hardware/software development.

CGMMSTICK1 mounted in positions 1-30 of the author's solderless breadboard.

The picture shows a solderless breadboard that is set up with the CGMMSTICK1. The CGMMSTICK1 is plugged in to the solderless breadboard so that the numbered pins correspond to the numbers on the long connector. The 20 input/output lines of the CGMMSTICK1 are the connections on the right side. Ground, 3.3 volt, and 5 volt connections are some of the remaining pins on the right.

The electrical hardware used for this very simple example is a single LED and 330 ohm resistor. One CGMMSTICK1 output line is connected to the LED, and the resistor connects the other end of the LED to ground.

LED connected between I/O line #20 and a resistor (330 ohm) that goes to ground.

The picture shows the solderless breadboard with the LED example circuit. The I/O pin chosen was pin 20, the connection farthest to the right on the CGMMSTICK1. The breadboard is set up so that ground runs along the blue bus bar.

MMIDE - Select serial port and then click the Direct I/O page.

Normally your developed BASIC code would be run to turn this LED on and off. But before doing that, the MMIDE development tool can be used to verify the LED circuit. Run MMIDE and select the appropriate serial port for the CGMMSTICK1. Select the page tab to select the Direct I/O page.

Use the Blink LED Applet to test the LED that you have connected.

On the Direct I/O page you can see a little application called the “Blink LED Applet”. There are only two things to do to run this applet. First you select the I/O port connected to the LED. The little applet defaults to I/O pin #1, but can be changed to any of the 20 I/O pins.

In this example the I/O port used for the LED is port #20. Port #1 is the default when you first run the program, just select “20” from the drop-down menu.

After you have selected the port, press the “Blink” button. Your LED should start blinking. If it doesn't, recheck your circuit. One common problem is a reversed LED – just flip it around.

If you press the “Blink” button a second time, the LED blinking will cease. MMIDE sends commands directly to the CGMMSTICK1 in order to make this little applet work. The applet sets the port line to be an output port, and then sends commands to turn that line on and off over and over. When done, make sure that you turn the blinking LED off.

I'll mention again here that you might have wired up the LED circuit and could be clicking along with these instructions if you already have the CGMMSTICK1 and drivers installed, or you might just be reading along to see what this version of a Maximite can do. The setup/installation process will be talked about in more detail later.

So you've just tethered the CGMMSTICK1 to your computer, added a simple LED circuit to it, and controlled that LED with MMIDE. But now what? Isn't the little Maximite supposed to be the brains, not a big old computer running MMIDE? It is. And to make it the brains, all you have to add is some BASIC code that you write and then run on the CGMMSTICK1.

LED blinking BASIC program

If you return to the MMIDE page tab that says “MMBasic” you will be connected to the Maximite in a mode where you can type in your BASIC programs. This BASIC program in this example will do essentially the same thing as the MMIDE Applet did. Here is the program for you to enter:

10 SETPIN 20, 8
20 PIN(20) = 1
30 PAUSE 200
40 PIN(20) = 0
50 PAUSE 200
60 GOTO 20

You can run the program by entering the command “RUN” or you can click the green Run button. If you have entered the program correctly, the LED should be blinking while the program is running.

You can stop the blinking by typing Control-C or by clicking the red Stop button in MMIDE.

You can look up the commands in the program to see in detail what the program does at each step. In short, the program does about the same thing that the MMIDE “Blink LED Applet” does. The BASIC program sets the line (20) to be an output line, turns the line on, waits a little, turns the line off, waits a little, and then repeats.

This program can be saved to memory on the CGMMSTICK1 to be run again later. It can even be made to run automatically when the CGMMSTICK1 is powered up, so you would then have a fancy and overly sophisticated LED blinker. This fancy and overly sophisticated LED blinker has given you a good taste of what the CGMMSTICK1 Maximite can do.




Purchase a CGMMSTICK1

Download of Maximite Integrated Development Environment: MMIDE

Sunday, January 29, 2012

CGMMSTICK1 I/O Characteristics

Typical Digital Output Electrical Characteristics

Output Low Voltage: 0.0 to 0.4V

Output High Voltage: 2.4 to 3.3V

Maximum current draw/sink on any I/O pin: 25mA

Maximum cumulative current draw/sink for all I/O pins: 200mA (150mA derated)

Maximum voltage for 5V tolerant open collector pins: 5.5V

Typical Digital Input Electrical Characteristics

Maximum input voltage, normal pins: 3.6V

Maximum voltage for 5V tolerant input pins: 5.5V

Voltage range for a logic low input: 0.0 to 0.66V

Voltage range for a logic high input: 2.64 to 3.3V

Voltage range for a logic low input – 5V tolerant inputs: 2.64 to 5.5V

Analog input voltage range: 0.0 to 3.3V


Purchase a CGMMSTICK1

Download of Maximite Integrated Development Environment: MMIDE

CGMMSTICK1 Technical information

CGSIMMSTICK1 connection information

The power select jumper nearest to the USB jack (left one if you hold the board so that you can read the silk-screen text) connects 5V USB to the 3.3V regulator to power the microcontroller.

The right jumper connects the 5V line on the 30-pin row to the 3.3V regulator so that the solderless breadboard can power the microcontroller.

Both in place puts 5V USB onto the J1 30-pin connector.



5 is audio out - square pad is signal, round is ground.

J4 is video select. Open is VGA. insert a wire link for composite.

J3 with a header in place is firmware reload.

J8 and J9 are PIC32 programming headers.

D1 – Green “Firmware” LED.

D2 – Blue SD card access LED.


Purchase a CGMMSTICK1

Download of Maximite Integrated Development Environment: MMIDE

CGMMSTICK1 J1 Pinout



J1 Pinout
J1 Pin Function Analog Digital In Freq In Period In Count In Digital Out Open Collector 5V Tolerant Additional Function
1 Reg 3.3V

















2 Video1

















3 Video2

















4 NC

















5 VSYNC

















6 KBDDATA

















7 +5V

















8 KBDCLK

















9 GROUND

















10 HSYNC

















11 I/O 1 Analog In Digital In





Digital Out





12 I/O 2 Analog In Digital In





Digital Out





13 I/O 3 Analog In Digital In





Digital Out





14 I/O 4 Analog In Digital In





Digital Out





15 I/O 5 Analog In Digital In





Digital Out





16 I/O 6 Analog In Digital In





Digital Out





17 I/O 7 Analog In Digital In





Digital Out





18 I/O 8 Analog In Digital In





Digital Out





19 I/O 9 Analog In Digital In





Digital Out





20 I/O 10 Analog In Digital In





Digital Out





21 I/O 11

Digital In Freq In Period In Count In Digital Out Open Collector 5V Tolerant

22 I/O 12

Digital In Freq In Period In Count In Digital Out Open Collector 5V Tolerant

23 I/O 13

Digital In Freq In Period In Count In Digital Out Open Collector 5V Tolerant

24 I/O 14

Digital In Freq In Period In Count In Digital Out Open Collector 5V Tolerant

25 I/O 15

Digital In





Digital Out Open Collector 5V Tolerant Serial 1 Receive
26 I/O 16

Digital In





Digital Out Open Collector 5V Tolerant Serial 1 Transmit
27 I/O 17

Digital In





Digital Out Open Collector 5V Tolerant Serial 1 RTS
28 I/O 18

Digital In





Digital Out Open Collector 5V Tolerant Serial 1 CTS
29 I/O 19

Digital In





Digital Out Open Collector 5V Tolerant Serial 2 Receive
30 I/O 20

Digital In





Digital Out Open Collector 5V Tolerant Serial 2 Transmit


Purchase a CGMMSTICK1

 Download of Maximite Integrated Development Environment: MMIDE