ISaGRAF. Version 3.4


C - 8


- :

 

void FBACT_xxx (

uint16 hinstance, /* "xxx" is the name of the function block

*/

/* logical number of the instance */

str_data *data, /* data: pointer to the instance data structure

*/

str_arg *arg /* pointer to the calling parameters structure

*/

)

{

}

hinstance - . ISaGRAF . data - . arg , . , C arg.

( arg) data.

TRIG ( ):

/* definitions stored in the function block "C" header */

 

typedef struct { /* calling parameters */

T_BOO _clk; /* trigger input */

} str_arg;

 

#define CLK (arg->_clk)

 

/* function block instance data structure */

 

typedef struct {

T_BOO prev_state; /* previous state of the trigger input */

T_BOO edge_detect; /* edge value: image of return param */

} str_data;

 

/* activation service */

 

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

{

data->edge_detect = (T_BOO)(CLK && !data->prev_state);

data->prev_state = CLK; /* calling parameter */