QScreen C User Guide

Table of Contents

PART 1 GETTING STARTED

Introduction. How to Use This Manual

Chapter 1: Getting to Know Your QScreen Controller

PART 2 PROGRAMMING THE QSCREEN CONTROLLER

Chapter 2: Your First Program

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

Chapter 4: Making Effective Use of Memory

Chapter 5: Real Time Programming

Chapter 6: Failure and Run-Time Error Recovery

PART 3 COMMUNICATIONS, MEASUREMENT, AND CONTROL

Chapter 7: Digital and Timer-Controlled I/O

Chapter 8: Data Acquisition Using Analog to Digital Conversion

Chapter 9: Serial Communications

Chapter 10: The Battery-Backed Real-Time Clock

PART 4: PUTTING IT ALL TOGETHER

Chapter 11: A Turnkeyed Application

PART 5: REFERENCE DATA

Appendix A: QScreen Electrical Specifications

Appendix B: Connector Pinouts

Appendix C: QScreen Schematics

How to Use This Manual

| Next »

Welcome, and thanks for purchasing the QScreen Controller™.  This Manual provides instructions for using your new embedded computer.  The QScreen Controller combines a C-programmable single-board computer with a touchscreen-operated graphical user interface. Designed as a fully-functional, compact industrial PC powered by an HC11 Motorola microprocessor, the QScreen is ideal for OEM applications where installation space is critical, such as embedded systems, scientific instruments, robotics, and portable data acquisition. The QScreen can be commanded remotely from a PC or used stand-alone providing real-time control of dozens of analog and digital I/O lines.

The QScreen Controller sports a touchscreen-operated graphical user interface on a high-contrast 128x240 pixel display with a 5x4 touchscreen overlay.  It comes complete with object-oriented menuing software that makes it easy to control your application using buttons, menus, graphs, and bitmapped pictures. 

Display your own custom graphics on a bright white-on-blue cold-cathode fluorescent (CCFL) backlit screen.  You can create hundreds of sophisticated screens including your company logo, system diagrams, and icon-based control panels using most Windows paint programs, such as PC Paintbrush.  Startup screens and your application program execute automatically on power-up.

Choose among many options: from 512K Flash and 128K RAM for a standard configuration up to 1M Flash and 512K RAM with the expanded memory option.  For those really extensive applications that require lots of memory or removable data storage, add the Compact Flash Wildcard to provide additional 64MB or 128MB of mass memory.

The QScreen Controller includes a powerful microcontroller you can program either in Control-C™ or QED-Forth™.  It comes loaded with a real-time multitasking operating system and hundreds of precoded device drivers.  Programming is a snap using the interactive debugger and multitasking executive.  Libraries of hardware control routines including drawing functions for the display are preprogrammed for you.  Program in ANSI C by compiling your application on your PC and downloading the code to the QScreen Controller where it is automatically executed.  The real-time operating system in onboard FLASH memory manages all required initializations and autostarts your application code.

Control dozens of analog and digital I/O lines in real time.  The QScreen Controller commands eight 8-bit A/D lines, 8 digital I/O lines including timer-controlled and PWM channels, and two RS232/485 ports.  Pre-coded I/O drivers are provided for all I/O, and make it easy to do data acquisition, pulse width modulation, motor control, frequency measurement, data analysis, analog control, PID control, and communications.

Need even more I/O?  The QScreen Controller hosts Mosaic's Wildcards™, small stackable I/O modules for sophisticated and dedicated I/O.  Stack up to seven Wildcards for: 16- or 24-bit resolution programmable gain A/D; 12-bit D/A; compact flash mass memory; opto-isolated AC or DC solid state relays; configurable digital I/O; additional RS232, RS422 or RS485; or high-voltage, high-current DC inputs and outputs.

Prerequisite Knowledge

The QScreen 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 QScreen 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 QScreen Controller in either.  This Manual is geared to the CForth programmer.  If you 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 QScreen Controller, will familiarize you with the QScreen Controller (Chapter 1) and its programming environment, and get you writing your first program (Chapter 2).  These first chapters guide you through the QScreen 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 to get a feel for the wealth of precoded library functions available for you to use.

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

Part 3, Communications, Measurement and Control, focuses on the QScreen's hardware resources — A/D, 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, pin-outs, and schematics Forth.

There are several other important documents contained on this CD:

  The Control-C Function Reference — contains glossary entries for all precoded kernel library functions.

  The QScreen GUI Toolkit Glossary — contains glossary entries for all precoded GUI Toolkit library functions.

  The QScreen GUI Toolkit Manual — describes in detail how to use the GUI Toolkit to create an intuitive user interface for your instrument.

Conventions Used in This Book

The following conventions are use throughout this Manual:

 

Abbreviations

 

A/D

Analog to Digital Converter

 

CCFL

Cold Cathode Fluorescent, a display backlight that uses a small fluorescent light bulb

 

COP

Computer Operating Properly timer

 

D/A or DAC

Digital to Analog Converter

 

EEPROM

Electronically Erasable Programmable Read-Only Memory, nonvolatile

 

EL

Electroluminescent Display

 

FLASH

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

 

GUI

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

 

I/O

Inputs and Outputs

 

LCD

Liquid Crystal Display

 

LED

Light-Emitting Diode

 

PIA

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

 

PROM

Programmable Read-Only Memory, nonvolatile one-time programmable

 

QED

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

 

QED-Forth

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

 

RAM

Random Access Memory, volatile

 

RTC

Real-Time Clock

 

RTOS

Real Time Operating System

 

SPI

Serial Peripheral Interface, a fast bidirectional synchronous serial interface

 

SRAM

Static Random Access Memory, volatile

 

UART

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:

 

Typefaces

 

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

BUILD.STANDARD.TASK

 

C code in listings

#define FULL_SCALE_COUNTS  256

 

Forth code in listings

256 CONSTANT FULL_SCALE_COUNTS

 

Commands typed to the  QScreen Controller through a terminal

CFA.FOR  main  PRIORITY.AUTOSTART

 

 QScreen Controller responses to a terminal program

Ok

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 QScreen 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 equivalents of decimal 0, 65,535 and 15,604 are represented as 0x0000, 0xFFFF, and 0x3CF4 respectively.

Obtaining Code Examples and Example Applications

Please check our website periodically at www.mosaic-industries.com, 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 call 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