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

Table of Contents

Introduction

USB Wildcard Specifications

USB Overview

Data Rates

USB Cables and Receptacles

Powering Options

USB Wildcard Hardware

Connecting To the Wildcard Bus

Selecting the Wildcard Address

Self Power/Bus Power Jumper

PC Driver Software

Customizing the EEPROM on the USB Wildcard

Using the Windows Device Manager to View USB Properties

Using the Mosaic Terminal with the USB Wildcard

Mosaic USB Driver Software

Installing the Mosaic USB Wildcard Driver Software

Using the Mosaic USB Driver Code with C

Using the Mosaic USB Driver Code with Forth

Glossary of Mosaic USB Driver Functions

Overview of Glossary Notation

Glossary Quick Reference

Glossary Entries

C Demonstration Program

Forth Demonstration Program

Hardware Schematics, pdf

The USB Wildcard User Guide

<< Previous |

Forth Demonstration Program

This section presents the Forth version of the demonstration program source code.

 

\ ****************************************************************************************

\ FILE NAME:   USBDemo.4TH

\ copyright 2007 Mosaic Industries, Inc. All rights reserved.

\ ---------------------------------------------------------------------

\ DATE:        1/8/2007

\ VERSION:     1.0, for V4.xx (QED/QCard line) or 6.xx (PDQ line)

\ ---------------------------------------------------------------------

\ This is the demonstration code for the USB Wildcard.

\ Please see the User Guide for more details.

\ The accompanying USB_Dvr driver code MUST be loaded before this file can be loaded.

\ This is an illustrative demonstration program that

\ shows how to run a QED monitor task using the USB Wildcard serial port.

\ You need the Mosaic Terminal program to run this demo.

 

\ When the top level function Run_Demo is running, the controller Board

\ is simultaneously using 2 serial ports:

\ the standard primary serial port,

\ and the USB serial channel; each is running an instance of the QED-Forth monitor.

\

\ The operating system supports revectorable I/O, meaning that

\ in any given task the standard serial I/O routines such as

\ CR and ." can be made to use any specified serial channel.

\ All that is required is to customize and revector (store the xcfa of)

\ three functions named Key, ?Key, and Emit to the specified serial channel

\ for the specified task.  This file shows how to do this

\ using the functions defined in the USB Wildcard driver.

 

\ ******************!!!!

\ MAKE SURE THAT THE USB_MODULE_NUM CONSTANT MATCHES YOUR HARDWARE JUMPER SETTINGS!!

\ ******************!!!!

 

\ ---------------------------------------------------------------------

\

\ Demonstration functions defined in this file:

\ USB_MODULE_NUM \ MUST match hardware jumper settings!

\ USB_Demo    ( -- )

 

\ ---------------------------------------------------------------------

\

\ Disclaimer: THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT

\             ANY WARRANTIES OR REPRESENTATIONS EXPRESS OR IMPLIED,

\             INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES

\             OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

\

\ *********************************************************************

 

HEX

FIND WHICH.MAP        \ do this only for page-swapping platforms!

IFTRUE                \ nesting is allowed if ends are sequential

  EXECUTE  0=         ( -- standard.map? ) \ run which.map

  IFTRUE 4 PAGE.TO.RAM  \ if in standard.map, transfer to download map

         5 PAGE.TO.RAM

         6 PAGE.TO.RAM

        DOWNLOAD.MAP

  ENDIFTRUE

ENDIFTRUE

 

\ if your memory map is not already set, set it here after load of UMod_Dvr.4th:

\ 800 4 DP X!  5800 4 NP X!  \ for kernel V4.xx

\ 0x8000 1 DP X!  0x8000 0x11 NP X!  \ for kernel V6.xx

 

F WIDTH !      \ set width of names stored in dictionary

 

ANEW USBDemo_Code   \ define forget marker for easy re-loading

 

 

\ ******************* DEMONSTRATION PROGRAM ***************************

 

\ The default task runs FORTH as usual, using the processor's hardware UART.

\ We create a second task that also runs FORTH,

\ communicating using the serial channel on the USB Wildcard.

\ To run this demonstration, simply execute:

\       USB_DEMO

\ You'll be running FORTH from your standard terminal

\ and you'll be running an independent FORTH task from your USB Wildcard.

 

DECIMAL     \ compile this section in decimal base

 

\ NOTE: YOU MUST MAKE SURE THAT USB_MODULE_NUM CONSTANT CORRESPONDS TO YOUR HARDWARE!!

1 CONSTANT USB_MODULE_NUM \ double check your hardware jumper settings!!!

 

 

HEX      \ variable area MUST be in common memory! ie., USE.PAGE, or HEX 8E00 0 VP X!

400 V.INSTANCE:     USB_TASK  \ 1 Kbyte per task area

 

: USB_Monitor   ( -- )         \ infinite task loop for CH1_TASK

   USB_Revector  \ revector this task's serial routines to use USB

   USB_MODULE_NUM USB_Flush

   CR ." Starting USB_Monitor..."

   QUIT                          \ call the infinite-loop FORTH monitor

;

 

 

: USB_Demo    ( -- )

   \ builds and activates a forth-monitor task using a the usb wildcard.

   USB_MODULE_NUM usb_module !  \ set global variable, must match hardware

   RELEASE.ALWAYS SERIAL.ACCESS !      \ ensure lots of PAUSEs in Forth task

   (STATUS) NEXT.TASK ! \ empty the task loop

   0\0 0\0 0\0 USB_TASK BUILD.STANDARD.TASK

   CFA.FOR USB_Monitor USB_TASK ACTIVATE

   START.TIMESLICER

    CR ." USB Demo task has been set up; use the Mosaic Terminal to exercise it" CR

;

 

FIND WHICH.MAP

IFTRUE                \ for kernel V4.xx platforms...

    XDROP             ( -- ) \ drop xcfa

   4 PAGE.TO.FLASH

   5 PAGE.TO.FLASH

   6 PAGE.TO.FLASH

   STANDARD.MAP

   SAVE

OTHERWISE            \ for V6.xx kernels, store to shadow flash and save pointers

    SAVE.ALL .      \ this takes some time, should print FFFF for success

ENDIFTRUE

 

 


<< Previous |


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