Download Alspa C80-35 Programming Manual
Transcript
Alspa P8–25/35/05 Instruction Set 8. CONVERSION FUNCTIONS Use the conversion functions to convert a data item from one number type to another. Many programming instructions, such as math functions, must be used with data of one type. This paragraph describes the following conversion functions: Function Abbreviation Description Page BCD-4 Convert to BCD-4 Convert a signed integer to 4–digit BCD format. 4–82 INT Convert to Signed Integer Convert BCD–4 or REAL to signed integer format. 4–83 DINT Convert to Double Precision Signed Integer Convert to REAL Convert to WORD Truncate Convert REAL to double precision signed integer format. 4–85 Convert INT, DINT, BCD-4 or WORD to REAL. Convert REAL to WORD format. Round the real number toward zero. 4–86 4–87 4–88 REAL WORD TRUN 8.1. ³BCD–4 (INT) The Convert to BCD–4 function is used to output the 4–digit BCD equivalent of signed integer data. The original data is not changed by this function. The output data can be used directly as input for another program function. Data can be converted to BCD format to drive BCD–encoded LED displays or presets to external devices such as high–speed counters. When the function receives power flow, it performs the conversion, making the result available via output Q. The function passes power flow when power is received, unless the specified conversion would result in a value that is outside the range 0 to 9999. _____ | | (enable) —| INT_|— (ok) | TO_ | | BCD4| (value to be converted) —|IN Q|— (output parameter Q) |_____| 8.1.1. Parameters Parameter Description enable When the function is enabled, the conversion is performed. IN IN contains a reference for the integer value to be converted to BCD–4. ok The ok output is energized when the function is performed without error. Q Output Q contains the BCD–4 form of the original value in IN. Page 4–82 Alspa C80–35, C80–25 and C80–05 PLCs Reference Manual ALS 52102 c–en