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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

plc basic functions - 15.10<br />

A<br />

CPT<br />

Dest. F8:0<br />

Expression<br />

SQR(LN(F8:1)+XPY(2.718,F8:2)*ACS(F8:3))<br />

Figure 15.8<br />

Calculations with a Compute Function<br />

Math functions can result in status flags such as overflow, carry, etc. care must be<br />

taken to avoid problems such as overflows. These problems are less common when using<br />

floating point numbers. Integers are more prone to these problems because they are limited<br />

to the range from -32768 to 32767.<br />

15.2.3 Conversions<br />

Ladder logic conversion functions are listed in Figure 15.9. The example function<br />

will retrieve a BCD number from the D type (BCD) memory <strong>and</strong> convert it to a floating<br />

point number that will be stored in F8:2. The other function will convert from 2s compliment<br />

binary to BCD, <strong>and</strong> between radians <strong>and</strong> degrees.<br />

A<br />

FRD<br />

Source A D10:5<br />

Dest. F8:2<br />

TOD(value,destination) - convert from BCD to binary<br />

FRD(value,destination) - convert from binary to BCD<br />

DEG(value,destination) - convert from radians to degrees<br />

RAD(value,destination) - convert from degrees to radians<br />

Figure 15.9<br />

Conversion Functions<br />

Examples of the conversion functions are given in Figure 15.10. The functions<br />

load in a source value, do the conversion, <strong>and</strong> store the results. The TOD conversion to<br />

BCD could result in an overflow error.

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

Saved successfully!

Ooh no, something went wrong!