The C Programmer's Guide to the QVGA Controller

Table of Contents


Introduction. How to Use This Manual

Chapter 1: Getting to Know Your QVGA


Chapter 2: Your First Program

Chapter 3: The IDE: Writing, Compiling, Downloading and Debugging Programs

Chapter 4: Making Effective Use of Memory

Chapter 5: Programming the Graphical User Interface

Chapter 6: Real Time Programming

Chapter 7: Failure and Run-Time Error Recovery


Chapter 8: Digital and Timer-Controlled I/O

Chapter 9: Data Acquisition Using the QVGA Controller

Chapter 10: Outputting Voltages with Digital to Analog Conversion

Chapter 11: Serial Communications

Chapter 12: The Battery-Backed Real Time Clock


Chapter 13: A Turnkeyed Application


Appendix A: QVGA Electrical Specifications

Appendix B: Connector Pinouts

Appendix C: Physical Dimensions

Appendix D: Schematics (pdf)

How to Use This Manual

Not Approved for Life-Support Use

Mosaic's embedded computers, software, and peripherals are intended for use in a wide range of OEM products, but they are not designed, intended or authorized for use as components in life support or medical devices. They are not designed for any application in which the failure of the product could result in personal injury, death or property damage.

Complex software often contains bugs, and electronic components fail. Where a failure may cause serious consequences, it is essential that the product designer protect life and property against such consequences by incorporating redundant backup systems or safety devices appropriate to the level of risk. The buyer agrees that protection against consequences resulting from system failure, of either hardware or software origin, is solely the buyer's responsibility.

Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this document, and Mosaic Industries, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. For example, Microsoft, Microsoft Windows, and Visual Basic are registered trademarks of Microsoft Corporation.

While every precaution has been taken in the preparation of this manual, Mosaic assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.

Welcome, and thanks for purchasing the QVGA Controller™. This manual provides instructions for using your new embedded computer. The QVGA Controller is a state-of-the-art embedded microcontroller with an advanced operator interface. It's an ideal "brain" for instruments that need a highly visible graphical user interface (GUI), touchscreen control, computational power, I/O, and serial communications — all in one compact package.

Commanded remotely from a PC, or used stand-alone, it provides real-time control of dozens of analog and digital I/O lines. Use it for scientific instruments, machine or process control, or as an advanced operator interface for existing products. Its real-time multitasking operating system facilitates concurrent functioning of its user interface, I/O, and application software. You may use this compact, integrated device as the core hardware, software and user interface for your new products — wherever you need an I/O-rich computer and an advanced user interface.

The QVGA Starter Kit includes everything you need to develop a prototype instrument with an advanced GUI: the QVGA Controller with a monochrome or EL display, battery back-up for 128K RAM memory, a full documentation package, power supply and all cables. For a sleek look you can add a black anodized aluminum bezel. The QVGA Controller can be either flush mounted using the bezel or directly mounted to a panel with a cutout.

Prerequisite Knowledge

The QVGA Controller is intended for use by experienced programmers or any technically minded person up to the challenge of real-time programming. We assume that if you're designing a product requiring an embedded computer, you have experience in the design of the hardware and software needed to customize the QVGA Controller to your product, and an understanding of the basics of writing, compiling and debugging software programs. You should be comfortable programming in either the C or Forth programming languages; you can program the QVGA Controller in either. This manual is geared to the CForth programmer. If your would rather program in ForthC, give us a call and we'll send you the ForthC programmers manual. We recommend the following references for novice programmers:

The C Programming Language, by Kernighan and Ritchie

C: A Reference Manual, by Harbison and Steel

Starting Forth, by Leo Brodie

Motorola's M68HC11 Reference Manual and MC68HC11F1 Technical Data Manual are included with this documentation package as Adobe Acrobat Portable Document Format (*.pdf) files.

How to Use this Documentation

This manual is laid out in several parts, in an order we hope you find most useful. We have invested a lot of effort to make this documentation instructive and helpful. The available software and hardware functions are all described in detail, and many coded examples are presented. For those who are designing "turnkeyed" instruments, we have included a complete turnkeyed application program. This well documented program illustrates how to use dozens of features, including the graphical user interface, interrupts, floating point math, formatted display of calculated results, multitasking, and automatic program startup. The source code is included on your CD-ROM. This sample program can serve as a useful template for a wide variety of applications. This manual contains the following parts:

