Silicon ChipThe Maximite Computer, Pt.1 - March 2011 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Power factor correction gizmos do not save power
  4. Feature: Microchip’s New PIC32 Microcontroller by Geoff Graham
  5. Feature: Community TV Station TVS by Barrie Smith
  6. Project: The Maximite Computer, Pt.1 by Geoff Graham
  7. Project: Universal Voltage Regulator Board by Nicholas Vinen
  8. Project: Mains Moderator: Stepping Down The Volts by Leo Simpson
  9. Salvage It! – A Vacuum Pump From Junk by Neno Stojadinovic
  10. Project: 12V 20-120W Solar Panel Simulator by John Clarke
  11. Project: Microphone To Neck Loop Coupler For Hearing Aids by John Clarke
  12. Review: The Atten ADS1102CA Digital Storage Oscilloscope by Mauro Grassi
  13. Vintage Radio: The STC A5150 5-valve mantel clock radio by Rodney Champness
  14. Book Store
  15. Advertising Index
  16. Outer Back Cover

This is only a preview of the March 2011 issue of Silicon Chip.

You can view 35 of the 112 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "The Maximite Computer, Pt.1":
  • Maximite PCB [06103111] (AUD $15.00)
  • PIC32MX695F512H-80I/PT programmed for the Maximite/miniMaximite (V2.7) (Programmed Microcontroller, AUD $30.00)
  • CP2102-based USB/TTL serial converter with 5-pin header and 30cm jumper cable (Component, AUD $5.00)
  • MaxiMite Firmware v4.1, documentation, libraries, sample software, serial port driver and sprint/font editor (Free)
  • MaxiMite Microcomputer PCB pattern (PDF download) [06103111] (Free)
Articles in this series:
  • The Maximite Computer, Pt.1 (March 2011)
  • The Maximite Computer, Pt.1 (March 2011)
  • The Maximite Computer, Pt.2 (April 2011)
  • The Maximite Computer, Pt.2 (April 2011)
  • The Maximite Computer, Pt.3 (May 2011)
  • The Maximite Computer, Pt.3 (May 2011)
Items relevant to "Universal Voltage Regulator Board":
  • Universal Voltage Regulator PCB [18103111] (AUD $5.00)
  • Universal Voltage Regulator PCB pattern (PDF download) [18103111] (Free)
Items relevant to "Mains Moderator: Stepping Down The Volts":
  • Mains Moderator lid panel artwork and warning label (PDF download) (Free)
Items relevant to "12V 20-120W Solar Panel Simulator":
  • 12V 20-120W Solar Panel Simulator PCB [04103111] (AUD $10.00)
  • Solar Panel Simulator PCB pattern (PDF download) [04103111] (Free)
Items relevant to "Microphone To Neck Loop Coupler For Hearing Aids":
  • Hearing Loop Receiver/Neck Loop Coupler PCB [01209101] (AUD $10.00)
  • Hearing Loop Receiver/Neck Loop Coupler PCB pattern (PDF download) [01209101] (Free)
  • Hearing Loop Neck Loop Coupler panel artwork (PDF download) (Free)

Purchase a printed copy of this issue for $10.00.

