General-purpose I/O – Related TML Instructions and Data (Firmware version FAxx) |
Parameters DIGIN_INVERSION_MASK Inversion mask for the following digital inputs:
A bit set signals that the corresponding input is inverted. The TML variable INSTATUS as well as the TML command INPORT are considering this inversion mask to switch the status of inverted inputs. As result, in INSTATUS and in the TML variable set by INPORT, the above bits always show correctly the inputs status at connectors level (0 if the input is low and 1 if the input is high) even when the inputs are inverted DIGOUT_INVERSION_MASK Inversion mask for the following digital outputs:
A bit set signals that the corresponding output is inverted. The TML command OUTPORT uses this inversion mask to switch the command for the inverted outputs. As result, the outputs at connectors level are always set as specified by the above bits in the TML variable of the OUTPORT command (low if the bit is 0 and high if the bit is 1), even when the outputs are inverted. Variables INSTATUS Provides status of the following digital inputs:
The above bits are set to 0 if the input is low (at connectors level) and 1 if the input is high (at connectors level). The information is automatically corrected in the case of inverted inputs. The other bits INSTATUS have no significance. Instructions user_var = IN#n Read input #n in the user variable user_var OUTPORTvalue16 Set simultaneously the output lines as specified by value16 ROUT#n Set low the output line #n SOUT#n Set high the output line #n SETIO#n OUT; Set the I/O line #n as an input SETIO #n IN; Set the I/O line #n as an output Programming Example user_var = IN#36; // read input #36 in user_var GOTO label1, user_var, NEQ; // go to label1 if input #36 is 1 // input #36 is 0 user_var = IN#39; // read input #39 in user_var GOTO label2, user_var, EQ; // go to label2 if input #39 is 0 // input #39 is 1 ... Label1: // input #36 is 1 ... Label2: // input #39 is 0 ...
See also: |