Accessing The E1419A's Resources; Accessing The Hp E1419A's Resources - HP E1419A User Manual

Measurement and control module
Table of Contents

Advertisement

Global variables area
Global variables area
First_loop declared by
HP E1419A's driver
Begin main() function
(built by HP E1419A's driver)
End main() function
Begin algorithm "shells"
(built by HP E1419A's driver)
Your algorithms go here

Accessing the E1419A's Resources

Chapter 4
/* GLOBALS you define with ALG:DEF GLOBALS... go here */
/* global variable First_loop equals 1 until all algorithms called */
static float First_loop; /* global value set to 1 at each INIT */
/**************************** function main() ****************************/
/*The HP E1419A driver creates main() at INIT time. This example
shows a main created after 2 algorithms have been defined. */
main()
{
/********* declaration of variables local to main() ********/
static float State_1, Ratio_1, Count_1; /* created if alg1 defined */
static float State_2, Ratio_2, Count_2; /* created if alg2 defined */
/********* this section created if ALG1 is defined ********/
Count_1 = Count_1 - 1; /* Count_1 used for ALG:SCAN:RATIO */
if (Count_1 <= 0) {
Count_1 = Ratio_1; /* Count_1 = ALG:SCAN:RATIO setting */
if (State_1) alg1();
}
/********* this section created if ALG2 is defined ********/
Count_2 = Count_2 - 1; /* Count_2 used for ALG:SCAN:RATIO */
if (Count_2 <= 0) {
Count_2 = Ratio_2; /* Count_2 = ALG:SCAN:RATIO setting */
if (State_2) alg2();
}
First_loop = 0; /* reset First_loop after last alg has been called */
}
/* ************************ end function main() *************************/
ALG1() /* this function shell created by ALG:DEF 'ALG1'....
{
static float ALG_NUM = 1; /* from driver to ID this algorithm */
/********* Your algorithm code goes here **********/
}
ALG2() /* this function shell created by ALG:DEF 'ALG2'....
{
static float ALG_NUM = 2; /* from driver to ID this algorithm */
/********* Your algorithm code goes here **********/
}
Figure 4-1 Source Listing of Function main()
This section describes how your algorithm accesses hardware and software
resources provided by the HP E1419A. The following is a list of these
resources:
I/O channels.
Global variables defined before your algorithm is defined.
The value ALG_NUM which the HP E1419A makes available to
your algorithm. ALG_NUM = 1 for ALG1, 2 for ALG2 etc.
User defined functions defined with the ALG:FUNC:DEF command.
The Current Value Table (CVT), and the data FIFO buffer (FIFO) to
output algorithm data to your application program.
VXIbus Interrupts.
The Algorithm Language and Environment 113
/* test for ratio met (<=0 means execute)*/
/* if ALG:STATE ALG1,ON, call alg1
/* test for ratio met (<=0 means execute)*/
/* if ALG:STATE ALG2,ON, call alg2
*/
*/
*/
*/

Advertisement

Table of Contents
loading

Table of Contents