mcgs组态设计部分
用户窗口设计界面,读实时频率、电流、电压。修改频率并确认。正转反转急停。
组态界面设置,其中RB_01和RB_02进行了通道设置:0.01*X和0.1*X,变频器传回的频率和电流值分别被扩大了100倍和10倍,所以要显示正常需要进行通道处理。
添加内部寄存器通道
施耐德PLC部分
程序部分
T1(IN:= 1, PT:= T#1S);
T2(IN:= , PT:= T#0.01S);
T3(IN:= , PT:= T#0.01S);
T4(IN:= , PT:= T#0.01S);
T2.IN:=1;
T3.IN:=1;
T4.IN:=1;
addm_01(
AddrTable:= addr_01,
Execute:= T1.Q,
Addr:= '1.1');
//正转启动
S_01(
Execute:= INT_TO_BOOL(i1),
Abort:= INT_TO_BOOL(Stop),
Addr:= addr_01,
Timeout:= 0,
ObjType:= 0,
FirstObj:= 16#2000,
theWord:= WB_01);
//反转启动
S_02(
Execute:= INT_TO_BOOL(i2),
Abort:= INT_TO_BOOL(Stop),
Addr:= addr_01,
Timeout:= 0,
ObjType:= 0,
FirstObj:= 16#2000,
theWord:= WB_02);
//停机
S_03(
Execute:= INT_TO_BOOL(i3),
Abort:= INT_TO_BOOL(Stop),
Addr:= addr_01,
Timeout:= 0,
ObjType:= 0,
FirstObj:= 16#2000,
theWord:= WB_03);
//频率设定
S_04(
Execute:= INT_TO_BOOL(i4),
Abort:= INT_TO_BOOL(Stop),
Addr:= addr_01,
Timeout:= 0,
ObjType:= 0,
FirstObj:= 16#2001,
theWord:= WB_04);
//读当前频率
R_01(
Execute:= T2.Q,
Abort:= INT_TO_BOOL(Stop),
Addr:= addr_01,
Timeout:= 0,
ObjType:= 0,
FirstObj:= 16#0D00,
Quantity:= 1,
Buffer:= ADR(RB_01));
RM_01 := MOVE(RB_01);
//读当前电流
R_02(
Execute:= T3.Q,
Abort:= INT_TO_BOOL(Stop),
Addr:= addr_01,
Timeout:= 0,
ObjType:= 0,
FirstObj:= 16#0D02,
Quantity:= 1,
Buffer:= ADR(RB_02));
RM_02 := MOVE(RB_02);
//读当前电压
R_03(
Execute:= T4.Q,
Abort:= INT_TO_BOOL(Stop),
Addr:= addr_01,
Timeout:= 0,
ObjType:= 0,
FirstObj:= 16#0D03,
Quantity:= 1,
Buffer:= ADR(RB_03));
RM_03 := MOVE(RB_03);
IF T2.Q AND (R_01.Done OR R_01.Error) THEN
T2.IN:=0;
END_IF
IF T3.Q AND (R_02.Done OR R_02.Error) THEN
T3.IN:=0;
END_IF
IF T4.Q AND (R_03.Done OR R_03.Error) THEN
T4.IN:=0;
END_IF
读模块每一次上升沿读一次变频器数据,但读模块有时会报错导致不再读数据,所以后面定时器IN清0的条件添加了读模块Error的BOOL变量。
变频器
变频器监控参数地址
变频器修改通信控制地址