HP VXI 75000 C Series User's And Scpi Programming Manual page 409

Algorithmic closed loop controller
Table of Contents

Advertisement

}
INST_SEND(e1415, "alg:def 'ALG1', %*B\n",strlen(algorithm) + 1, algorithm);
INST_SEND(e1415, "alg:upd\n");
printf("\nExecuting now with different algorithm\n\n");
/* Repeat with different algorithm running. */
for ( i = 0; i < 10 ; i++ ) { /* make 10 changes to 'x' */
}
#if 1 /* Set to 1 if using User interactive commands to E1415 */
/* Call this function if you want to be able to type SCPI commands and
* see their responses. NOTE: switch to FORM,ASC to retrieve
* ASCII numbers during interactive mode.
*/
do_interactive();
#endif
#if 0
/* C-CSPI way to check for errors */
INST_QUERY(e1415,"syst:err?\n", "%d,%S", &error, string);
if (error) {
(void) printf("syst:err %d,%s\n", error, string);
exit(1);
}
#endif
}
return 0;
}
#if 0
Appendix G
* the algorithm to complete and set sync = 2. This should
* happen almost instantly since the algorithm is executing
* every 1msec based upon trig:timer .001 above.
*/
sync = 0;
while ( sync != 2.0 )
/* wait until algorithm sets sync to 2 */
INST_QUERY( e1415, "alg:scal? 'alg1','sync'","%f",&sync );
/* read results of Mx+B calculations */
INST_QUERY( e1415, "data:cvt? (@10:13)","%f",&array );
printf("Array contents: %f, %f, %f, %f\n",array[0],
array[1],array[2],array[3]);
INST_SEND(e1415,"alg:scal 'alg1','x',%f\n", (float32) i );
INST_SEND(e1415,"alg:scal 'alg1','sync',%f\n", 1 ); /* set sync */
INST_SEND(e1415,"alg:upd\n");
/* The following alg:scal? command will not complete if the
* update has not occured. Then, it's a matter of waiting for
* the algorithm to complete and set sync = 2. This should
* happen almost instantly since the algorithm is executing
* every 1msec based upon trig:timer .001 above.
*/
sync = 0;
while ( sync != 2.0 )
/* wait until algorithm sets sync to 2 */
INST_QUERY( e1415, "alg:scal? 'alg1','sync'","%f",&sync );
/* read results of Mx+B calculations */
INST_QUERY( e1415, "data:cvt? (@10:13)","%f",&array );
printf("Array contents: %f, %f, %f, %f\n",array[0],
array[1],array[2],array[3]);
/* Calls cscpi_exe() in a loop */
/* Normal end of program */
Example Program Listings
409

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vxi e1415a

Table of Contents