PLC, HMI, SCADA, INVERTERS, TUTORIALS, INDUSTRIAL AUTOMATION

11:35
Mitsubishi MELSEC-Q/L Structured Text (ST) examples

MELSEC-Q/L Programming Manual (Structured Text).pdf

M0 := TRUE; (* M0 is turned ON. *) 
IF INT_TO_BOOL(D0) = FALSE THEN (* If INT_TO_BOOL(D0) is FALSE *) 
W0 := 1000;  (* 1000 is assigned to W0. *) 
END_IF;  

D0.0 = TRUE; (* Bit 0 of D0 device is turned ON.  *) 
W0.F = FALSE; (* Bit 15 of W0 device is turned OFF. *) 

K4X0 := D0; (* 16 bits are used from X0 device as integer  type (INT) and D0 is assigned. *) 
Wtest := K1X0; (* 4 bits are assigned to word type label Wtest from X0 device. *) 
Dwtest := K5X0; (* 20 bits are assigned to double word type label Dwtest from X0 device. *) 

When X0 is used 
Integer type (INT): K1X0, K2X0, K3X0, K4X0 
Double precision integer type (DINT): K5X0, K6X0, K7X0, K8X0

D0 : = D1 * (D2 + K3) / K100; 
 <<Operation order>> 
1) D2 + K3 
2) (D2 + K3) * D1 
3) (D2 + K3) * D1 / K100 
4) The result of 3) is assigned to D0.

Dtest2 : = Dtest1 MOD (D2 + K3) * K100; 
 <<Operation order>> 
1) D2 + K3 
2) Dtest1 MOD (D2 + K3) 
3) Dtest1 MOD (D2 + K3) * K100 
4) The result of 3) is assigned to Dtest2.

Dwtest2 : = Dwtest1 - Dwtest1 / K100; 
 <<Operation order>> 
1) Dwtest1 / K100 
2) Dwtest1 - Dwtest1 / K100 
3) The result of 2) is assigned to Dwtest2. 

M0 : = X0 AND X1 AND (D1 = 100); 

IF X0 THEN            (* If X0 is ON, 0 is assigned to D0. *) 
    D0 : = 0;                  (* If the X0 area is X0= TRUE, the meaning is the same. *) 
END_IF; 

F (D0*D1) <= 200 THEN (* If D0*D1 is less than or equal to 200 *) 
D0 : = 0; (* 0 is assigned to D0. *) 
END_IF; 

IF w_Real > 2.0 THEN (* If w_Real is greater than 2.0 *) 
D0 : = 0; (* 0 is assigned to D0. *) 
END_IF;

 

Категория: MITSUBISHI | Просмотров: 16 | Добавил: gt7600 | Теги: ST, Mitsubishi Electric Corporation | Рейтинг: 0.0/0
Всего комментариев: 0
avatar