Presenting: The Maximite Part 1 – by Geoff Graham There’s on often-quoted cliché in advertising which says “its use is limited only by your imagination . . .” Well, here is a project that goes way beyond your imagination because you, like us, will have only scratched the surface of uses. We’re pretty proud of this one: a powerful but very economical microcomputer which has so much potential that you will probably think of uses we haven’t even dreamed of! R emember the very early days of personal computers when the most common answer to “but what can it do?” was “oh, it can store recipes and track you household finances”. It was pretty lame back then, especially when personal computers cost up to ten thousand dollars. But The Maximite can do that. Or it can detect intruders. Or measure 30  Silicon Chip voltages. Or sense water levels. Or log phone numbers. Or teach children computers and programming. Or . . . OK, you get the picture, we’re sure. Of course, that’s only half the story. It can also act on those inputs and do something, such as turn on lights or video recorders. Irrigate a field or greenhouse. Dial a phone number and play a message. Control a website. Launch a first-strike nuclear missile. . . If you think we’re being a bit over the top, we are. However, the simple truth is, with appropriate programming (and what better way to learn than with the Maximite!) this powerful little micro CAN do all of those things and just about anything else you can think of. We’re extremely confident that the Maximite will spawn its own army siliconchip.com.au Inside The Maximite case. There’s not a great deal to it as all of the “smarts” is in that PIC32 chip in the centre. Also seen in this shot is the memory card slot on the front panel which can be used to drive The Maximite or to save data. of users and supporters, along with Maximite software, simply because it is so versatile and so simple to build. Best of all, it’s cheap to build – almost bubble-gum cheap! So what is the Maximite? Elsewhere in this issue we described the incredible new Microchip PIC32 processor. . . and now we put it to practical use. It is the heart of the Maximite – a complete computer based on a single chip. On the one hand it is a full-featured micro computer with keyboard input and a video output with extensive graphics capabilities to a TV or VGA monitor. It runs a powerful BASIC interpreter and can save and load programs and data to and from a low-cost SD memory card. At the same time Processor: it has 20 I/O (input/ Clock speed: output) lines that can RAM: be a mix of analog inSoftware: puts or digital input/ I/O outputs. Video output: You can measure Audio: voltages, temperaInterfaces: tures, frequency and Power supply: record the data to the Size & weight: SD card, all under program control. You can also detect switch or contact closure and respond by activating relays, turning on lights or whatever. You can connect it to a larger computer via USB and upload or download programs and data. You can also pop the SD card out and read the data on your desktop computer where you can load it into a spreadsheet such as Excel for further analysis. The Maximite will automatically load and run programs from the SD card so you can use it as a stand-alone computer without keyboard or video display. But, if you do connect a video display, you can display readings, draw graphs or do whatever you need to do to display data for your application. Finally, all inputs and outputs are optional. You can ignore the external monitoring and control function and use it as a general purpose computer to balance your cheque book (or similar) or you could ignore the keyboard and video facilities and use it as a dedicated embedded computer or controller. Putting it to use On one level you can consider the Maximite to be a modern incarnation of the Tandy TRS-80 or Commodore 64 computers of yesterday. Using it like this The Maximite will take you on a nostalgic trip into the days where computers were much simpler. You just plug the Maximite into a 9V power source and you will be immediately presented with the BASIC interpreter’s prompt. You can then experiPIC32MX795F512H-80I/PT (or PIC32MX695F512H-80I/PT) ment with various 80MHz commands or type in 128K (internal) a program and save MMBasic (similar to Microsoft BASIC) it to the SD memory 20, individually configurable card. Monochrome standard VGA or composite video The BASIC lan500mV for amplifier, sound card, etc, or hi-z speaker guage, which is an SD, MMC or SDHC card; USB 2.0 and IBM keyboard acronym for Begin9V DC <at> ~150mA ner’s All-purpose 155 x 92 x 29mm; 150g Symbolic Instruc- At a glance . . . siliconchip.com.au March 2011  31 From the rear (again with lid removed) this shot shows the VGA and keyboard sockets, multi-way I/O connector (black) and at the right, the USB and DC power sockets. tion Code, is a standard in the computer industry and was designed to be very easy to learn. So this provides an excellent way to get into programming. Maximite BASIC is also largely compatible with Microsoft BASIC so there are many programs on the Internet that you can load and run (some may possibly need a few modifications but that’s not too unusual with downloaded programs!). While being easy to use, Maximite BASIC is also very powerful. It uses floating point for numbers, has long variable names, extensive string handling, file input/output and multidimensional arrays of numbers and strings. With its 128KB of RAM the interpreter can handle programs of up to 1000 lines and thanks to the fast PIC32 chip it will run through your program at speeds up to 30,000 lines per second. If all this sounds like double-Dutch to you, then you are a perfect Maximite candidate. Build one and learn! Apart from this, the great strength of the Maximite is its ability to interact with the external world. On the back panel are 20 input/output signal lines which can be used to monitor and control most things with electrical inputs and outputs. The Maximite could form the centre of an intelligent burglar alarm, a flexible oven controller or a data logging system 32  Silicon Chip monitoring the operation of your car’s engine. It could control the climate in a greenhouse by opening panels and turning on fans and irrigation systems in response to temperature, humidity and sunlight. Because it is so inexpensive the Maximite can be used for quite simple projects – for example, a smart battery charger/monitor or simply controlling a fan or pump. At this level it can be thought of as something like a PICAXE chip on steroids. Back to the Maximite: by attaching a few external components, students can also interact with physical objects beyond the keyboard and video display. For example, it would be easy for a student to connect up a temperature sensor and a fan and write a simple program to turn on the fan at a certain temperature. Just imagine: light a match under the sensor. . . and the fan would come on and blow out the match! Magic? No. Maximite! Educational tool The video interface on the Maximite will generate either a standard computer VGA signal or a composite video signal for use with a TV set. The VGA connector is mounted on the PC board and is available on the back panel of the Maximite’s box while the composite video is available as a pair of header pins that can be wired to a panel mounting RCA socket. The VGA output uses the standard scanning frequencies of 31.5kHz horizontal and 60Hz vertical and should work with any monitor, no matter how old. The output is scaled for a 4:3 aspect ratio and most people will have an old one of these monitors lying unloved in a cupboard since whiz-bang LCD monitors came out (it will also display on an LCD monitor!). The character set The Maximite will also make a great educational tool. Its simplicity and ease of use make it ideal for young students who need to get something happening within a short time. They can plug it in and within seconds be experimenting with a programming language. And with SD card storage they can then take their creation away to be continued on another day. Old timers who did indeed “cut their teeth” on the TRS-80 and Commodore 64 etc, will remember with horror the power failures which lost perhaps days of programming because then, there was no such thing as “easy” storage. Floppy disks (what are they?) were around but incredibly expensive and hard disks were still only a twinkle in their creator’s eyes! Video output siliconchip.com.au REG1(IC2) 7805 D2 1N4004 S1 CON1 + -- GND 330 F EXT POWER 9-15V DC EXT OUT IN K A PWR SOURCE JP1 REG2 (IC3) LM1117T–3.3 OUT IN USB 10 F 16V GND 47 F 6V +5V CON2 1 2 3 4 19 AVdd USB TYPE B 35 34 36 37 56 ICSP CONNECTOR 1 10 26 38 57 Vdd Vdd VddVdd VddVdd Vdd Vusb SDO2A Vbus OC3 D– SS2A D+ 7 PGD 5 PGC 47 16 6 47 CON3 47 PROGRAMMING HEADER LED1 +5V PS2 KEYBOARD A 15 58 61 A OC2 K K RC14 RC13 5 54 2 1 KEYBOARD DATA RB9 RB7 IC1 PIC32MX795F 512H-80 I/PT OR PIC32MX695F 512H-80 I/PT RD6 RB6 RB5 RB4 RE7 RE5 RD7 RE4 +3.3V RE3 3x 33k RD3 SD CARD SOCKET CARD PRESENT CD 52 9 1 2 3 4 5 6 7 8 WP CON9 CARD ENABLE RD11 RD10 RD4 RD9 RD8 RE0 53 2011 RB13 RB12 RB11 RB10 OSC1 RD5 OSC2 Vss 9 SC  RB15 60 SDO3A DATA 32 TO CARD CLOCK TO CARD SCK3A 29 DATA FROM CARD SDI3A 31 CARD WRITE PROTECT 49 AUDIO OUT 48 1k Vss 20 Vss 25 I/O 5 22 I/O 4 18 I/O 3 17 I/O 2 13 I/O 1 CON8 1 12 +5V I/O 20 2 3 4 5 6 +3.3V 3 I/O 19 7 8 2 I/O 18 9 10 11 12 1 I/O 17 64 I/O 16 13 14 63 I/O 15 15 16 62 I/O 14 17 45 I/O 13 19 20 44 I/O 12 21 22 23 24 43 I/O 11 42 I/O 10 30 I/O 9 28 I/O 8 27 I/O 7 24 I/O 6 25 18 26 23 39 X1 8MHz 7805 40 Vss 41 MAXIMITE MICROCOMPUTER Fig.1: we said The Maximite was pretty simple and this complete circuit diagram proves it. Just about everything you need in a microcomputer is integrated into the one mighty chip, the PIC32 (see article elsewhere in this issue). siliconchip.com.au 14 15 RE0 RE6 55 13 CON6 5.6k JP2 3 4 12 VERTICAL SYNC VIDEO SELECT RE2 ACTIVITY KEYBOARD CLOCK 11 K 59 PGEC1 CON7 6 8 PGED1 LED2  SD CARD  D1 1N4148 CON5 A 1k MCLR S2 4 680 6 50 COMPOSITE VIDEO HORIZONTAL SYNC RF1 LOAD FIRMWARE 3 VIDEO Vcap 10k 2 120 100nF MCLR 6 1 7 2 8 3 9 4 10 5 4 x 100nF +3.3V +3.3V 10 F 16V CON4 10 100nF +3.3V VGA CONNECTOR (FRONT VIEW) 22pF 22pF LEDS GND IN K A D1 A K K OUT LM1117T 1 IC1 D2 A GND OUT GND OUT IN March 2011  33 CON4 VGA CONNECTOR (IC1) SDO2A OC3 SS2A RC14 120 6 A 50 1k 8 48 D1 1N4148 K JP2 VIDEO SELECT 6 1 7 2 8 3 9 4 10 5 11 12 13 (IC1) SDO2A OC3 SS2A VIDEO 6 50 15 RC14 1k 48 CON5 COMPOSITE VIDEO OUT H/V SYNC 8 14 120 680 120 * JP2 VIDEO SELECT * IN PLACE OF D1 HORIZ SYNC RF1 59 VERT SYNC RF1 Fig.2a: you have the choice of displaying the Maximite’s output on a standard VGA computer monitor (we’re sure you’ll have one lying about), or . . . includes the full upper and lowercase set with 80 characters per line and 36 lines per screen. The composite video output is a standard 625-line, 50Hz signal suitable for use on any TV set or monitor that will accept a PAL input (ie, any TV set used in Australia, New Zealand, the UK and many other parts of the world). It also has the full character set but displays 50 characters per line with 18 lines per screen. A jumper on the PC board will switch between VGA and composite. This jumper is detected at power up and the timing of the video system is configured accordingly. You could, if you wished, use a switch to select the type of display at power up. Both outputs are monochrome and have graphics capability. Under control of your BASIC program you can turn on and off any pixel, draw lines, circles, and boxes, and place text anywhere on the screen. Note that because the Maximite’s pixels are not exactly square the circle will be more of an oval. There are many cheap VGA and composite monitors now available (especially on eBay) with screen sizes of 5 to 7 inches. These are intended for use in cars but they also make an excellent display when you are using the Maximite as an embedded controller. For example, if you have built an intelligent irrigation controller based on the Maximite you could include a screen that would show a graph of the rainfall, temperatures and the amount of irrigation delivered. The remarkable aspect of the video signal is that it is generated entirely in the PIC32 using nothing but the standard peripherals integrated inside the chip. The method used is based on a technique described by Lucio Di Jasio in his book “Programming 32 bit 34  Silicon Chip microcontrollers in C”. It uses a DMA (Direct Memory Access) controller to transfer the pixel data from memory to an SPI (Serial Peripheral Interface) controller which then clocks out the video with the required timing. The output is sharp and rock solid: you could not get better even if you were using a dedicated VGA controller. Other than servicing an interrupt this method entirely bypasses the PIC32 CPU which only has to write the pixel data to a defined part of memory and it will then magically appear on the video monitor. This leaves the CPU free to run at full speed interpreting the user’s BASIC program. Keyboard and USB The keyboard interface is quite straightforward. You can plug in a standard IBM PS2 compatible keyboard with a 6-pin MINI DIN connector and anything you will type will go straight to the BASIC interpreter. All the standard keys will work including the numeric keypad, shift and caps lock. The USB interface emulates a serial COM connection over USB. This means that you can open a serial emulator on 59 . . . Fig.2b: or even using an old TV set with composite video input (most TVs do). Millions of these are thrown out every year as people update! your computer and anything you type will be received by the Maximite, just as if it was typed on the keyboard. Both USB and the keyboard will operate simultaneously and in parallel. This allows you to have both of them connected and anything typed on either one will be received as if from a single stream. Similarly, any output from the BASIC interpreter will be sent out over the USB interface as well as the video interface, although graphic output (lines, circles etc) will only be displayed on the video output. You can plug in or unplug the keyboard, video and USB at any time and it will not affect a running program. The USB interface provides an easy way to enter and run programs without having to connect a monitor. Using this interface you can even edit your program on your PC (using something like notepad) then copy it via the USB interface into the Maximite’s memory for testing. The USB interface is handy in another couple of cases. Firstly, it makes it possible to build a stand alone controller (such as the irrigation controller This not only reminds us that The Maximite uses a standard (IBM-style) keyboard, it also shows us just how tiny The Maximite is in comparison! siliconchip.com.au proposed earlier) and using the USB interface you can plug in a laptop and download history or other data from the BASIC program running on the Maximite. Secondly, the USB interface allows the Maximite to act as a peripheral to a desktop computer running Windows or a similar operating system. A simple program running on the Maximite could measure a series of voltage and digital inputs and send the values over the USB interface. A program running on the larger computer would see a series of readings and could interpret them and take action as required. The communication could also be two way, certain codes arriving from the USB interface could be a signal to the program running on the Maximite to change the state of its digital outputs. This allows you to easily control external electrical systems from a desktop computer, something normally not easy to do. The USB interface also has one more function. It will enable you to update or “re-flash” the firmware running on the PIC32 by uploading the new firmware from your Windows computer. With something as complex as the Maximite there are bound to be some undiscovered bugs lurking in there and this feature will allow you to load the latest and greatest firmware version, even though your chip is firmly soldered to the PC board. Maximite BASIC Arguably the core of the Maximite is the BASIC interpreter (called MMBasic) which was specially written for the Maximite. It is a full implementation of the BASIC language with over 120 commands, functions and operators. Because of its size we can only provide a brief overview here however the SILICON CHIP website has the “Maximite User Manual” available for download and that provides much more detail. All numbers within MMBasic are saved and manipulated as floating point values. Floating point is similar to how a scientific calculator handles numbers and allows you to multiply, divide and use mathematical functions without accidently creating nonsense results. MMBasic is also proficient at handling strings of characters which you can join and pull apart in various ways. Variables in MMBasic can be either a number or a string and a variable name siliconchip.com.au MMBasic, specially written for the Maximite, should be familiar to anyone who has ever used used BASIC as it is a full implementation of that language. can be up to 32 characters long. You can also define arrays of numbers and strings with up to eight dimensions. In addition to the Microsoft BASIC constructs MMBasic implements a number of modern programming structures documented in the ANSI Standard for Full BASIC (X3.113-1987). These include the DO WHILE … LOOP and the structured IF .. THEN … ELSE … ENDIF statements. These newer constructs make it easier to write programs that have fewer bugs and are easier for others to understand. MMBasic has a number of special commands and functions for dealing with the external I/O pins on the Maximite. Using the SETPIN command you can set an input as an analog (ie, voltage) input, as a counting input or as a digital input/output. The PIN() function will return the value of an input and the PIN()= statement will set an output. For example, the following fragment of code will set an output (eg, an alarm) high if an input voltage strays outside of the range of 2V ±0.5V. SETPIN 1, 1 ‘ pin 1 is input SETPIN 2, 8 ‘ pin 2 is output V = PIN(1) ‘ get the voltage IF V < 1.5 OR V > 2.5 THEN PIN(2) = 1 ‘ output high ENDIF The apostrophe (‘) starts a comment and everything after it on that line is ignored. You can also set up to 20 interrupts on either the rising or falling edge of a signal at the input pins. When an interrupt event occurs the program will branch to a section of code specific to that interrupt and return to the main program when finished. This makes it much easier to handle intermittent events such as when a button has been pressed. For timing you can set an interrupt to occur every so many milliseconds, you can also time events using the TIMER function which returns the number of milliseconds since it was reset and for general timing you can halt the program’s execution for a number of milliseconds using the PAUSE command. MMBasic runs at about 30,000 lines per second, although that will vary considerably depending on the type of statements being executed. Regardless it allows your programs to respond quickly to external events, typically in less than a millisecond. This means that you can monitor and react to most electrical and mechanical events, such as ignition pulses in a high speed engine and still get useful work done. External input/output We have touched on the external input/output capabilities a number of times but it is worth going into some detail as that is where much of the Maximite’s utility comes from. Firstly all 20 external input/output pins can be configured as digital inputs or outputs. As a digital input anything above 2.5V will return true (or the number 1) and anything below 0.65V will return false (number 0). The maximum input voltage is 3.3V but to handle voltages higher than that, a couple of resistors are all that is required to drop the voltage. All inputs are Schmitt Trigger buffered so that they will switch cleanly if the input voltage is in the range between the high and low input levels. When configured as an output, a pin will source or sink 10mA to 18mA, depending on the required drive voltage on the output pin. This is enough to drive a LED or a reed relay and heavier loads via a transistor buffer. In future we will describe a circuit for this and other aspects of input/output buffering. Pins 11 to 20 have the special capaMarch 2011  35 50 times a second, while still doing other work like scaling the data and checking for alarms. And, with a cheap 2GB SD card, you will be able to sustain that speed for over 100 hours before you run out of space; not bad at all. When power is applied to the Maximite the first thing it will do is check to see if an SD card is installed and, if it is, look for a program in the root directory with the special name of AUTORUN.BAS. If that file is found it will be loaded and the program will be automatically run without prompting from the keyboard (which does not have to be connected). This allows the Maximite to be used as an embedded controller without an attached keyboard or video display. Prototyping with The Maximite is a breeze! All I/O pins are brought out to a multi-way connector on the rear panel. Standard patch leads can therefore be used. Added to that is the ease of connection to a standard PC and voila! bility of working with 5V circuits. They will tolerate 5V as an input and can be configured as open collector outputs to drive 5V circuits. Pins 1 to 10 can be configured as analog inputs and will measure and return the precise voltage at the input in the range of 0V to 3.3V. For inputs higher than this a simple voltage divider can be used. The accuracy of the measurement is mostly dependent on the accuracy of the 3.3V supply to the PIC32 but the specified regulator has a tolerance of ±1% so it will be reasonably accurate. By calibrating the reading within your BASIC program you can achieve an accuracy far better than that. This is like having a ten-channel digital voltmeter and with the addition of suitable input circuitry, these inputs and be used to measure voltage, current, temperature, acceleration, pressure and more. The firmware also implements a simple form of noise reduction when making voltage measurements. Ten readings are taken (over 10µs) and the two highest and lowest readings are discarded before averaging the remaining six readings to give the final value. In addition to being normal digital inputs pins 11 to 14 can be configured to measure frequency, period or just count the number of cycles of the input. Frequency measurement can be up to 200kHz and the returned value will have a resolution of 1Hz. When measuring period, the value 36  Silicon Chip will be returned as the number of milliseconds between cycles. When set as a counting input, the value returned will be the number of low to high transitions on the input since the counter was last reset. The counting inputs can react to very fast signals on their input (less than 10ns) and operate independently of the main program (ie, they do not slow it down or hinder its operation). Memory card The memory card facility allows you to save programs and data and reload them later. MMBasic will work with MMC, SD or SDHC cards formatted as FAT16 or FAT32 and with a capacity of up to the maximum that you can buy (which is currently 32GB). The file system and file format is fully compatible with Windows, Macintosh and Linux computers so you can pop the card into your desktop computer to access the data recorded on it. Commands within MMBasic allow you to create or delete files, navigate through sub directories, save programs and load and run a program. When saving data to an SD card the WRITE command makes it easy to save the data in an Excel spreadsheet compatible format for later analysis. Typically the Maximite can measure a voltage and save the value to the SD card in under a millisecond. In a real life scenario that means that you should be able to log data from all 10 analog inputs and save it to the SD card Audio The Maximite also has the facility to generate an audio output. This is not a musical facility but it is enough to generate a sequence of attention getting tones. The sound output is made available on a 2-pin header on the PC board which can be wired to a panel mounting connector. The sound command in MMBasic generates a square wave and, under program control, you can specify the frequency (from 20Hz to 5KHz) and the duration (in milliseconds). The tone is generated as a background task and will not delay the program which will continue running after initiating the sound. Low power requirements The power supply for the Maximite can come from the USB interface or an external 9V DC plugpack. With some restrictions (due to heat dissipation) the power supply voltage can range up to 15V. This means that the Maximite can also be powered from a car battery in automotive applications, for example, monitoring and logging data related to the vehicle’s engine and sensors. The current draw is about 140mA but this will increase if you are using the digital outputs to source current. With this operating current it is possible to power the Maximite from batteries during a power interruption. For example, six AA rechargeable batteries could keep the Maximite running for 7 to 10 hours; enough to survive a typical blackout. Circuit details The circuit diagram of the Maximite siliconchip.com.au is shown in Fig.1. The amazing thing about this is that everything we have been discussing, the VGA controller, keyboard input, computer running BASIC, voltage measurement, etc is accomplished with just one chip. That is a high level of integration. At the top right hand section of the diagram is the video output. The components and values shown in Fig 1 are chosen to allow you to switch between VGA and composite video output. This involves some compromises, in the case of VGA the black level is not truly black and for composite the white level is not as bright as it could be. However the resulting video is perfectly acceptable and can be corrected by adjusting the monitor to suit. If you want a perfect picture all the time you can permanently configure the video for either of the standards as shown in Fig 2a and 2b. Fig.2a shows the circuit for VGA output only. In this setup the horizontal and vertical synchronisation pulses are generated separately and are wired direct to the output connector. The video signal is generated on pin 6 and is clamped to approx 0.7V by R3 and D1. It is then connected in parallel to the red, blue and green inputs of the monitor on CON4 creating a monochrome image. Fig.2b shows the video circuitry when it is setup for composite output. In this configuration both the horizontal and vertical sync pulses are generated on pin 50 of the PIC32 and are mixed with the video from pin 6 to create the composite video signal across the 120 resistor installed at D1. When a 50composite input is connected to CON5 the output voltage will be the standard 0.5V peak to peak. The 1kresistor connected to pin 8 is used in both configurations and is one of the most important features of the video controller. This feeds the horizontal sync pulse back to the SPI interface of the PIC32. This signal is used by hardware in the SPI interface to trigger the start of the video stream relative to the horizontal sync pulse and eliminates timing variations that would occur if the video stream was triggered via the firmware alone. The result is that the video output is rock solid, something that is not easy to accomplish in a microcontroller that has a lot of other duties in addition to generating a video output. On power up the firmware will check JP2 and accordingly configure the timsiliconchip.com.au ing for VGA or composite. This jumper is connected to pin 48 on the PIC32 which has its internal pull-up resistor enabled. If JP2 is open the voltage on pin 48 will be high and VGA selected. If a jumper is placed on JP2 the voltage will be low and composite timing will be selected. Sound output Returning to Fig 1, pin 49 of the PIC32 is the sound output. This signal is reduced to 0.5V peak to peak by a 5.6k and 1k resistive divider to make it suitable for a normal amplifier’s auxiliary input (for example, the input to amplified speakers). You can also drive a high impedance speaker or transducer directly with this output and in that case you would omit the 1kresistor and replace the 5.6kwith a wire link. CON8 provides access to the external input/output pins that are supported by the Maximite. PINs 1 to 10 are connected to I/O ports on the PIC32 that can be switched to analog inputs while PINs 11 to 20 are connected to I/O ports capable of working with 5V circuits. The 8MHz crystal connected to pins 39 and 40 is used to generate the main clock for the chip. It is divided by 2 inside the PIC32 then multiplied by 20 to give the 80MHz CPU clock. This is further divided by 2 to give the peripheral clock of 40MHz. Continuing in a clockwise direction around the PIC32 in Fig 1, the memory card interface uses a total of seven input/output signals. The firmware running on the PIC32 communicates with the card via the SPI (Serial Peripheral Interface) mode which is supported by all MMC/SD/ SDHC cards. This standard requires four signal lines (card enable, data in, data out and clock) with two of them pulled high by the 33kΩ resistors. The card detect and write protect signals are generated by contact closures in the card holder and are pulled high by resistors integrated in the PIC32. An IBM compatible keyboard is connected directly to pins 54 and 55 of the PIC32. The IBM standard requires that a pull-up resistor is used to hold the signal lines high when they are not being used. These resistors are integrated in the PIC32 and enabled by the firmware. Indicator LEDs Pin 61 of the PIC32 is used to drive the memory card activity LED. The firmware pulls that pin high when it is reading or writing from the card. Pin 58 drives the front panel LED which is normally illuminated but can be turned off or on under control of the BASIC program. When you are loading a new version of the firmware via USB this LED will flash to show that the device is in the boot-load mode and is ready for the firmware to be uploaded. The PIC32 can also be reprogrammed via CON3 which will accept an ICSP programmer/debugger like the PICKit 3. Normally you would only use this feature if you were developing and testing a new version of the firmware. Pin 47 on the PIC32 is another pin that is pulled up to 3.3V by an internal resistor and is used to detect if the bootload button is pressed. This is checked on power up and is used to enable firmware updates via USB. Last on our tour around the PIC32 is the USB interface. This is quite straightforward, pin 35 is the 3.3V supply for the USB transceiver integrated into the chip while pins 36 and 37 are the data lines. The firmware can tell if the USB is connected to a host by monitoring the voltage on pin 34. There are two power supplies, +5V provided by REG1 (7805) and +3.3V from REG2 (LM117T-3.3). Jumper JP1 allows you to power the Maximite from the USB 5V supply provided by the host if that suits your requirements. The keyboard is the only component that requires a 5V supply and is one of the main reasons REG1 is present. REG2 (the 3.3V regulator) is also supplied by REG1 and this means that its output voltage is very steady over a wide range of input voltages. This provides a stable reference for the ADC (Analog to Digital Converter) resulting in consistent voltage measurements. The schematic shows a number of capacitors on REG2’s output. These are decoupling capacitors situated near the power supply pins on IC1 and are critical in providing glitch- free power for the chip. Next month: construction! So that is the Maximite. As there is so much information to digest in one sitting, we’ll leave the construction details to next month. In the meantime, gather the components you need – you’ll find it easiest with the kit from Altronics (Cat K-9550) – and get ready to start your Maximite micro computer together. SC March 2011  37