0004-000067
17
Uploading Waveforms
Waveforms can be uploaded as an array of type DBR_DOUBLE via Channel Access
using the Calc
N
Upload, Calc
N
ScaledUpload, Ref
N
Upload and Ref
N
ScaledUpload PVs
(see section “Reference Process Variables”). In order to correctly store the uploaded
waveform data, some waveform preamble information must be included. This is done by
storing the needed values in the first four elements of the array. Note the array size
transferred via Channel Access must be adjusted accordingly. Here is a simple example
of a function using the Channel Access C function calls:
void upload_waveform(long *wf_buff, long type, unsigned long points,
double time_int, double, volt_int)
{
int
idx;
double
*upload_buff;
upload_buff=(double *)calloc(4, sizeof(f64));
upload_buff[0]=(double)type;
upload_buff[1]=(double)points;
upload_buff[2]=(double)time_int;
upload_buff[3]=(double)volt_int;
for
(idx=0;idx<points;idx++)
{
upload_buff[idx+4]=(f64)(wf_buff[idx]);
}
ca_context_create(ca_disable_preemptive_callback);
ca_create_channel("ztec:Ref1Upload",NULL,NULL,10,&chan_id);
ca_pend_io(5.0);
ca_array_put(DBR_DOUBLE, 4, chan_id, (void *)upload_buff);
ca_pend_io(5.0);
ca_clear_channel(chan_id);
ca_pend_io(5.0);
free(upload_buff);
ca_context_destroy();
}
This function would upload
a long integer waveform data array named
points
, with
waveform preamble data:
•
waveform type =
type,
•
number of points =
points,
•
time interval =
time_int,
•
voltage interval =
volt_int.
For more information on waveform preamble, please refer to the M-Class Digital Storage
Oscilloscope Instrument Manual. For information on programming using the Channel
Access C function calls, refer to the Channel Access documentation
(
http://www.aps.anl.gov/epics/
).