Function to force the state of I/O.
|
i32 force (what, value)
|
|
Object to be forced. Can be:
|
|
inp(nCh)
|
Where nCh is the input channel to be forced. Can be any expression
|
inp_w(nW)
|
Where nW is the index of the input word to be forced. Can be any expression
|
inp_w(nW).(iB)
|
Where nW is the index of the input word and iB is the bit of the input word to be forced. It can be any expression
|
out(nCh)
|
Where nCh is the output channel to be forced. It can be any expression
|
out_w(nW)
|
Where nW is the index of the output word to be forced. Can be any expression
|
out_w(nW).(iB)
|
Where nW is the index of the output word and iB is the bit of the output word to be forced. It can be any expression
|
|
|
Value to force
|
|
Returns:
|
|
0
|
Operation performed successfully
|
-1
|
Version of RTE not compatible
|
-2
|
Invalid index
|
-3
|
Invalid bit
|
|
|
Rule, Task
|
|
Remember that:
•Forcing an input means that sw will see the state of the forced input, regardless of the actual state of the physical input
•Forcing an output means that the physical output will take the forced value regardless of the desired value imposed by sw |
Example of use:
$LIT iw_rem 401
...
...
$LIT pbStart inp_w(iw_rem).(4)
...
...
esitoF = force(pbStart, 0)
if(esitoF < 0)
...
endif
dwell(0.02)
esitoF = force(pbStart, 1)
if(esitoF < 0)
...
endif
dwell(0.2)
|
Example of use:
$LIT iw_base_rem 401
...
...
$LIT pbStop inp((iw_base_rem-1)*16+5)
...
...
esitoF = force(pbStop, 0)
if(esitoF < 0)
...
endif
dwell(0.1)
esitoF = release(pbStop)
if(esitoF < 0)
...
endif
...
...
|
Esempio di utilizzo:
esitoF = force(out(r(1000)), r(1001))
if(esitoF < 0)
...
endif
...
...
|
|