Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to Convert Integer into s5time
How to Convert Integer into s5time
1. Write integer int or real number from upper computer to PLC. First, this value should include the time value in milliseconds. After writing into the data storage area of PLC, use ITD (integer to double integer with rounding) or RND (real to double integer with rounding) to convert this value into a double integer, and then write this value into a variable of type TIME, and call FC40 in the program to convert the time into S5TIME.

2. When the upper computer writes WORD to PLC, the numerical value should first include the time value in a certain time base. After writing into the data storage area of PLC, use WOR_W instruction under word logic to add its value to its time base, and then use MOVE instruction to write the obtained value into a variable of type S5TIME.

3. If WinCC is used as the upper software, or the upper software supports 32-bit signed floating-point numbers, you can write the upper 32-bit signed floating-point numbers into a variable defined as TIME in PLC, and then call FC40 in the program to convert TIME into S5TIME.