Tangent (4-Digit BCD)
Instruction Parameters
Supported PLC Series
| XPnA/1R | XPnB | XPnE | XPnF | CP3A/B/P/U CP4A~D/U | CPnE | CPnF | BP | PLC-S |
|---|---|---|---|---|---|---|---|---|
| ✓ | ✓ | ✓ | ✓ | - | - | - | - | ✓ |
Supported Data Registers
| M | X | Y | K | L | F | T | C | S | Z | R | Q | D | @D | Constant | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| S | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - | - | ✓ | - | ✓ | ✓ | ✓ | ✓ |
| D | ✓ | - | ✓ | ✓ | ✓ | - | - | - | - | ✓ | - | ✓ | ✓ | ✓ | - |
Supported Flags
| Flag | Bit | Support |
|---|---|---|
| Error | F11.0 | ✓ |
| Zero | F11.1 | - |
| Carry | F11.2 | - |
Number of Steps
| Steps |
|---|
| 3 |
Operands
| Operand | Description |
|---|---|
| S | The first operand. Entries are 4-digit binary-coded decimal (BCD) data registers or constants. This is the value to calculate the tangent value of. The Hexadecimal value range is H0000 ~ H9999. The binary-coded decimal (BCD) value range is 0 ~ 360. |
| D | The second operand. Entries are only 8-digit binary-coded decimal (BCD) data registers. The tangent is saved as an 8-digit binary-coded decimal (BCD) data register in degrees. This requires 3 data registers. |
Result Storage
| Data Register | Storage |
|---|---|
| D | Sign |
| D + 1 | Integer Part |
| D + 2 | Fractional Part |
Notice
Error Flag (F11.0) Notice
The error flag, F11.0, will be ON for one scan when the address of the data register assigned by @D exceeds the range of the data register, D. The range of the data register, D, is dependent on the CPU type.
F11.0 turns ON when the value of the data for the calculation exceeds the data register assigned to S or D.
Instruction Behavior
The BTAN and BTANP instructions behave as follows:
- The value resulting from the BTAN or BTANP instruction is saved as a degree.
- If the value assigned to S is equal to or greater than 360, the angle data in degrees is specified by the remainder of value of S ÷ 360.
- Example: if S equals 362, the remainder is 2. The equivalent value of S is 2.
- If the calculation result is positive, 0 is stored in the data register D.
- If the calculation result is negative, 1 is stored in the data register D.
- The range of the calculation result is -52.2900 ~ 27.2900.
- The calculation result is rounded off from the fifth decimal place.
- The instructions perform raw Hexadecimal tangent of the value S.
- Only the number 0-9 can be used.
- A-F will NOT work.
- Only the number 0-9 can be used.