Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to set the variable time of PLC timer
How to set the variable time of PLC timer
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.

This is two types of conversion.

Specific operation, after you divide the results, you need to use TRUNC to transfer floating-point numbers->; Force;

dint->:TIME;

Then through the library function FC40 (library/standard library /IEC function block /FC40)

Time->; S5 # time.

You got it?