Mosaic embedded designs » Embedded controllers » Software development tools »QED-Forth embedded software - Overview

Introduction to QED Software

The QED Development Environment Makes Programming Easy

You'll be pleasantly surprised at how easy it is to develop your application using Mosaic's embedded controllers. Your high level application code can rely on a well crafted operating system and a wealth of pre-coded library routines. The comprehensive QED-Forth development software comes free of charge on each Mosaic controller, providing multitasking services and device driver functions that can be invoked from either C or Forth. This easy-to-use software is superbly documented with well written manuals that include numerous code examples and model applications. If you have a question not answered in the manual you'll find a helpful answer only a phone call away.

Programming Languages

Choose Your Favorite Language: C, Forth, or Assembly

The Mosaic embedded computers support interactive programming in C, Forth, and assembly. Our C development environment runs on your PC and compiles ANSI-compatible C into fast 68HC11 machine code. A simple PC interface makes it easy to compile, link and download your program to the Mosaic controller with a few keystrokes.

An interactive interpreter and Forth compiler reside in ROM on the Mosaic Controller. This confers several powerful advantages. Forth programmers can directly program the board from any PC or terminal - no other software is needed. And C programmers benefit also. The interactive operating system provides an easy way to "talk" to the Mosaic controller during program development in C, and the onboard multitasking and library routines can be called from C or Forth.

Forth - A Powerful High Level Language

Forth is ideal for real-time control, instrumentation, and data analysis. Its simple yet powerful structure allows the interpreter and compiler to reside on the target hardware, giving you the ability to interactively define new routines and immediately execute and debug them. This leads to an iterative programming style involving rapid definition, testing, and redefinition of small, modular routines tailored to your application.

In QED-Forth, parameters are passed between routines on a data stack. Stack-based parameter passing speeds program execution and unifies Forth syntax. All arithmetic, logical, I/O, and decision operators remove required data from the stack and leave their results on the stack. This leads to "postfix" syntax, with the operation being called after the data is placed on the stack.

QED-Forth is a powerful superset of the Forth language. It provides an interactive compiler, in-line assembler and symbolic debugger right on the Mosaic Controller. So as soon as you receive the controller of your choice you can plug it into the serial port of any PC or terminal and start programming.

QED-Forth includes familiar program flow and control structures to simplify the coding of your program. These include:

   DO ... LOOP
   BEGIN ... WHILE ... REPEAT
   BEGIN ... UNTIL
   CASE ... ENDCASE
   FOR ... NEXT
   IF ... ELSE ... ENDIF

These flexible program flow structures make it easy to implement any mathematical or logical algorithm.

Multitasking Real-Time Operating System

All Mosaic controllers run a built-in Real-Time Operating System (RTOS). This system implements cooperative and time-sliced multitasking, provides resource locking and mailbox services, implements an efficient paged memory manager, traps and reports errors, handles interrupts, and autostarts your application at system startup. By following some simple coding practices as shown in the documented coding examples, you can take advantage of these sophisticated features without having to worry about the implementation details.

The QED real-time operating system delivers workstation- caliber tools to your embedded control application. The onboard development software provides resources to initialize the system, manage multiple tasks in real time, dynamically allocate memory, and automatically execute your application program.

Using Multitasking

An instrument control program can typically be broken down into a number of tasks, each of which performs a distinct function.
For example, many programs perform data acquisition, computation, communications, control, and user interface functions.

Grouping these functions as separate modularly coded tasks has two key advantages.

  • First, each task may have its own timing behavior.
    For example, you may want to collect data ten times per second, print out average readings once per second, and scan the touchpad for events as often as possible to provide a responsive front-panel user interface.

    By coding separate tasks for data collection, printing, and user interface management, the RTOS ensures that each task uses a minimum of processor time without running inefficient timing loops.

  • Second, task-oriented coding results in clean modular source code that is easy to debug and maintain.

An integrated real-time operating system implements cooperative and/or pre-emptive (timesliced) multitasking with only 30 μsec task switch time. Resource variables and mailboxes handle inter-task communication and resource sharing.

Memory Management

All Mosaic controllers incorporate paged memory to greatly expand the available memory space beyond the 64K native address range of the processor. The IDE provides templates that set up ample memory maps for your code (in non-volatile flash memory) and data structures (in RAM). The real time operating system seamlessly handles page changes at runtime, so you can treat the memory as contiguous.

A heap-style memory manager facilitates dynamic run-time dimensioning of arrays, matrices, and data structures for optimal use of available RAM. Heaps and data structures as large as 8 Megabytes may be allocated and accessed as though they were a single contiguous block of memory.

Stand-alone Operation

The Mosaic controllers are easily configured to execute a user-defined program at power-up or reset using the simple command AUTOSTART.

GUI Software Tools

GUI Software Tools Implement Easy to Use Instrument Controls

Today's tech-savvy customers demand sophisticated yet easy-to-use front panel user interfaces. Mosaic provides software tools to help you quickly develop menu-based graphical interfaces that respond to the user's touch.

The Graphics Converter application runs on your PC and converts your custom images into graphics that can be displayed by the controller.

The GUI Builder program runs on the target controller board, allowing you to quickly design and place your buttons and graphics in a menu-based system, and it even generates the GUI source code for you!

