Bit commands, Stack operations, 8 bit commands – HEIDENHAIN TNC 122 Technical Manual User Manual
Page 58: 9 stack operations

4/97
TNC 122
12 PLC Description
57
12.2.8 Bit Commands
BIT SET (BS)
Operands: B, W, D, K
With this command, each bit in the Accumulator can be accessed. The BS command sets the
addressed bit to 1. The selection (addressing) of the corresponding bit is derived from the content of
the specified Operand or a Constant. In the bit-numbering, bit 0 corresponds to the LSB and bit 31
corresponds to the MSB. For operand contents larger than 32, the operand value Modulo 32 is
used — that is, the integer remainder from the division (operand value)/32.
BIT CLEAR (BC)
Operands: B, W, D, K
With this command, each bit in the Accumulator can be accessed. The BC command sets the
addressed bit to 0. The selection (addressing) of the corresponding bit is derived from the content of
the specified Operand or a Constant. In the bit-numbering, bit 0 corresponds to the LSB and bit 31
corresponds to the MSB. For operand contents larger than 32, the operand value Modulo 32 is
used — that is, the integer remainder from the division (operand value)/32.
BIT TEST (BT)
Operands: B, W, D, K
With this command, the status of each bit in the Accumulator can be interrogated. With BT
commands, a direct transition from Word to Logic execution takes place. The BIT TEST tests the
status of a bit from the Word Accumulator and then acts correspondingly on the Logic Accumulator.
If the tested bit is 1, the Logic Accumulator is set to 1; if it is 0, the Logic Accumulator is set to 0.
The program continues in logic execution. The selection (addressing) of the corresponding bit is
derived from the content of the specified Operand or a Constant. In the bit numbering, bit 0
corresponds to the LSB and bit 31 corresponds to the MSB. For operand contents larger than 32,
the operand value Modulo 32 is used — that is, the integer remainder from the division (operand
value)/32.
12.2.9 Stack Operations
Load Data onto the Data Stack (PS)
Logic Execution with the PS Command
Operands: M, I, O, T, C
With the PS command, data is buffered by loading the addressed operand onto the Data Stack.
Since the Data Stack is 16-bit, a minimum width of one Word must be used when writing to it.
During this the operand value is copied into bit 7 of the current address in the Data Stack. The free
bits of the reserved memory are undefined or unused. If there is a stack overflow, an error message
will be issued.