Appendix A: Sample Programs - ICS Advent AOB8/16 Product Manual

Table of Contents

Advertisement

Appendix A: Sample Programs

Sample programs are provided on diskette with the AOBx/16. Sample Program #1 demonstrates
general use of the card. This program prompts you for a voltage, calculates the closest actual
voltage based on the 16-bit resolution of the DAC, and then programs the card to output this volt-
age. Sample Program #1 is provided in QuickBASIC, C, and Pascal.
Sample Program #2 will generate a sine, triangle, or sawtooth output waveform. This program is
provided in QuickBASIC, C, and Pascal. A sample commented listing of the C language version is
as follows (but refer to disk copies for the latest examples):
SAMPLE 2.C
This sample program will generate three different waveforms; sine, triangle, and sawtooth. You
have the choice of base address, DAC number, and the number of points per cycle.
The base address entered during program execution should correspond to that set up on the card.
#include <math.h>
#include <conio.h>
#include <stdio.h>
#include <dos.h>
#define
PI 3.1415927
unsigned
unsigned
unsigned
unsigned
Function: setparams() - local routine
Purpose:
Input :
Calls:
Output:
void setparms()
{
clrscr();
printf("Enter the base address of your card (in hex)\n");
printf("(Example: 300 : ");
scanf("%x",&baseadrs);
printf("Enter the DAC number you wish to output to (0 or 1):");
scanf("%u",&dacnum);
dacnum% = 2;
printf("Enter the number of points that you wish to calculate per cycle,\n");
Manual Number: 00650-010-6
counts;
baseadrs;
dacnum;
progstruct[20000]; /* buffer to hold points */
Prompts the user for DAC number, base address, and number of points per cycle.
None
None
None
/* number of points per cycle */
/* card base address */
/* DAC used for output */
Page 23

Advertisement

Table of Contents
loading

This manual is also suitable for:

Aob16/16

Table of Contents