manufacturer of I/O-rich SBCs, operator interfaces, handheld instruments, and development tools for embedded control low cost single board computers, embedded controllers, and operator interfaces for scientific instruments & industrial control development tools for embedded control order our low cost I/O-rich embedded control products embedded controller manufacturer profile single board computers & embedded controllers development tools & starter kits for your embedded design operator interfaces with touchscreens and graphical user interface plug-in expansion modules for digital & analog I/O C language & Forth language integrated development tools, IDE single board and embedded computer accessories embedded controller enclosures, bezels, environmental gaskets

The C Programmer’s Guide to the Mosaic Handheld

Table of Contents

PART 1 GETTING STARTED

Introduction. How to Use This Manual

Chapter 1: Getting to Know Your Handheld Instrument

Introducing the Mosaic Handheld

Choice of Programming Languages

Hardware Functionality

Memory and Mass Memory

Measurement and Control

Communications

Personality Board and Extensible I/O

Getting to Know Your Hardware

Chapter 2: Powering Your Handheld

PART 2 PROGRAMMING THE MOSAIC HANDHELD

Chapter 3: Your First Program

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

Chapter 5: Making Effective Use of Memory

Chapter 6: Real Time Programming

Chapter 7: Failure and Run-Time Error Recovery

Chapter 8: Programming the Graphical User Interface

PART 3 COMMUNICATIONS, MEASUREMENT, AND CONTROL

Chapter 9: Digital and Timer-Controlled I/O

Chapter 10: Data Acquisition

Chapter 11: Serial Communications

Chapter 12: The Battery-Backed Real Time Clock

Chapter 13: Customizing the Handheld's I/O

PART 4: REFERENCE DATA

Appendix A: GUI Function Reference

Appendix B: Handheld Schematics

Chapter 1

<< Previous | Next>>

Getting to Know Your Handheld Instrument

Congratulations on your choice of the Mosaic Handheld™, a customizable handheld computing, data acquisition and communications platform that is ideal for machine automation, industrial control, robotics, data acquisition, and scientific instrumentation.  This Chapter introduces the various software and hardware features of the Handheld: the enclosure, battery management, keypad and display, real time operating system, choice of programming languages, processor, memory, serial communications, real-time clock, and I/O.

In this chapter you’ll learn:

All about the operating system and software features of the Mosaic Handheld;

How to use the hardware features of your instrument; and,

How to configure various options.

Introducing the Mosaic Handheld

To serve the needs of real-time control, modern embedded computers must have a set of complementary features including operating system software, device drivers, user interface, expandable I/O, and enclosure. You’ll find the Mosaic Handheld has a set of hardware and software that work together to simplify your product development cycle while bringing new capability to your portable products.

The Handheld packs a programmable computer, plenty of memory, communications, analog and digital I/O, battery power, 128x128 pixel graphic display, 32 button keypad, and an expansion I/O bus into a rugged handheld enclosure. The ABS plastic enclosure is small enough to fit comfortably in your hand but large enough to hold custom circuitry, sensors, and actuators.

Figure 1‑1 (pdf) diagrams the Handheld, showing its primary components.  In addition to its keypad and graphics/text display it contains:

  A Processor Board with serial communications, and analog and digital I/O;

  A Personality Board that allows you to filter and route I/O signals and add custom circuitry or components; and,

  A Power Board containing high efficiency switcher power supplies, battery charger, and battery measurement circuitry.

The Processor Board hosts a 16 MHz Motorola 68HC11F1 microprocessor, 512K Flash and 128K RAM (expandable to 1 MB Flash and 512K RAM), and 320 bytes of EEPROM.   On-board I/O includes 8 digital I/O lines with counter/timer capabilities, 8 analog inputs, a fast synchronous SPI serial interface, and dual RS232/485 ports.  An optional real-time clock tracks the calendar and time of day and battery backs the 128K RAM.

The processor is easily programmable in C, Forth or Assembly using any PC.  Built-in programming tools include an interactive debugger, a multitasking executive, comprehensive device-driver libraries, and a toolkit to simplify displaying graphics and creating your user interface.

