Thank you. I will try it.send the W#16#0480
siemens WEB had provide example project with FB
Yes, P2103.0 has r2090.7 in it.Something to check:
Note this FW4.6
In Parameter P2103.0 make sure you have 2090.7 If you are using different command data sets make sure CDS 0 is active else change P2103.x where x is the CDS active
Also do you have any logic controlling bit 10 of the control word? Because if it goes off none of the other bits in the control word will work.
// Always on bits
SET
S #sWrite.CW_1.Off2 // No electrical stop
S #sWrite.CW_1.Off3 // No fast stop
S #sWrite.CW_1.Enable_Op // Enable operation
S #sWrite.CW_1.RFG_Enable // Enable ramp function generator
S #sWrite.CW_1.RFG_Start // Start ramp function generator
S #sWrite.CW_1.SetpointEnable // Enable setpoint
S #sWrite.CW_1.ControlFromPlc // Life bit from plc
R #sWrite.CW_1.CDSBit0
// Start drive
A #iStart
AN #sRead.SW_1.Fault
= #sWrite.CW_1.On_Off1
// Acknowledge fault
A #iReset
A #sRead.SW_1.Fault
= #sWrite.CW_1.Fault_Acknowledge
// Reverse direction
A #iDirection
= #sWrite.CW_1.ReverseDirection
IF activate_manual_mode = FALSE THEN // normal mode
//COPY INPUT BITS
Control_word_bits.Bit_00 := ON_OFF1; //Bit 1: 0 to 1=RUN
Control_word_bits.Bit_01 := OFF2; //Bit 2: 0=immediately STOP
Control_word_bits.Bit_02 := OFF3; //Bit 3: 0=quick STOP
Control_word_bits.Bit_03 := TRUE; //Bit 3: 0=cancel pulses
Control_word_bits.Bit_04 := TRUE; //Bit 4: 0=RFG is set to 0; 1=RFG follows setpoint
Control_word_bits.Bit_05 := TRUE; //Bit 5: 0=freeze RFG, 1= 1=RFG follows setpoint
Control_word_bits.Bit_06 := TRUE; //Bit 6: 0=setpoint is 0; 1=setpoint enabled
Control_word_bits.Bit_07 := Acknowledge; //Bit 7: 0 to 1 = fault acknowledge
Control_word_bits.Bit_08 := FALSE; //Bit 8: not used
Control_word_bits.Bit_09 := FALSE; //Bit 9: not used
Control_word_bits.Bit_10 := TRUE; //Bit10: 1= PLC controls the drive
Control_word_bits.Bit_11 := Direction_reversal; //Bit11: 1= reverse turning direction
Control_word_bits.Bit_12 := FALSE; //Bit12: not used
Control_word_bits.Bit_13 := FALSE; //Bit13: increase setpoint in motorized Potentiometer
Control_word_bits.Bit_14 := FALSE; //Bit14: decrease setpoint in motorized Potentiometer
Control_word_bits.Bit_15 := FALSE; //Bit15: not used
//CONVERT AND COPY CONTROL WORD TO BUFFER
//The SINAMICS and the SIMATIC uses different Byte orders (Endianness)
//The SINAMICS use Intel format or Little-Endian while the SIMATIC uses Motorola format or Big-Endian.
//The control and status words we change the high AND low bytes.
OutData_word[1] := ROL(IN:=Control_word ,N:=8);
//CONVERT SETPOINT VALUE AND COPY TO BUFFER
//The speed value is transferred as scaled value.
//The reference speed for the scaling is stored in P2000 in a SINAMICS G120.
//The scaling is: 100%(of P2000)=4000hex=16384dez
OutData_word[2]:=INT_TO_WORD (REAL_TO_INT (Speed_setpoint /Reference_speed_P2000 * 16384.0));
I'm not familair with this programing language.Code is from a working G120 FBCode:// Always on bits SET S #sWrite.CW_1.Off2 // No electrical stop S #sWrite.CW_1.Off3 // No fast stop S #sWrite.CW_1.Enable_Op // Enable operation S #sWrite.CW_1.RFG_Enable // Enable ramp function generator S #sWrite.CW_1.RFG_Start // Start ramp function generator S #sWrite.CW_1.SetpointEnable // Enable setpoint S #sWrite.CW_1.ControlFromPlc // Life bit from plc R #sWrite.CW_1.CDSBit0 // Start drive A #iStart AN #sRead.SW_1.Fault = #sWrite.CW_1.On_Off1 // Acknowledge fault A #iReset A #sRead.SW_1.Fault = #sWrite.CW_1.Fault_Acknowledge // Reverse direction A #iDirection = #sWrite.CW_1.ReverseDirection
Now Siemens FB11 for G120 Telegram 1 and other examples set bits of VFD control word, and other Siemens G120 project examples use both of sending control word value to QWxxx, and setting bits of control word Qx.x .
VAR
Control_word : WORD; //control word for drive
Control_word_bits [COLOR="Red"]AT[/COLOR] Control_word: STRUCT //bits of the control word
Bit_00 : BOOL; // 0 = OFF1, Shutdown via ramp, followed by pulse inhibit 1 = ON, operating condition (edge-controlled)
Bit_01 : BOOL; // 0 = OFF2: Electrical stop, pulse inhibit, motor coasts down 1 = Operating condition
Bit_02 : BOOL; // 0 = OFF3: Fast stop 1 = Operating condition
Bit_03 : BOOL; // 1 = Operation enable
Bit_04 : BOOL; // 1 = Ramp-function generator enable
Bit_05 : BOOL; // 1 = Continue ramp-function generator
Bit_06 : BOOL; // 1 = Speed setpoint enable
Bit_07 : BOOL; // 1 = Acknowledge fault
Bit_08 : BOOL; // 1 = Jog bit 0
Bit_09 : BOOL; // 1 = Jog bit 1
Bit_10 : BOOL; // 1 = Master ctrl by PLC
Bit_11 : BOOL; // 1 = Directions reversal (setpoint)
Bit_12 : BOOL; // Reserved
Bit_13 : BOOL; // 1 = Motorized potentiometer raise
Bit_14 : BOOL; // 1 = Motorized potentiometer lower
Bit_15 : BOOL; // 1 = CDS bit 0
END_STRUCT;
I can't open that HMI with my WinCC when I tried it 2 days ago. It said it was created with Beta version of WinCC and it needs to be saved again with release version, or my version is too old.The link I posted in post #13 is wrong.
That sample project describes how to control a VFD directly from the HMI, without PLC code.
I shall try to find the sample project that contains control of a a G120 including HMI screens.