Part 1,Getting Started: A Quick Tour of the QVGA Controller, will familiarize you with the QVGA Controller (Chapter 1) and its programming environment, and get you writing your first program (Chapter 2). These first two chapters guide you through the QVGA Controller's hardware, explain how to establish communications with it, tell you how to install your compiler, and show you how to compile and run your first program.

After working through the examples of Chapter 2 you will have exercised some of the key hardware and software features of your controller. You might then leaf through the categorized list at the beginning of the C Forth Function Glossary in an Appendix to get a feel for the wealth of precoded library functions available for you to use.

Part 2, Programming the QVGA Controller, provides everything you need to know to master real-time programming on the QVGA Controller.

Part 3, Communications, Measurement and Control, focuses on the QVGA's hardware resources — A/D, D/A, serial communications, timer-controlled I/O, real-time clock and others — and provides examples for using each.

Part 4, Putting It All Together, introduces a real-time interactive application, and provides code you can use as a template for your application. It also discusses the nuts and bolts of product integration, mounting, noise considerations and power requirements.

Part 5, Reference Data, contains detailed specifications, schematics, dimensions, data sheets and glossaries of C Forth functions available for your use.

Conventions Used in This Book

The following conventions are use throughout this manual:





Analog to Digital Converter



Computer Operating Properly timer


D/A or DAC

Digital to Analog Converter



Electronically Erasable Programmable Read-Only Memory, nonvolatile



Electroluminescent Display



Flash Programmable Read-Only Memory, nonvolatile and on-the-fly reprogrammable



Graphical User Interface, also called an MMI (Man Machine Interface)
or OI (Operator Interface)



Inputs and Outputs



Liquid Crystal Display



Light-Emitting Diode



Peripheral Interface Adapter (a chip that provides 24 digital I/O signals)



Programmable Read-Only Memory, nonvolatile one-time programmable



Quod Erat Demonstrandum, or Quick Easy Design, whichever you prefer



The name of the QVGA Controller's onboard operating system and interactive resident language.



Random Access Memory, volatile



Real-Time Clock



Real Time Operating System



Serial Peripheral Interface, a fast bidirectional synchronous serial interface



Static Random Access Memory, volatile



Universal Asynchronous Receiver Transmitter

Throughout this manual the names of code functions and extended code segments are distinguished by their typeface. The following font styles are used:




English Text

Plain text uses a Times New Roman Font


C function names appearing within text

void InstallMultitasker(void)


Forth function names appearing within text



C code in listings



Forth code in listings



Commands typed to the QVGA Controller through a terminal



QVGA Controller responses to a terminal program


Code function names and listings use a fixed space font. C code uses a font with serifs, QED-Forth code is sans serif. Terminal commands are indented and followed by a back-arrow symbol representing the enter key on the keyboard, and the QVGA Controller's responses are underlined with a dotted line. Both are indented in the text. Listings of more extensive code examples are set off by indenting and captioning.

Integer numbers are not accompanied by a decimal point; the presence of a decimal point indicates that the number is a floating-point format number. Decimal base numbers are written in standard form while binary numbers are written in hexadecimal (base sixteen, using 0-9 and A-F) and preceded with "0x", for example, the 16-bit integer equivalent of decimal 15,604 is represented as 0x3CF4

Obtaining Code Examples and Example Applications

Please check our website periodically at, where we'll be posting code examples and example applications, and providing software updates and enhancements.

For Technical Help (or just to chat) Contact Us

We have tested and verified the sample code in this user's guide to the best of our ability, but you may find that some features have changed, or even that we have made a mistake or two. If you find an error, please contact us and we'll fix it pronto.

If you are facing a challenging software hurdle, or a hardware problem in interfacing to our products, please don't hesitate to contact us. We provide free technical help to all registered, licensed users, and can often help you over the hurdle and save you a lot of time.

| Next>>

Home|Site Map|Products|Manuals|Resources|Order|About Us
Copyright (c) 2006 Mosaic Industries, Inc.
Your source for single board computers, embedded controllers, and operator interfaces for instruments and automation