01.03.2013 Views

CSE-Semaphore TWinSoft Manual - ioSelect

CSE-Semaphore TWinSoft Manual - ioSelect

CSE-Semaphore TWinSoft Manual - ioSelect

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

10.7. Mathematical Block<br />

A mathematical Block allows to carry out analog output operations like addition, subtraction,<br />

multiplication, division, bit manipulation, indirect addressing...<br />

To insert a Math block, in the edit mode of Ladder Programming, click the icon of the LD<br />

Toolbar.<br />

Introduction<br />

There are 8 categories of mathematical functions available (to use in math blocks):<br />

• Assignment functions.<br />

• Arithmetic operations.<br />

• Comparisons.<br />

• Bit manipulations.<br />

• Boolean operations.<br />

• Conversion (PID, BCD, etc.), and indirect addressing.<br />

• Text and miscellaneous functions.<br />

• Floating point.<br />

In the functions, the Arguments to replace by Tags (or constant) are represented as follows:<br />

- A, B, C, and D: Analog Tags.<br />

- Ptr: Pointer in indirect addressing; analog Tag.<br />

- BOOL, Bit: Digital Tag.<br />

- Tot1, Tot2: Analog double word.<br />

- Flt: Floating point<br />

The equality operations are always executed from the right to the left. In other words, we have:<br />

result = operation<br />

or: output = input (means the value of Input variable is copied in the Output<br />

variable).<br />

16 bit analog numbers on are always worked out as signed values in TBox, even if they have<br />

been defined as 'Unsigned' Tags.<br />

If used in 'Indirect addressing' functions, an analog variable of the pointer is considered as<br />

'Unsigned', even if it appears 'Signed'.<br />

In edit mode, to insert a 'Math function' between 2 functions in a Math block, place the<br />

cursor at the position you want to insert the function, and press the key 'Insert' of keyboard.<br />

Assignments<br />

A = B 'A' contains a copy of the value of 'B'<br />

A = -B 'A' contains the invert value of 'B'<br />

A = Low(B) 'A' contains a copy of the 8 lowest bits of 'B'<br />

A = High(B) 'A' contains a copy of the 8 highest bits of 'B'<br />

A = Abs (B) 'A' contains a copy of the absolute value of 'B'<br />

A = Swap(B) 'A' contains the inversion of the 8 highest bits and the 8 lowest bits of 'B'<br />

inc (A) increase the value of Tag 'A' by 1 bit<br />

dec (A) decrease the value of Tag 'A' by 1 bit<br />

<strong>TWinSoft</strong>: 8.32 – Getting Started 36

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!