I have already declared a singal in "config.dat"(SIGNAL O_TEST $OUT[50])
I want make a functions like "XXX(O_TEST)",then system would output signal
"OUT_C[50]".I also used the system function "GET_SIG_INF" to get the signal
number,but how to transmit the name of signal by XXX(O_TEST)?
The variable of "O_TEST" is a character string or something else?
Thank you very much!
How to transmit the name of signal?
-
koen99 -
March 19, 2016 at 2:56 PM -
Thread is Resolved
-
-
You mean, you wish to pass a Signal to a function/subroutine by name? Hm... I don't recall ever attempting that myself, but system functions like PULSE will work on signal names, as well as $OUTs. So it might be possible to pass a Signal by name and allow the function to manipulate it, as long as it was passed with :OUT rather than :IN.
-
$OUT_C[] requires an integer which is the index value of your output
i think there are only two options to this, pass index or pass name of the signalCode
Display MoreDEF sig( ) signal test_o $out[22] decl siginf s ; example1 - pass name test_o=false sig_on("test_o") ; example2 - pass index test_o=false s=get_sig_inf("test_o") sig_on2(s.idx) END def sig_on(sig_name[]:in) decl char sig_name[] decl siginf sig sig=get_sig_inf(sig_name[]) $OUT_C[sig.idx]=TRUE end def sig_on2(sig_index:in) decl int sig_index $OUT_C[sig_index]=TRUE end
-
Thank you !
-
You can pass a signal to a function, by treating it as a bool reference in your function:
Def my_function(my_signal:out)
bool my_signal
...
...
EndI have done this, and it works.
Was this what you were looking for?/RoboticsMan
-
That will transmit value, not the name of the signal...
-
I guess you're right. Would it be possible to solve the problem by making two signals?
SIGNAL O_TEST $OUT[50]
SIGNAL O_TEST_C $OUT_C[50]That would then require that one signal is used in one case, and the other signal in another case. Maybe not the most elegant solution. But would it work? I guess my question is: Is it possible to make a signal which is linked to $OUT_C?
/RoboticsMan