=                Read digital input(s) and assign a 16-bit TML variable with their value (Firmware version FBxx)

Syntax                        

VAR16D = IN(n1, n2,…)

Read input n1, n2 into VAR16D

 

Operands

Var16D: integer variable

IN(n1, n2,…) : the source inputs n1, n2, …

 

PlaceTMLOnline

Binary code

IN_MC3

DescriptionRead digital input(s) and assign a 16-bit TML variable with their value. When a single input is read, IN(n), the destination variable is set to 0 when the input n is 0 (low) and to a non-zero value when the input n is 1 (high). When multiple inputs are read, IN(n1, n2,…), each bit of the destination variable shows one input status: 0 – input is 0 (low), 1 – input is 1 (high).

In TML the input lines are numbered from 0 to 15. Each product has a specific number of inputs, therefore only a part of the 15 input lines is used.

These instructions use a 9-bit short address for the destination variable. Bit 9 value X specifies the destination address range:

AddressRange

Execution        Read input(s) and set their status in the corresponding bits from the destination.

Example1                

int Var1;

...

Var1 = IN(4);

 

Before instruction

 

After instruction

IN(4) status

1

 

IN(4) status

1

Var1

x

 

Var1

0x0010

 

 

 

Bit#4 of Var1 has logic value of IN(4). Remaining bits are set to 0.

Example1                

int Var1;

...

Var1 = IN(4, 9);

 

Before instruction

 

After instruction

IN(4) status

1

 

IN(4) status

1

IN(9) status

1

 

IN(9) status

1

Var1

x

 

Var1

0x0210

 

 

 

Bit#4 of Var1 has logic value of IN(4). Bit#9 of Var1 has logic value of IN(9). Remaining bits are set to 0.