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

Analog I/O Wildcard Hardware

Connecting To Mosaic Controller

Selecting the Wildcard Address

Selecting the Reference Voltage

Analog I/O Wildcard Field Header

Software

Overview of the Software Device Driver Functions

Initializing the Analog I/O Software Drivers

Using the DAC Drivers

Using the A/D Drivers

Installing the Analog I/O Wildcard Driver Software

Using the Driver Code with C

Using the Driver Code with Forth

Glossary

Overview of Glossary Notation

Glossary Quick Reference

Glossary Entries

Hardware Schematics (pdf, 38.3KB)

Analog I/O Wildcard User Guide

<< Previous | Next>>

To read a voltage from channel 2 (pin 12 on the Field Header) on module 1 with a single-ended conversion, use the function AD16_Sample as shown in the example code Listings 1-5 and
1-6.

Listing 1-5 C Code Listing for reading A/D Channel 2 on Module 1.

#include <\mosaic\allqed.h> // include all qed utilities
#include "library.c" // be sure to include kernel ext
#define ANALOG_MODULE1 1 // define current module
void main ( void )
{
 uint ad16_result;
 Init_Analog_IO(INT_2V_DAC12,ANALOG_MODULE1); // init DAC to use 2.048 int ref
 ad16_result = AD16_Sample( AD16_CH2, ANALOG_MODULE1 ); // read ch 2 on mod 1
 printf("AD Result = %u\n",ad16_result); // print out A/D counts
}

Listing 1-6 Forth Code Listing for reading A/D Channel 2 on Module 1.

DECIMAL \ set base to decimal
1 CONSTANT ANALOG_MODULE1 \ define current module
INT_2V_DAC12 ANALOG_MODULE1 Init_Analog_IO \ init DAC to use 2.048 internal ref
AD16_CH2 ANALOG_MODULE1 AD16_Sample \ read sample from ch 2 on mod 1
U. \ print out A/D counts

To convert the 16-bit result returned from AD16_Sample into a voltage, use Equation 1-2.

Input Voltage = +IN − −IN = ( Count / 65536 ) * Vref   Eqn. 1-2

Vref in Equation 1-2 is the reference voltage selected using the voltage reference selection jumpers which were described in the section entitled "Selecting The Reference Voltage". With the default voltage reference selection jumper configuration (jumpers J4 and J6 installed), Vref is 4.096 volts.

Components and transducers with high output impedances connected to the analog inputs will introduce errors in the analog to digital converter. Table 1-7 shows the maximum source resistance at various sampling rates. Larger source resistances may cause conversion errors of more than one least significant bit (LSB).

The function AD16_Multiple rapidly obtains a specified number of samples from an A/D channel and stores the results as sequential 2-byte values in memory starting at the specified extended address. If the specified extended address is in common RAM, the fastest sampling frequency is approximately 17 kHz (corresponding to 57.5 microseconds per sample). If the specified extended address is in paged memory, the fastest sampling frequency is approximately 12 kHz (corresponding to 82.5 microseconds per sample). The timing parameter specifies the timing of the samples, with 0 representing the fastest sampling rate, and 65,535 representing the slowest sampling rate. See the glossary entry for more information.

Table 1-7 Maximum Source Resistance at Various Sampling Rates

Analog I/O board: maximum source resistance

<< 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