Good morning, I have a problem: I need to map an indexed list (array) of bool into a series of inputs.
something like this:
DECL BOOL es[10]
SIGNAL es[1] $IN[1]
SIGNAL es[2] $IN[2]
SIGNAL es[3] $IN[3]
Can someone tell me how to do it, thank you!!
Good morning, I have a problem: I need to map an indexed list (array) of bool into a series of inputs.
something like this:
DECL BOOL es[10]
SIGNAL es[1] $IN[1]
SIGNAL es[2] $IN[2]
SIGNAL es[3] $IN[3]
Can someone tell me how to do it, thank you!!
Not possible.
yup...
there is a function
GET_SIG_INF (CHAR SIGNAME[24]:IN)
but i have not found SET_SIG_INF or similar...
you could write something like
SIGNAL es $IN[1] to $IN[4]
SIGNAL fr $IN[5] to $IN[8]
SIGNAL de $IN[9] to $IN[12]
SIGNAL jp $IN[33] to $IN[36]
etc
and read it like
$OUT[666]=Get_Signal_Bit(es,2)
DEFFCT BOOL Get_Signal_Bit(sig_value:in,bit_pos:in)
DECL INT sig_name, bit_pos, temp
SWITCH bit_pos
CASE 1
temp = sig_value B_AND 1
CASE 2
temp = sig_value B_AND 2
CASE 3
temp = sig_value B_AND 4
CASE 4
temp = sig_value B_AND 8
DEFAULT
MsgQuit("Nope...")
ENDSWITCH
RETURN temp>0
ENDFCT
Display More
i think u can not do like these, but u can do this
at config.dat decl itDECL BOOL MY_ARRAY[10]
MY_ARRAY[1]=FALSE
MY_ARRAY[2]=FALSE
MY_ARRAY[3]=FALSE
MY_ARRAY[4]=FALSE
MY_ARRAY[5]=FALSE
MY_ARRAY[6]=FALSE
MY_ARRAY[7]=FALSE
MY_ARRAY[8]=FALSE
MY_ARRAY[9]=FALSE
MY_ARRAY[10]=FALSE
create new empty sps.sub
FOR I=1 TO 10
MY_ARRAY[I]=$IN[STARTING_OFFSET_BIT_NUMBER+ I -1]