12.05.2014 Views

Automating Manufacturing Systems - Process Control and ...

Automating Manufacturing Systems - Process Control and ...

Automating Manufacturing Systems - Process Control and ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

plc basic functions - 15.6<br />

store the result in memory. Figure 15.4 shows an ADD function that will retrieve values<br />

from N7:4 <strong>and</strong> F8:35, convert them both to the type of the destination address, add the<br />

floating point numbers, <strong>and</strong> store the result in F8:36. The function has two sources<br />

labelled source A <strong>and</strong> source B. In the case of ADD functions the sequence can change,<br />

but this is not true for other operations such as subtraction <strong>and</strong> division. A list of other<br />

simple arithmetic function follows. Some of the functions, such as the negative function<br />

are unary, so there is only one source.<br />

A<br />

ADD<br />

source A N7:04<br />

source B F8:35<br />

destination F8:36<br />

ADD(value,value,destination) - add two values<br />

SUB(value,value,destination) - subtract<br />

MUL(value,value,destination) - multiply<br />

DIV(value,value,destination) - divide<br />

NEG(value,destination) - reverse sign from positive/negative<br />

CLR(value) - clear the memory location<br />

NOTE: To save space the function types are shown in the shortened notation above.<br />

For example the function ADD(value, value, destination) requires two source values<br />

<strong>and</strong> will store it in a destination. It will use this notation in a few places to<br />

reduce the bulk of the function descriptions.<br />

Figure 15.4<br />

Arithmetic Functions<br />

An application of the arithmetic function is shown in Figure 15.5. Most of the<br />

operations provide the results we would expect. The second ADD function retrieves a<br />

value from N7:3, adds 1 <strong>and</strong> overwrites the source - this is normally known as an increment<br />

operation. The first DIV statement divides the integer 25 by 10, the result is rounded<br />

to the nearest integer, in this case 3, <strong>and</strong> the result is stored in N7:6.TheNEG instruction<br />

takes the new value of -10, not the original value of 0, from N7:4 inverts the sign <strong>and</strong><br />

stores it in N7:7.

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

Saved successfully!

Ooh no, something went wrong!