/* @(#)SNC Version 1.9.1: Mon Sep 14 11:11:59 EDT 1998: asup1.st */ /* Event flags */ /* Program "level_check" */ #define ANSI #include "seqCom.h" #define NUM_SS 1 #define NUM_CHANNELS 2 #define NUM_EVENTS 0 #define MAX_STRING_SIZE 40 #define ASYNC_OPT FALSE #define CONN_OPT TRUE #define DEBUG_OPT FALSE #define REENT_OPT FALSE extern struct seqProgram level_check; extern struct seqChan seqChan[]; /* Variable declarations */ static float v; static short light; /* Code for state "light_off" in state set "volt_check" */ /* Delay function for state "light_off" in state set "volt_check" */ static void D_volt_check_light_off(ssId, pVar) SS_ID ssId; struct UserVar *pVar; { # line 14 "test.st" } /* Event function for state "light_off" in state set "volt_check" */ static long E_volt_check_light_off(ssId, pVar, pTransNum, pNextState) SS_ID ssId; struct UserVar *pVar; short *pTransNum, *pNextState; { # line 14 "test.st" if (v > 5.0) { *pNextState = 1; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "light_off" in state set "volt_check" */ static void A_volt_check_light_off(ssId, pVar, transNum) SS_ID ssId; struct UserVar *pVar; short transNum; { switch(transNum) { case 0: # line 12 "test.st" light = 1; seq_pvPut(ssId, 1) ; return; } } /* Code for state "light_on" in state set "volt_check" */ /* Delay function for state "light_on" in state set "volt_check" */ static void D_volt_check_light_on(ssId, pVar) SS_ID ssId; struct UserVar *pVar; { # line 21 "test.st" } /* Event function for state "light_on" in state set "volt_check" */ static long E_volt_check_light_on(ssId, pVar, pTransNum, pNextState) SS_ID ssId; struct UserVar *pVar; short *pTransNum, *pNextState; { # line 21 "test.st" if (v < 5.0) { *pNextState = 0; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "light_on" in state set "volt_check" */ static void A_volt_check_light_on(ssId, pVar, transNum) SS_ID ssId; struct UserVar *pVar; short transNum; { switch(transNum) { case 0: # line 19 "test.st" light = 0; seq_pvPut(ssId, 1) ; return; } } /* Exit handler */ static void exit_handler(ssId, pVar) int ssId; struct UserVar *pVar; { } /************************ Tables ***********************/ /* Database Blocks */ static struct seqChan seqChan[NUM_CHANNELS] = { "Input_voltage", (void *)&v, "v", "float", 1, 1, 0, 1, "Indicator_light", (void *)&light, "light", "short", 1, 2, 0, 0, }; /* Event masks for state set volt_check */ /* Event mask for state light_off: */ static bitMask EM_volt_check_light_off[] = { 0x00000002, }; /* Event mask for state light_on: */ static bitMask EM_volt_check_light_on[] = { 0x00000002, }; /* State Blocks */ static struct seqState state_volt_check[] = { /* State "light_off"*/ /* state name */ "light_off", /* action function */ A_volt_check_light_off, /* event function */ E_volt_check_light_off, /* delay function */ D_volt_check_light_off, /* event mask array */ EM_volt_check_light_off, /* State "light_on"*/ /* state name */ "light_on", /* action function */ A_volt_check_light_on, /* event function */ E_volt_check_light_on, /* delay function */ D_volt_check_light_on, /* event mask array */ EM_volt_check_light_on, }; /* State Set Blocks */ static struct seqSS seqSS[NUM_SS] = { /* State set "volt_check"*/ /* ss name */ "volt_check", /* ptr to state block */ state_volt_check, /* number of states */ 2, /* error state */ -1, }; /* Program parameter list */ static char prog_param[] = ""; /* State Program table (global) */ struct seqProgram level_check = { /* magic number */ 940501, /* *name */ "level_check", /* *pChannels */ seqChan, /* numChans */ NUM_CHANNELS, /* *pSS */ seqSS, /* numSS */ NUM_SS, /* user variable size */ 0, /* *pParams */ prog_param, /* numEvents */ NUM_EVENTS, /* encoded options */ (0 | OPT_CONN | OPT_NEWEF | OPT_VXWORKS), /* exit handler */ exit_handler, };