Over the past two months we introduced the Maximite, a tiny microcomputer that can turn its hand to many things, from teaching programming to controlling your greenhouse. In this final article we provide an introduction to the BASIC language running on the Maximite and show you how to use this tiny marvel for measurement and control.

Part 3 - by Geoff Graham

Fig.1: when you turn on the Maximite you are greeted with the prompt (>). You can try out the language simply by typing in a command and it will be executed immediately. This example shows the result of running the PRINT command with the argument of 1÷7.

Before you start, it would be worth downloading >the “Maximite User Manual” from the SILICON CHIP website. The following description will give you a summary of the device but the user manual is the ultimate reference.

We suggest too that as you go through this article, if programming is new to you, that you try out each of the examples to get the feel of them.

If your Maximite is completed and ready to go, you can of course use it – but if not, you can get a version of BASIC which will load and run on your personal computer. It should even be available as a free download on the net.

The Maximite has a lot of capability built into a small package. The core component is the PIC32 microcontroller which in addition to running a powerful BASIC interpreter handles the video, keyboard, SD card, USB and sound.

A few bits of BASIC

The Maximite runs the BASIC language (BASIC is an acronym for Beginner’s All-purpose Symbolic Instruction Code), a very common programming language used in many computer systems. There are quite a few versions of BASIC but that used by the Maximite is fairly close to the original.

However, because it does have a couple of minor differences, we’ve called it MMBASIC. Oh, come on now . . . MaxiMite BASIC, OK?

Fig.2: the input protection for the PIC32 consists of two reverse-biased diodes. These are
adequate for most tasks
but will not protect
against a high-voltage
input.

When you first turn on the Maximite you are presented with a prompt as shown in Fig.1. At this point you can type in a command and try it out. This is one of the reasons that MMBASIC is so easy to learn. Almost any command can be entered in this way and you can instantly see what it does. For example:

> PRINT 1/7

0.142857

>

The PRINT command will evaluate whatever is on its command line and display the result. In this case it evaluated the result of dividing 1 by 7 and printed the result, just like a pocket calculator.

PRINT is one of the most commonly used commands in the MMBASIC language and it comes in handy when you are experimenting with expressions and functions.

If you prefix the line with a number MMBASIC will save that line in memory along with any other lines prefixed with a line number.

You can then run the program with the RUN command. For example, type in the following: