www.vtiinstruments.com
VM2710A Programming
31
/* Tell the VM2710A to start and how to run */
vxiwrt(addr, "trace:feed reg");
vxiwrt(addr, "trig:coun 0");
vxiwrt(addr, "init");
/* Remember the current time for later */
delta_time = Timer();
/* Loop sending "trig" and doing a delay until a key is hit */
while (KeyHit () == 0)
{
vxiwrt(addr, "trig");
Delay(del_time);
}
/* Wait for instrument to catch up with all the "trig" commands */
vxiwrtrd(addr, "*opc?", buf);
/* Find out how much time it took for the triggers */
delta_time = Timer() - delta_time;
printf("Time spent triggering: %f seconds\n", delta_time);
/* Map the A16 address space into our space for quick register access */
reg_base = (char *)MapVXIAddress (1, 0, 1000, &window, &ret) + addr*0x40;
/* Initialize two pointers for easy access */
data_hi = (INT16*)(re 0x0020);
data_lo = (INT16*)(re 0x0022);
/* Initialize some variables for measurement statistics */
voltmin = 999.0;
voltmax = -999.0;
accumulate = 0.0;
i = 0;
/* Remember the current time for later */
delta_time = Timer();
/* Repeat while the register at 0x20 is non-zero */
while ((temp = *data_hi) != 0)
{