The Personality Board allows you to filter and protect the I/O lines and to route them to a customizable DB25 connector on the bottom of the enclosure.  The Personality Board also hosts up to 4 I/O expansion modules called WildCardsÔ that you can mix and match depending on your application. The easy to use WildCards stack onto 24-pin WildCard connectors on the Personality PCB.  WildCards implement a wide variety of communications, data acquisition and control capabilities. Available WildCards include an octal 12-bit D/A and 16-bit A/D converters, a 24-bit resolution analog data acquisition subsystem, Compact Flash card mass memory interface, fast buffered RS232/485 dual UART, high voltage/high current isolated I/O, and AC or DC solid state relays.  You can select the WildCards that meet your needs to configure a cost-effective customized instrument for your application.

In addition to powering the Handheld, the Power Board contains battery management circuitry for six rechargeable 2100mAH nickel-metal hydride (NiMH) batteries.  They can supply power for up to 10 hours and recharge in only two hours.

The following subsections discuss the interdependent hardware and software aspects of your instrument.

Programming the Handheld

You wouldn’t want to have to load an operating system into your desktop computer each time you turn it on, and the same holds true for embedded computers.  Importantly, all of Mosaic’s controllers incorporate a full-time, on-board operating system called QED-Forth.  QED-Forth is an interactive programmable macro language encompassing a real-time operating system (RTOS), object oriented graphical user interface (GUI) toolkit, debugging environment, an assembler and math library for use within the Forth programming language, and a comprehensive set of pre-coded device drivers.

These built-in functions make it easy for you to get the most out of your board's computational and I/O capabilities.  You can fully program the Mosaic Handheld using only the QED-Forth programming language, or you can program it using only the C language – all of the operating system’s functions are accessible using either language.

This manual describes how to program your Mosaic Handheld using the Control-C programming language, and how to use the built-in functions. Function glossaries provide an in-depth description of every routine.  If you prefer to program in the QED-Forth programming language full function glossaries are available for that language too.  The Mosaic Handheld’s extensive embedded firmware reduces your time time-to-market – we’ve precoded hundreds of useful routines so you won’t have to.

The RTOS in onboard Flash memory also manages all required hardware initializations and automatically starts your application code.  It provides warning of power failures so you can implement an orderly shutdown, and provides the run-time security feature of a watchdog (COP - computer operating properly) timer.

Programming is a snap using the interactive debugger and multitasking executive.  The multitasker allows conceptually different functions of your application to run independently in different tasks while accomplishing their duties in a timely fashion.

Choice of Programming Languages

You can program the Mosaic Handheld using either the ANSI-standard C language or Mosaic’s QED-Forth language. In either language, you can supplement your high-level code with assembly code.  Using either language, you have full access to all firmware functions.

The Control-C Programming Environment

Our Control-C™ cross-compiler was written by Fabius Software Systems and customized by Mosaic Industries to facilitate programming the Mosaic Handheld in C.  It is a full ANSI C compiler and macro pre-processor; it supports floating point math, structures and unions, and allows you to program in familiar C syntax.  Extensive pre-coded library functions provide easy command of the controller’s digital I/O, A/D, serial ports, memory manager, multitasker, and much more.

Using the Windows™ environment on your PC, you can edit your C program in the supplied Mosaic IDE, and with a single mouse click you automatically compile, assemble and link your program, and generate an ASCII hex file ready for downloading.  Clicking in the “Terminal” window and sending the download file to the controller completes the process: you can then type main from your terminal to execute your program.  The interactive development environment also lets you examine and modify variables and array elements, and call individual functions in your program one at a time with arguments of your own choosing.  This interactive environment greatly speeds the debugging process!

QED-Forth High Level Language

For those who prefer to program in FORTH, no external compiler is needed.  You interact with the QED-Forth operating system (an RTOS, interpreter and compiler, all rolled into one) using your PC as a terminal. When programming in Forth you can use the Mosaic IDE (or you can use any other editor you prefer) to write your code and download the source code directly to the handheld where it is compiled as it downloads.  As we will see, even C programmers benefit greatly by the presence of the QED-Forth operating system, as the built-in Forth language provides a quick and easy way to interactively "talk to" your Mosaic controller while debugging your C programs.

68HC11 Assembly Code

Both Control-C and QED-Forth include complete in-line assemblers that let you freely mix high level and assembly code.  This is sometimes useful when creating specialized time-critical functions such as interrupt handlers.

<< Previous | Next>>


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