The GUI Toolkit is the runtime engine that processes user inputs (touchscreen or keypad presses) and manages the user interface.

Taken together, these tools automate the process of designing a user interface so that you can get to market quickly.

Graphics Converter Simplifies Custom Graphics Generation

The GUI Toolkit comes with an assortment of useful graphics that implement various sized buttons, arrows, and icons. For most applications, you'll also want to create your own custom graphics.

A Graphics Converter program makes this easy to do on your Windows desktop PC. Simply create the desired graphical image using any graphical editor (such as PC Paint or Photoshop), and save it as a bitmap file.

After you've created all your bitmap images, click on the Graphics Converter icon in the Mosaic IDE, and the images are transformed into a download file that puts the graphics in the flash memory of your controller. The graphics are now ready to use.

Back to top

GUI Builder Enables Interactive Screen Design, and Generates Your Source Code

The GUI Builder lets you interactively place your buttons and images on the touchscreen. The program runs on your touchscreen-based controller, and you talk to it using the Mosaic Terminal program. You can select any of the buttons or graphics that have been loaded into flash memory, and use your finger or some arrow keys to move them on the screen to their desired locations. In this way you quickly build up the menu screens that the end user will see.

When you're pleased with the user interface design, the GUI Builder outputs source code in your selected programming language (C or Forth). All you have to do is attach an event handler routine to each button so it will perform its desired action at runtime.

Back to top

GUI Toolkit Defines and Manages the User Interface

Using the Graphics Converter and the GUI Builder, you create and place buttons and graphics on the multiple screens that make up the user interface. Typically, an instrument will have a main screen, from which other screens are accessed. Each screen is in turn created from building blocks such as graphics images, button objects, and ASCII strings. These building blocks must be organized in an intuitive way so users can easily operate your instrument.

To simplify your programming and design of the user interface, the GUI Toolkit uses object oriented concepts to organize these building blocks. Object oriented programming allows you to organize data structures (objects) hierarchically and manipulate the data using pre-defined methods. With the GUI Toolkit, it is simple to create elementary objects such as graphics that contain bitmapped image data and textboxes that contain strings. You can load those objects into other objects such as screens so that they are shown on the display. You can create controls which acquire data from a user or actuate hardware when a user touches the touchscreen. A button is a simple control.

The GUI Toolkit allows you to create onscreen objects, control their properties, define and assign actions for them, and specify how they respond to events like a button press. You can easily create interactive buttons, graphics, and textboxes on multiple screens to implement a sophisticated yet intuitive graphical user interface.

The runtime engine of the GUI Toolkit scans the touchscreen for button presses, and activates the handler function associated with the touched button. In addition to specifying the called function, you can easily control other actions. For example, you can set a flag that sounds the audible beeper whenever the button is pressed. Or, you can provide visual feedback for the button press using a pressed button graphic. These functions are automatically handled by the GUI Toolkit so you can create a polished interface without delving into the low level details.

Back to top

User Interface and Device Driver Libraries

The onboard software contains pre-coded library functions that manage all of the hardware resources and provide multitasking services. These library functions are callable from C, Forth, or assembly. As shown by the examples below, the onboard software makes it easy to take full advantage of the Mosaic computers' advanced hardware capabilities.

Using the Onboard Analog Converters

Ready-made library routines make it easy to control the A/D and D/A converters. For example, the C function call

   AD8Sample(3);

samples analog channel 3 and returns a digital result ranging from 0 to 255. Similar functions control the 12 bit A/D. To create an analog output using the 8 bit D/A converters, simply specify an 8 bit value in the range 0-255 and a channel number, and call the routine SetDAC. For example, to output the full scale voltage on channel 5, execute the function call

   SetDAC(255,5);

The Mosaic controller's analog outputs make it easy to control actuators such as audio transducers, X/Y plotters, and servo motors.

Designing a Custom User Interface

Built-in functions manage the keypad and display, so your product can keep users completely informed and prompt them to enter inputs via the keypad. For example, to detect a keypad entry, simply execute

   key_index = Keypad();

which assigns the index of the selected key to the variable key_index. To display a welcoming message starting at character position 1 on line 1 of the display, execute the function calls

   StringToDisplay(1, 1, " Welcome to QED!");
   UpdateDisplay();

The routine StringToDisplay places the specified text string into the display buffer, and UpdateDisplay writes the contents of the buffer to the liquid crystal display. The Mosaic controller's pre-defined commands give you complete high level control over the keypad and display so you can easily design a user-friendly interface.

Sample QED Library Routines

Device Drivers

  • SetDAC
  • AD8Sample
  • AD12Sample
  • Keypad
  • SetWatch
  • Update Display

Multitasking

  • Get
  • Send
  • Release
  • BPause
  • Receive
  • Activate

Sample QED Benchmarks

Operation Typical Time
  • Task switch
  • Interrupt latency
  • Interrupt exit time
  • 30 μsec
  • 9 μsec
  • 5 μsec
Back to QED Software

Home | Site Map | Products | Documentation | Resources | Order | About Us
Copyright © 2011 Mosaic Industries, Inc.
Your source for single board computers, embedded controllers, and operator interfaces for instruments and automation

Embedded Programming | Embedded Software Tools | Embedded Control Software | GUI Software Tools