ISaGRAF. Version 3.4


C - 14


: sample (count, reset_command, maximum_value);

max_detect := SAMPLE.Q;

count_result := SAMPLE.CV;

:

:

/* function block interface - name: SAMPLE */

 

/* ISaGRAF */

 

typedef long T_BOO;

typedef long T_ANA;

typedef float T_REAL;

typedef long T_TMR;

typedef char *T_MSG;

 

/* */

 

typedef struct {

T_BOO _cu;

T_BOO _r;

T_ANA _pv;

} str_arg;

 

/* */

 

#define CU (arg->_cu)

#define R (arg->_r)

#define PV (arg->_pv)

 

/* */

 

#define FBLPNO_Q 0

#define FBLPNO_CV 1

 

/* end of file */

:

( )

/* function block - name: SAMPLE */

 

#include <tasy0def.h> /* */

#include <grfb0255.h> /* */

 

/* definition of the structure which contains the data for one instance */

 

typedef struct {

T_BOO overflow; /* true:counting value >= programmed value */

T_ANA value; /* counting current value */

} str_data;

 

/* initialization service: requires memory for instance data */

 

word FBINIT_sample (uint16 hinstance)

{

return (sizeof (str_data));

}

 

/* activation service: up-counting algorithm */

 

void FBACT_sample (uint16 hinstance, str_data *data, str_arg *arg)

{

if (R) data->value = 0;




- -  - -  - -