做了宏数据比较输出数据格式是32 bit unsigned 和32 bit BCD,总是不能准确按对应得进行比较数据0/1,那位高手帮忙看看,问题出那里了,谢谢
macro_command main()
unsigned int AAR0,AAR2,AAR4,AAR6, RW180,RW182,RW184,RW186,RW20,RW22,RW26
float ss,ss1,RW,RW6
short Alarm[66]
short pv[66] //设置函数范围
bool on=1,off=0 //设置状态函数形式
bool btt1,btt2 //设置状态函数形式
GetDataEx(AAR0, "Mitsubishi FX5U ", D, 618, 1) // 32 bit BCD数据格式
GetDataEx(AAR2, "Mitsubishi FX5U ", D, 630, 1) // 32 bit BCD数据格式
GetDataEx(ss, "Mitsubishi FX5U - Binary Mode (Ethernet)", D, 620, 1) // 32 bit unsigned数据格式
GetDataEx(RW180, "Local HMI", RW, 610, 1)
GetDataEx(RW182, "Local HMI", RW, 614, 1)
GetDataEx(RW, "Local HMI", RW, 620, 1)
SetData(AAR0, "Local HMI", LW, 190, 1)
SetData(AAR2, "Local HMI", LW, 192, 1)
SetData(ss, "Local HMI", LW, 194, 1)
//转发到HMI
AAR6=( AAR0+ RW180)
RW186=( AAR2+ RW182)
RW182=( SS+ RW)
SetData( AAR6, "Local HMI", LW, 610, 1)
SetData( RW186, "Local HMI", LW, 614, 1)
SetData( RW182, "Local HMI", LW, 616, 1)
if (AAR2 < RW20)then
btt2=0
else
SetData(btt2, "Local HMI", LB, 867, 1)
end if
if (AAR2 > RW20)then
btt2=1
else
SetData(btt2, "Local HMI", LB, 867, 1)
end if
if (AAR0 < RW22)then
btt1=0
else
SetData(btt1, "Local HMI", LB, 866, 1)
end if
if (AAR0 > RW22)then
btt1=1
else
SetData(btt1, "Local HMI ", LB, 866, 1)
end if
end macro_command
[ 此帖被dyxlfl在2024-08-19 18:05重新编辑 ]