Program Examples
3-19
/* since list is of phase CHANGES need to calculate initial phase of
waveform and then calculate phase shifts */
old = 0.0;
/* initial sine wave value = 0 = sin (0) */
/* calculate 4-byte data values. each value = 2^16 * delta phase */
for (i = 0 ; i < number ; i++)
{
new = span * sin ((6.2831853*(double)(i+1))/(double)number)/2.0;/*new phase */
t = new - old;
/* phase change */
old = new;
/* save new phase for next time */
data[i] = (long)(s*t);
sum += data[i];
/* update checksum */
}
data[number] = sum; /* store checksum */
sprintf (cmd,"MENA0;MTYP4;MDWF5\n"); /* make sure modulation off until after
loading, set PM, arb WF */
ibwrt (ds345,cmd,strlen(cmd));
/* send commands */
sprintf (cmd,"AMOD?%d\n",number); /* arb modulation command */
ibwrt (ds345,cmd,strlen(cmd));
ibrd (ds345,cmd,40);
/* read back reply before sending data */
ibwrt (ds345,(char *)data,(long)4*4); /* number of bytes = 4 per data
point + 4 for checksum */
sprintf (cmd,"MENA1\n"); /* turn modulation on */
ibwrt (ds345,cmd,strlen(cmd));
}
EXAMPLE 4:
Point Mode Arbitrary Waveform.
This program downloads an arbitrary in point edit mode. The data is just a list of the amplitude value at each
waveform RAM point. The program is written in C.
/* program to donwload point mode arb wf to DS345.
The waveform is a simple ramp. Written in
Microsoft C and uses National Instrument GPIB card. Expects DS345
to be installed as DS345 in IBCONF */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dos.h>
#include <decl.h>
/* National Instruments header file */
void main(void);
int ds345;
int data[10000]; /* up to 10000 points */
void main ()
{
char cmd[40];
int i,sum,j,number;
Содержание DS345
Страница 2: ......
Страница 5: ...DS345 Synthesized Function Generator iii...
Страница 20: ...Introduction 2 4...
Страница 64: ...Programming Commands 3 14...
Страница 72: ...Program Examples 3 22...
Страница 78: ...Troubleshooting 4 6...
Страница 82: ...Performance Tests 5 4...
Страница 101: ...Calibration 6 10...
Страница 109: ...Arbitrary Waveform Composer 7 8...
Страница 117: ...DS345 Circuitry 8 8...